VirtualBox

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

Last change on this file since 22309 was 22183, checked in by vboxsync, 15 years ago

Main: fix more windows warnings + burns

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: DVDDriveImpl.h 22183 2009-08-11 17:00:33Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2008 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
29#include "MediumImpl.h"
30
31class Machine;
32
33namespace settings
34{
35 struct DVDDrive;
36}
37
38class ATL_NO_VTABLE DVDDrive :
39 public VirtualBoxBase,
40 public VirtualBoxSupportErrorInfoImpl<DVDDrive, IDVDDrive>,
41 public VirtualBoxSupportTranslation<DVDDrive>,
42 VBOX_SCRIPTABLE_IMPL(IDVDDrive)
43{
44public:
45
46 struct Data
47 {
48 Data()
49 {
50 state = DriveState_NotMounted;
51 passthrough = false;
52 }
53
54 bool operator== (const Data &that) const
55 {
56 return this == &that ||
57 (state == that.state &&
58 image.equalsTo (that.image) &&
59 hostDrive.equalsTo (that.hostDrive));
60 }
61
62 ComObjPtr<DVDImage> image;
63 ComPtr<IHostDVDDrive> hostDrive;
64 DriveState_T state;
65 BOOL passthrough;
66 };
67
68 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (DVDDrive)
69
70 DECLARE_NOT_AGGREGATABLE(DVDDrive)
71
72 DECLARE_PROTECT_FINAL_CONSTRUCT()
73
74 BEGIN_COM_MAP(DVDDrive)
75 COM_INTERFACE_ENTRY(ISupportErrorInfo)
76 COM_INTERFACE_ENTRY(IDVDDrive)
77 COM_INTERFACE_ENTRY(IDispatch)
78 END_COM_MAP()
79
80 NS_DECL_ISUPPORTS
81
82 DECLARE_EMPTY_CTOR_DTOR (DVDDrive)
83
84 HRESULT FinalConstruct();
85 void FinalRelease();
86
87 // public initializer/uninitializer for internal purposes only
88 HRESULT init (Machine *aParent);
89 HRESULT init (Machine *aParent, DVDDrive *aThat);
90 HRESULT initCopy (Machine *aParent, DVDDrive *aThat);
91 void uninit();
92
93 // IDVDDrive properties
94 STDMETHOD(COMGETTER(State)) (DriveState_T *aState);
95 STDMETHOD(COMGETTER(Passthrough)) (BOOL *aPassthrough);
96 STDMETHOD(COMSETTER(Passthrough)) (BOOL aPassthrough);
97
98 // IDVDDrive methods
99 STDMETHOD(MountImage) (IN_BSTR aImageId);
100 STDMETHOD(CaptureHostDrive) (IHostDVDDrive *aHostDVDDrive);
101 STDMETHOD(Unmount)();
102 STDMETHOD(GetImage)(IDVDImage **aDVDImage);
103 STDMETHOD(GetHostDrive) (IHostDVDDrive **aHostDVDDrive);
104
105 // public methods only for internal purposes
106
107 HRESULT loadSettings(const settings::DVDDrive &data);
108 HRESULT saveSettings(settings::DVDDrive &data);
109
110 bool isModified() { AutoWriteLock alock (this); return m.isBackedUp(); }
111 bool isReallyModified() { AutoWriteLock alock (this); return m.hasActualChanges(); }
112 bool rollback();
113 void commit();
114 void copyFrom (DVDDrive *aThat);
115
116 HRESULT unmount();
117
118 // public methods for internal purposes only
119 // (ensure there is a caller and a read lock before calling them!)
120
121 Backupable <Data> &data() { return m; }
122
123 // for VirtualBoxSupportErrorInfoImpl
124 static const wchar_t *getComponentName() { return L"DVDDrive"; }
125
126private:
127
128 const ComObjPtr<Machine, ComWeakRef> mParent;
129 const ComObjPtr<DVDDrive> mPeer;
130
131 Backupable <Data> m;
132};
133
134#endif // ____H_DVDDRIVEIMPL
135
136/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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