1 | /* $Id: StorageControllerImpl.h 29480 2010-05-14 15:24:19Z 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 | public VirtualBoxSupportErrorInfoImpl<StorageController, IStorageController>,
|
---|
28 | public VirtualBoxSupportTranslation<StorageController>,
|
---|
29 | VBOX_SCRIPTABLE_IMPL(IStorageController)
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (StorageController)
|
---|
34 |
|
---|
35 | DECLARE_NOT_AGGREGATABLE (StorageController)
|
---|
36 |
|
---|
37 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
38 |
|
---|
39 | BEGIN_COM_MAP(StorageController)
|
---|
40 | COM_INTERFACE_ENTRY (ISupportErrorInfo)
|
---|
41 | COM_INTERFACE_ENTRY (IStorageController)
|
---|
42 | COM_INTERFACE_ENTRY2 (IDispatch, IStorageController)
|
---|
43 | END_COM_MAP()
|
---|
44 |
|
---|
45 | StorageController() { };
|
---|
46 | ~StorageController() { };
|
---|
47 |
|
---|
48 | HRESULT FinalConstruct();
|
---|
49 | void FinalRelease();
|
---|
50 |
|
---|
51 | // public initializer/uninitializer for internal purposes only
|
---|
52 | HRESULT init(Machine *aParent,
|
---|
53 | const Utf8Str &aName,
|
---|
54 | StorageBus_T aBus,
|
---|
55 | ULONG aInstance);
|
---|
56 | HRESULT init(Machine *aParent,
|
---|
57 | StorageController *aThat,
|
---|
58 | bool aReshare = false);
|
---|
59 | HRESULT initCopy(Machine *aParent,
|
---|
60 | StorageController *aThat);
|
---|
61 | void uninit();
|
---|
62 |
|
---|
63 | // IStorageController properties
|
---|
64 | STDMETHOD(COMGETTER(Name)) (BSTR *aName);
|
---|
65 | STDMETHOD(COMGETTER(Bus)) (StorageBus_T *aBus);
|
---|
66 | STDMETHOD(COMGETTER(ControllerType)) (StorageControllerType_T *aControllerType);
|
---|
67 | STDMETHOD(COMSETTER(ControllerType)) (StorageControllerType_T aControllerType);
|
---|
68 | STDMETHOD(COMGETTER(MaxDevicesPerPortCount)) (ULONG *aMaxDevices);
|
---|
69 | STDMETHOD(COMGETTER(MinPortCount)) (ULONG *aMinPortCount);
|
---|
70 | STDMETHOD(COMGETTER(MaxPortCount)) (ULONG *aMaxPortCount);
|
---|
71 | STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);
|
---|
72 | STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);
|
---|
73 | STDMETHOD(COMGETTER(Instance)) (ULONG *aInstance);
|
---|
74 | STDMETHOD(COMSETTER(Instance)) (ULONG aInstance);
|
---|
75 | STDMETHOD(COMGETTER(UseHostIOCache)) (BOOL *fUseHostIOCache);
|
---|
76 | STDMETHOD(COMSETTER(UseHostIOCache)) (BOOL fUseHostIOCache);
|
---|
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 |
|
---|
89 | void rollback();
|
---|
90 | void commit();
|
---|
91 |
|
---|
92 | // public methods for internal purposes only
|
---|
93 | // (ensure there is a caller and a read lock before calling them!)
|
---|
94 |
|
---|
95 | void unshare();
|
---|
96 |
|
---|
97 | /** @note this doesn't require a read lock since mParent is constant. */
|
---|
98 | Machine* getMachine();
|
---|
99 |
|
---|
100 | ComObjPtr<StorageController> getPeer();
|
---|
101 |
|
---|
102 | // for VirtualBoxSupportErrorInfoImpl
|
---|
103 | static const wchar_t *getComponentName() { return L"StorageController"; }
|
---|
104 |
|
---|
105 | private:
|
---|
106 |
|
---|
107 | void printList();
|
---|
108 |
|
---|
109 | struct Data;
|
---|
110 | Data *m;
|
---|
111 | };
|
---|
112 |
|
---|
113 | #endif //!____H_STORAGECONTROLLERIMPL
|
---|
114 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|