VirtualBox

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

Last change on this file since 13538 was 8155, checked in by vboxsync, 16 years ago

The Big Sun Rebranding Header Change

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

© 2023 Oracle
ContactPrivacy policyTerms of Use