1 | /* $Id: StorageControllerImpl.h 35638 2011-01-19 19:10:49Z 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 | VBOX_DEFAULT_INTERFACE_ENTRIES (IStorageController)
|
---|
39 | END_COM_MAP()
|
---|
40 |
|
---|
41 | StorageController() { };
|
---|
42 | ~StorageController() { };
|
---|
43 |
|
---|
44 | HRESULT FinalConstruct();
|
---|
45 | void FinalRelease();
|
---|
46 |
|
---|
47 | // public initializer/uninitializer for internal purposes only
|
---|
48 | HRESULT init(Machine *aParent,
|
---|
49 | const Utf8Str &aName,
|
---|
50 | StorageBus_T aBus,
|
---|
51 | ULONG aInstance,
|
---|
52 | bool fBootable);
|
---|
53 | HRESULT init(Machine *aParent,
|
---|
54 | StorageController *aThat,
|
---|
55 | bool aReshare = false);
|
---|
56 | HRESULT initCopy(Machine *aParent,
|
---|
57 | StorageController *aThat);
|
---|
58 | void uninit();
|
---|
59 |
|
---|
60 | // IStorageController properties
|
---|
61 | STDMETHOD(COMGETTER(Name)) (BSTR *aName);
|
---|
62 | STDMETHOD(COMGETTER(Bus)) (StorageBus_T *aBus);
|
---|
63 | STDMETHOD(COMGETTER(ControllerType)) (StorageControllerType_T *aControllerType);
|
---|
64 | STDMETHOD(COMSETTER(ControllerType)) (StorageControllerType_T aControllerType);
|
---|
65 | STDMETHOD(COMGETTER(MaxDevicesPerPortCount)) (ULONG *aMaxDevices);
|
---|
66 | STDMETHOD(COMGETTER(MinPortCount)) (ULONG *aMinPortCount);
|
---|
67 | STDMETHOD(COMGETTER(MaxPortCount)) (ULONG *aMaxPortCount);
|
---|
68 | STDMETHOD(COMGETTER(PortCount)) (ULONG *aPortCount);
|
---|
69 | STDMETHOD(COMSETTER(PortCount)) (ULONG aPortCount);
|
---|
70 | STDMETHOD(COMGETTER(Instance)) (ULONG *aInstance);
|
---|
71 | STDMETHOD(COMSETTER(Instance)) (ULONG aInstance);
|
---|
72 | STDMETHOD(COMGETTER(UseHostIOCache)) (BOOL *fUseHostIOCache);
|
---|
73 | STDMETHOD(COMSETTER(UseHostIOCache)) (BOOL fUseHostIOCache);
|
---|
74 | STDMETHOD(COMGETTER(Bootable)) (BOOL *fBootable);
|
---|
75 |
|
---|
76 | // StorageController methods
|
---|
77 | STDMETHOD(GetIDEEmulationPort) (LONG DevicePosition, LONG *aPortNumber);
|
---|
78 | STDMETHOD(SetIDEEmulationPort) (LONG DevicePosition, LONG aPortNumber);
|
---|
79 |
|
---|
80 | // public methods only for internal purposes
|
---|
81 |
|
---|
82 | const Utf8Str &getName() const;
|
---|
83 | StorageControllerType_T getControllerType() const;
|
---|
84 | StorageBus_T getStorageBus() const;
|
---|
85 | ULONG getInstance() const;
|
---|
86 | bool getBootable() const;
|
---|
87 |
|
---|
88 | HRESULT checkPortAndDeviceValid(LONG aControllerPort,
|
---|
89 | LONG aDevice);
|
---|
90 |
|
---|
91 | void setBootable(BOOL fBootable);
|
---|
92 |
|
---|
93 | void rollback();
|
---|
94 | void commit();
|
---|
95 |
|
---|
96 | // public methods for internal purposes only
|
---|
97 | // (ensure there is a caller and a read lock before calling them!)
|
---|
98 |
|
---|
99 | void unshare();
|
---|
100 |
|
---|
101 | /** @note this doesn't require a read lock since mParent is constant. */
|
---|
102 | Machine* getMachine();
|
---|
103 |
|
---|
104 | ComObjPtr<StorageController> getPeer();
|
---|
105 |
|
---|
106 | private:
|
---|
107 |
|
---|
108 | void printList();
|
---|
109 |
|
---|
110 | struct Data;
|
---|
111 | Data *m;
|
---|
112 | };
|
---|
113 |
|
---|
114 | #endif //!____H_STORAGECONTROLLERIMPL
|
---|
115 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|