1 | /* $Id: StorageControllerImpl.h 34010 2010-11-11 20:17:47Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VBox StorageController COM Class declaration.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2008 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_STORAGECONTROLLERIMPL
|
---|
21 | #define ____H_STORAGECONTROLLERIMPL
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 |
|
---|
25 | class ATL_NO_VTABLE StorageController :
|
---|
26 | public VirtualBoxBase,
|
---|
27 | VBOX_SCRIPTABLE_IMPL(IStorageController)
|
---|
28 | {
|
---|
29 | public:
|
---|
30 |
|
---|
31 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(StorageController, IStorageController)
|
---|
32 |
|
---|
33 | DECLARE_NOT_AGGREGATABLE (StorageController)
|
---|
34 |
|
---|
35 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
36 |
|
---|
37 | BEGIN_COM_MAP(StorageController)
|
---|
38 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
39 | COM_INTERFACE_ENTRY (IStorageController)
|
---|
40 | COM_INTERFACE_ENTRY2 (IDispatch, IStorageController)
|
---|
41 | END_COM_MAP()
|
---|
42 |
|
---|
43 | StorageController() { };
|
---|
44 | ~StorageController() { };
|
---|
45 |
|
---|
46 | HRESULT FinalConstruct();
|
---|
47 | void FinalRelease();
|
---|
48 |
|
---|
49 | // public initializer/uninitializer for internal purposes only
|
---|
50 | HRESULT init(Machine *aParent,
|
---|
51 | const Utf8Str &aName,
|
---|
52 | StorageBus_T aBus,
|
---|
53 | ULONG aInstance,
|
---|
54 | bool fBootable);
|
---|
55 | HRESULT init(Machine *aParent,
|
---|
56 | StorageController *aThat,
|
---|
57 | bool aReshare = false);
|
---|
58 | HRESULT initCopy(Machine *aParent,
|
---|
59 | StorageController *aThat);
|
---|
60 | void uninit();
|
---|
61 |
|
---|
62 | // IStorageController properties
|
---|
63 | STDMETHOD(COMGETTER(Name)) (BSTR *aName);
|
---|
64 | STDMETHOD(COMGETTER(Bus)) (StorageBus_T *aBus);
|
---|
65 | STDMETHOD(COMGETTER(ControllerType)) (StorageControllerType_T *aControllerType);
|
---|
66 | STDMETHOD(COMSETTER(ControllerType)) (StorageControllerType_T aControllerType);
|
---|
67 | STDMETHOD(COMGETTER(MaxDevicesPerPortCount)) (ULONG *aMaxDevices);
|
---|
68 | STDMETHOD(COMGETTER(MinPortCount)) (ULONG *aMinPortCount);
|
---|
69 | STDMETHOD(COMGETTER(MaxPortCount)) (ULONG *aMaxPortCount);
|
---|
70 | STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);
|
---|
71 | STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);
|
---|
72 | STDMETHOD(COMGETTER(Instance)) (ULONG *aInstance);
|
---|
73 | STDMETHOD(COMSETTER(Instance)) (ULONG aInstance);
|
---|
74 | STDMETHOD(COMGETTER(UseHostIOCache)) (BOOL *fUseHostIOCache);
|
---|
75 | STDMETHOD(COMSETTER(UseHostIOCache)) (BOOL fUseHostIOCache);
|
---|
76 | STDMETHOD(COMGETTER(Bootable)) (BOOL *fBootable);
|
---|
77 |
|
---|
78 | // StorageController methods
|
---|
79 | STDMETHOD(GetIDEEmulationPort) (LONG DevicePosition, LONG *aPortNumber);
|
---|
80 | STDMETHOD(SetIDEEmulationPort) (LONG DevicePosition, LONG aPortNumber);
|
---|
81 |
|
---|
82 | // public methods only for internal purposes
|
---|
83 |
|
---|
84 | const Utf8Str &getName() const;
|
---|
85 | StorageControllerType_T getControllerType() const;
|
---|
86 | StorageBus_T getStorageBus() const;
|
---|
87 | ULONG getInstance() const;
|
---|
88 | bool getBootable() const;
|
---|
89 |
|
---|
90 | HRESULT checkPortAndDeviceValid(LONG aControllerPort,
|
---|
91 | LONG aDevice);
|
---|
92 |
|
---|
93 | void setBootable(BOOL fBootable);
|
---|
94 |
|
---|
95 | void rollback();
|
---|
96 | void commit();
|
---|
97 |
|
---|
98 | // public methods for internal purposes only
|
---|
99 | // (ensure there is a caller and a read lock before calling them!)
|
---|
100 |
|
---|
101 | void unshare();
|
---|
102 |
|
---|
103 | /** @note this doesn't require a read lock since mParent is constant. */
|
---|
104 | Machine* getMachine();
|
---|
105 |
|
---|
106 | ComObjPtr<StorageController> getPeer();
|
---|
107 |
|
---|
108 | private:
|
---|
109 |
|
---|
110 | void printList();
|
---|
111 |
|
---|
112 | struct Data;
|
---|
113 | Data *m;
|
---|
114 | };
|
---|
115 |
|
---|
116 | #endif //!____H_STORAGECONTROLLERIMPL
|
---|
117 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|