Changeset 25200 in vbox for trunk/src/VBox/Main/include/MediumAttachmentImpl.h
- Timestamp:
- Dec 4, 2009 6:19:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r24989 r25200 25 25 #include "VirtualBoxBase.h" 26 26 27 #include "MediumImpl.h"28 29 27 class Machine; 30 28 class Medium; … … 48 46 END_COM_MAP() 49 47 50 DECLARE_EMPTY_CTOR_DTOR(MediumAttachment) 48 MediumAttachment() { }; 49 ~MediumAttachment() { }; 51 50 52 51 // public initializer/uninitializer for internal purposes only … … 63 62 void FinalRelease(); 64 63 65 bool rollback();66 void commit();67 68 64 // IMediumAttachment properties 69 65 STDMETHOD(COMGETTER(Medium))(IMedium **aMedium); … … 74 70 STDMETHOD(COMGETTER(Passthrough))(BOOL *aPassthrough); 75 71 76 // unsafe inline public methods for internal purposes only (ensure there is 72 // public internal methods 73 bool rollback(); 74 void commit(); 75 76 // unsafe public methods for internal purposes only (ensure there is 77 77 // a caller and a read lock before calling them!) 78 bool isImplicit() const; 79 void setImplicit(bool aImplicit); 78 80 79 bool isImplicit() const { return m->implicit; } 80 void setImplicit(bool aImplicit) { m->implicit = aImplicit; } 81 const ComObjPtr<Medium>& getMedium() const; 82 Bstr getControllerName() const; 83 LONG getPort() const; 84 LONG getDevice() const; 85 DeviceType_T getType() const; 86 bool getPassthrough() const; 81 87 82 const ComObjPtr<Medium>& getMedium() const { return m->medium; } 83 Bstr getControllerName() const { return m->controllerName; } 84 LONG getPort() const { return m->port; } 85 LONG getDevice() const { return m->device; } 86 DeviceType_T getType() const { return m->type; } 87 bool getPassthrough() const { AutoReadLock lock(this); return m->passthrough; } 88 89 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice) 90 { 91 return ( aControllerName == m->controllerName 92 && aPort == m->port 93 && aDevice == m->device); 94 } 88 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice); 95 89 96 90 /** Must be called from under this object's write lock. */ 97 void updateMedium(const ComObjPtr<Medium> &aMedium, bool aImplicit) 98 { 99 m.backup(); 100 m->medium = aMedium; 101 m->implicit = aImplicit; 102 } 91 void updateMedium(const ComObjPtr<Medium> &aMedium, bool aImplicit); 103 92 104 93 /** Must be called from under this object's write lock. */ 105 void updatePassthrough(bool aPassthrough) 106 { 107 m.backup(); 108 m->passthrough = aPassthrough; 109 } 94 void updatePassthrough(bool aPassthrough); 110 95 111 96 /** Get a unique and somewhat descriptive name for logging. */ … … 116 101 117 102 private: 118 119 /** Reference to Machine object, for checking mutable state. */ 120 const ComObjPtr<Machine, ComWeakRef> mParent; 121 /* later: const ComObjPtr<MediumAttachment> mPeer; */ 122 123 struct Data 124 { 125 Data() : port(0), device(0), type(DeviceType_Null), 126 passthrough(false), implicit(false) {} 127 128 bool operator== (const Data &that) const 129 { 130 return this == &that 131 || (passthrough == that.passthrough); 132 } 133 134 ComObjPtr<Medium> medium; 135 /* Since MediumAttachment is not a first class citizen when it 136 * comes to managing settings, having a reference to the storage 137 * controller will not work - when settings are changed it will point 138 * to the old, uninitialized instance. Changing this requires 139 * substantial changes to MediumImpl.cpp. */ 140 const Bstr controllerName; 141 const LONG port; 142 const LONG device; 143 const DeviceType_T type; 144 bool passthrough : 1; 145 bool implicit : 1; 146 }; 147 148 Backupable<Data> m; 103 struct Data; 104 Data *m; 149 105 150 106 Utf8Str mLogName; /**< For logging purposes */
Note:
See TracChangeset
for help on using the changeset viewer.