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