1 | /* $Id: PciDeviceAttachmentImpl.h 35684 2011-01-24 15:28:38Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * PCI attachment information implmentation.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2010 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef ____H_PCIDEVICEATTACHMENTIMPL
|
---|
21 | #define ____H_PCIDEVICEATTACHMENTIMPL
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 |
|
---|
25 | class ATL_NO_VTABLE PciAddress :
|
---|
26 | public VirtualBoxBase,
|
---|
27 | VBOX_SCRIPTABLE_IMPL(IPciAddress)
|
---|
28 | {
|
---|
29 | public:
|
---|
30 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(PciAddress, IPciAddress)
|
---|
31 |
|
---|
32 | DECLARE_NOT_AGGREGATABLE(PciAddress)
|
---|
33 |
|
---|
34 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
35 |
|
---|
36 | BEGIN_COM_MAP(PciAddress)
|
---|
37 | VBOX_DEFAULT_INTERFACE_ENTRIES(IPciAddress)
|
---|
38 | END_COM_MAP()
|
---|
39 |
|
---|
40 | PciAddress() { }
|
---|
41 | ~PciAddress() { }
|
---|
42 |
|
---|
43 | // public initializer/uninitializer for internal purposes only
|
---|
44 | HRESULT init(LONG aAddess);
|
---|
45 | void uninit();
|
---|
46 |
|
---|
47 | HRESULT FinalConstruct();
|
---|
48 | void FinalRelease();
|
---|
49 |
|
---|
50 | // IPciAddress properties
|
---|
51 | STDMETHOD(COMGETTER(Bus))(SHORT *aBus)
|
---|
52 | {
|
---|
53 | *aBus = mBus;
|
---|
54 | return S_OK;
|
---|
55 | }
|
---|
56 | STDMETHOD(COMSETTER(Bus))(SHORT aBus)
|
---|
57 | {
|
---|
58 | mBus = aBus;
|
---|
59 | return S_OK;
|
---|
60 | }
|
---|
61 | STDMETHOD(COMGETTER(Device))(SHORT *aDevice)
|
---|
62 | {
|
---|
63 | *aDevice = mDevice;
|
---|
64 | return S_OK;
|
---|
65 | }
|
---|
66 | STDMETHOD(COMSETTER(Device))(SHORT aDevice)
|
---|
67 | {
|
---|
68 | mDevice = aDevice;
|
---|
69 | return S_OK;
|
---|
70 | }
|
---|
71 |
|
---|
72 | STDMETHOD(COMGETTER(DevFunction))(SHORT *aDevFunction)
|
---|
73 | {
|
---|
74 | *aDevFunction = mFn;
|
---|
75 | return S_OK;
|
---|
76 | }
|
---|
77 | STDMETHOD(COMSETTER(DevFunction))(SHORT aDevFunction)
|
---|
78 | {
|
---|
79 | mFn = aDevFunction;
|
---|
80 | return S_OK;
|
---|
81 | }
|
---|
82 |
|
---|
83 | private:
|
---|
84 | SHORT mBus, mDevice, mFn;
|
---|
85 | };
|
---|
86 |
|
---|
87 | class ATL_NO_VTABLE PciDeviceAttachment :
|
---|
88 | public VirtualBoxBase,
|
---|
89 | VBOX_SCRIPTABLE_IMPL(IPciDeviceAttachment)
|
---|
90 | {
|
---|
91 | public:
|
---|
92 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(PciDeviceAttachment, IPciDeviceAttachment)
|
---|
93 |
|
---|
94 | DECLARE_NOT_AGGREGATABLE(PciDeviceAttachment)
|
---|
95 |
|
---|
96 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
97 |
|
---|
98 | BEGIN_COM_MAP(PciDeviceAttachment)
|
---|
99 | VBOX_DEFAULT_INTERFACE_ENTRIES(IPciDeviceAttachment)
|
---|
100 | END_COM_MAP()
|
---|
101 |
|
---|
102 | PciDeviceAttachment() { }
|
---|
103 | ~PciDeviceAttachment() { }
|
---|
104 |
|
---|
105 | // public initializer/uninitializer for internal purposes only
|
---|
106 | HRESULT init(IMachine * aParent,
|
---|
107 | const Bstr &aName,
|
---|
108 | LONG aHostAddess,
|
---|
109 | LONG aGuestAddress,
|
---|
110 | BOOL fPhysical);
|
---|
111 | void uninit();
|
---|
112 |
|
---|
113 | HRESULT FinalConstruct();
|
---|
114 | void FinalRelease();
|
---|
115 |
|
---|
116 | // IPciDeviceAttachment properties
|
---|
117 | STDMETHOD(COMGETTER(Name))(BSTR * aName);
|
---|
118 | STDMETHOD(COMGETTER(IsPhysicalDevice))(BOOL * aPhysical);
|
---|
119 | STDMETHOD(COMGETTER(HostAddress))(LONG * hostAddress);
|
---|
120 | STDMETHOD(COMGETTER(GuestAddress))(LONG * guestAddress);
|
---|
121 |
|
---|
122 | private:
|
---|
123 | struct Data;
|
---|
124 | Data *m;
|
---|
125 | };
|
---|
126 |
|
---|
127 | #endif // ____H_PCIDEVICEATTACHMENTIMPL
|
---|