VirtualBox

source: vbox/trunk/src/VBox/Main/include/DVDDriveImpl.h@ 8083

Last change on this file since 8083 was 8083, checked in by vboxsync, 17 years ago

Main: Renamed AutoLock => AutoWriteLock; AutoReaderLock => AutoReadLock.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: DVDDriveImpl.h 8083 2008-04-17 09:12:12Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2007 innotek GmbH
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_DVDDRIVEIMPL
21#define ____H_DVDDRIVEIMPL
22
23#include "VirtualBoxBase.h"
24
25class Machine;
26
27class ATL_NO_VTABLE DVDDrive :
28 public VirtualBoxBaseNEXT,
29 public VirtualBoxSupportErrorInfoImpl <DVDDrive, IDVDDrive>,
30 public VirtualBoxSupportTranslation <DVDDrive>,
31 public IDVDDrive
32{
33public:
34
35 struct Data
36 {
37 Data() {
38 mDriveState = DriveState_NotMounted;
39 mPassthrough = false;
40 }
41
42 bool operator== (const Data &that) const
43 {
44 return this == &that ||
45 (mDriveState == that.mDriveState &&
46 mDVDImage.equalsTo (that.mDVDImage) &&
47 mHostDrive.equalsTo (that.mHostDrive));
48 }
49
50 ComPtr <IDVDImage> mDVDImage;
51 ComPtr <IHostDVDDrive> mHostDrive;
52 DriveState_T mDriveState;
53 BOOL mPassthrough;
54 };
55
56 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (DVDDrive)
57
58 DECLARE_NOT_AGGREGATABLE(DVDDrive)
59
60 DECLARE_PROTECT_FINAL_CONSTRUCT()
61
62 BEGIN_COM_MAP(DVDDrive)
63 COM_INTERFACE_ENTRY(ISupportErrorInfo)
64 COM_INTERFACE_ENTRY(IDVDDrive)
65 END_COM_MAP()
66
67 NS_DECL_ISUPPORTS
68
69 DECLARE_EMPTY_CTOR_DTOR (DVDDrive)
70
71 HRESULT FinalConstruct();
72 void FinalRelease();
73
74 // public initializer/uninitializer for internal purposes only
75 HRESULT init (Machine *aParent);
76 HRESULT init (Machine *aParent, DVDDrive *aThat);
77 HRESULT initCopy (Machine *aParent, DVDDrive *aThat);
78 void uninit();
79
80 // IDVDDrive properties
81 STDMETHOD(COMGETTER(State)) (DriveState_T *aDriveState);
82 STDMETHOD(COMGETTER(Passthrough)) (BOOL *aPassthrough);
83 STDMETHOD(COMSETTER(Passthrough)) (BOOL aPassthrough);
84
85 // IDVDDrive methods
86 STDMETHOD(MountImage) (INPTR GUIDPARAM aImageId);
87 STDMETHOD(CaptureHostDrive) (IHostDVDDrive *aHostDVDDrive);
88 STDMETHOD(Unmount)();
89 STDMETHOD(GetImage) (IDVDImage **aDVDImage);
90 STDMETHOD(GetHostDrive) (IHostDVDDrive **aHostDVDDrive);
91
92 // public methods only for internal purposes
93
94 HRESULT loadSettings (const settings::Key &aMachineNode);
95 HRESULT saveSettings (settings::Key &aMachineNode);
96
97 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
98 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
99 bool rollback();
100 void commit();
101 void copyFrom (DVDDrive *aThat);
102
103 // public methods for internal purposes only
104 // (ensure there is a caller and a read lock before calling them!)
105
106 Backupable <Data> &data() { return mData; }
107
108 // for VirtualBoxSupportErrorInfoImpl
109 static const wchar_t *getComponentName() { return L"DVDDrive"; }
110
111private:
112
113 HRESULT unmount();
114
115 const ComObjPtr <Machine, ComWeakRef> mParent;
116 const ComObjPtr <DVDDrive> mPeer;
117
118 Backupable <Data> mData;
119};
120
121#endif // ____H_DVDDRIVEIMPL
122
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette