Changeset 25194 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Dec 4, 2009 3:59:34 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 55674
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/USBControllerImpl.h
r24989 r25194 48 48 49 49 class ATL_NO_VTABLE USBController : 50 public VirtualBoxBase WithChildrenNEXT,50 public VirtualBoxBase, 51 51 public VirtualBoxSupportErrorInfoImpl<USBController, IUSBController>, 52 52 public VirtualBoxSupportTranslation<USBController>, 53 53 VBOX_SCRIPTABLE_IMPL(IUSBController) 54 54 { 55 private:56 57 struct Data58 {59 /* Constructor. */60 Data() : mEnabled (FALSE), mEnabledEhci (FALSE) { }61 62 bool operator== (const Data &that) const63 {64 return this == &that || (mEnabled == that.mEnabled && mEnabledEhci == that.mEnabledEhci);65 }66 67 /** Enabled indicator. */68 BOOL mEnabled;69 70 /** Enabled indicator for EHCI. */71 BOOL mEnabledEhci;72 };73 74 55 public: 75 76 56 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (USBController) 77 57 … … 133 113 // public methods for internal purposes only 134 114 // (ensure there is a caller and a read lock before calling them!) 135 136 /** @note this doesn't require a read lock since mParent is constant. */ 137 const ComObjPtr<Machine, ComWeakRef> &parent() { return mParent; }; 138 139 const Backupable<Data>& getData() { return mData; } 115 Machine* getMachine(); 140 116 141 117 // for VirtualBoxSupportErrorInfoImpl … … 144 120 private: 145 121 146 #ifdef VBOX_WITH_USB147 /** specialization for IUSBDeviceFilter */148 ComObjPtr<USBDeviceFilter> getDependentChild (IUSBDeviceFilter *aFilter)149 {150 VirtualBoxBase *child = VirtualBoxBaseWithChildrenNEXT::151 getDependentChild (ComPtr<IUnknown> (aFilter));152 return child ? static_cast <USBDeviceFilter *> (child)153 : NULL;154 }155 #endif /* VBOX_WITH_USB */156 157 122 void printList(); 158 123 159 /** Parent object. */ 160 const ComObjPtr<Machine, ComWeakRef> mParent; 161 /** Peer object. */ 162 const ComObjPtr<USBController> mPeer; 163 /** Data. */ 164 Backupable<Data> mData; 165 166 #ifdef VBOX_WITH_USB 167 // the following fields need special backup/rollback/commit handling, 168 // so they cannot be a part of Data 169 170 typedef std::list <ComObjPtr<USBDeviceFilter> > DeviceFilterList; 171 Backupable <DeviceFilterList> mDeviceFilters; 172 #endif /* VBOX_WITH_USB */ 124 struct Data; 125 Data *m; 173 126 }; 174 127 -
trunk/src/VBox/Main/include/objectslist.h
r25184 r25194 67 67 } 68 68 69 private: 70 // prohibit copying and assignment 71 ObjectsList(const ObjectsList &d); 72 ObjectsList& operator=(const ObjectsList &d); 73 74 public: 75 69 76 /** 70 77 * Returns the lock handle which protects this list, for use with … … 113 120 m_ll.push_back(*it); 114 121 } 115 }116 117 /**118 * Returns the no. of objects on the list (std::list compatibility)119 * with locking.120 */121 size_t size()122 {123 AutoReadLock al(m_lock);124 return m_ll.size();125 }126 127 /**128 * Returns the first object on the list (std::list compatibility)129 * with locking.130 */131 MyType front()132 {133 AutoReadLock al(m_lock);134 return m_ll.front();135 }136 137 /**138 * Returns a raw pointer to the member list of objects.139 * Does not lock!140 * @return141 */142 MyList& getList()143 {144 return m_ll;145 }146 147 /**148 * Returns the begin iterator from the list (std::list compatibility).149 * Does not lock!150 * @return151 */152 iterator begin()153 {154 return m_ll.begin();155 }156 157 /**158 * Returns the end iterator from the list (std::list compatibility).159 * Does not lock!160 */161 iterator end()162 {163 return m_ll.end();164 122 } 165 123 … … 181 139 } 182 140 141 /** 142 * Returns the no. of objects on the list (std::list compatibility) 143 * with locking. 144 */ 145 size_t size() 146 { 147 AutoReadLock al(m_lock); 148 return m_ll.size(); 149 } 150 151 /** 152 * Returns a raw pointer to the member list of objects. 153 * Does not lock! 154 * @return 155 */ 156 MyList& getList() 157 { 158 return m_ll; 159 } 160 161 /** 162 * Returns the first object on the list (std::list compatibility) 163 * with locking. 164 */ 165 MyType front() 166 { 167 AutoReadLock al(m_lock); 168 return m_ll.front(); 169 } 170 171 /** 172 * Returns the begin iterator from the list (std::list compatibility). 173 * Does not lock! 174 * @return 175 */ 176 iterator begin() 177 { 178 return m_ll.begin(); 179 } 180 181 /** 182 * Returns the end iterator from the list (std::list compatibility). 183 * Does not lock! 184 */ 185 iterator end() 186 { 187 return m_ll.end(); 188 } 189 190 void insert(iterator it, MyType &p) 191 { 192 m_ll.insert(it, p); 193 } 194 195 void erase(iterator it) 196 { 197 m_ll.erase(it); 198 } 199 183 200 private: 184 201 MyList m_ll;
Note:
See TracChangeset
for help on using the changeset viewer.