VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_DVDDRIVEIMPL
19#define ____H_DVDDRIVEIMPL
20
21#include "VirtualBoxBase.h"
22
23class Machine;
24
25class ATL_NO_VTABLE DVDDrive :
26 public VirtualBoxBaseNEXT,
27 public VirtualBoxSupportErrorInfoImpl <DVDDrive, IDVDDrive>,
28 public VirtualBoxSupportTranslation <DVDDrive>,
29 public IDVDDrive
30{
31public:
32
33 struct Data
34 {
35 Data() {
36 mDriveState = DriveState_NotMounted;
37 mPassthrough = false;
38 }
39
40 bool operator== (const Data &that) const
41 {
42 return this == &that ||
43 (mDriveState == that.mDriveState &&
44 mDVDImage.equalsTo (that.mDVDImage) &&
45 mHostDrive.equalsTo (that.mHostDrive));
46 }
47
48 ComPtr <IDVDImage> mDVDImage;
49 ComPtr <IHostDVDDrive> mHostDrive;
50 DriveState_T mDriveState;
51 BOOL mPassthrough;
52 };
53
54 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (DVDDrive)
55
56 DECLARE_NOT_AGGREGATABLE(DVDDrive)
57
58 DECLARE_PROTECT_FINAL_CONSTRUCT()
59
60 BEGIN_COM_MAP(DVDDrive)
61 COM_INTERFACE_ENTRY(ISupportErrorInfo)
62 COM_INTERFACE_ENTRY(IDVDDrive)
63 END_COM_MAP()
64
65 NS_DECL_ISUPPORTS
66
67 DECLARE_EMPTY_CTOR_DTOR (DVDDrive)
68
69 HRESULT FinalConstruct();
70 void FinalRelease();
71
72 // public initializer/uninitializer for internal purposes only
73 HRESULT init (Machine *aParent);
74 HRESULT init (Machine *aParent, DVDDrive *aThat);
75 HRESULT initCopy (Machine *aParent, DVDDrive *aThat);
76 void uninit();
77
78 // IDVDDrive properties
79 STDMETHOD(COMGETTER(State)) (DriveState_T *aDriveState);
80 STDMETHOD(COMGETTER(Passthrough)) (BOOL *aPassthrough);
81 STDMETHOD(COMSETTER(Passthrough)) (BOOL aPassthrough);
82
83 // IDVDDrive methods
84 STDMETHOD(MountImage) (INPTR GUIDPARAM aImageId);
85 STDMETHOD(CaptureHostDrive) (IHostDVDDrive *aHostDVDDrive);
86 STDMETHOD(Unmount)();
87 STDMETHOD(GetImage) (IDVDImage **aDVDImage);
88 STDMETHOD(GetHostDrive) (IHostDVDDrive **aHostDVDDrive);
89
90 // public methods only for internal purposes
91
92 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
93 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
94 bool rollback();
95 void commit();
96 void copyFrom (DVDDrive *aThat);
97
98 // public methods for internal purposes only
99 // (ensure there is a caller and a read lock before calling them!)
100
101 Backupable <Data> &data() { return mData; }
102
103 // for VirtualBoxSupportErrorInfoImpl
104 static const wchar_t *getComponentName() { return L"DVDDrive"; }
105
106private:
107
108 HRESULT unmount();
109
110 const ComObjPtr <Machine, ComWeakRef> mParent;
111 const ComObjPtr <DVDDrive> mPeer;
112
113 Backupable <Data> mData;
114};
115
116#endif // ____H_DVDDRIVEIMPL
117
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