VirtualBox

source: vbox/trunk/src/VBox/Main/include/FloppyDriveImpl.h@ 6076

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

Merged dmik/s2 branch (r25959:26751) to the trunk.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Id: FloppyDriveImpl.h 6076 2007-12-14 19:23:03Z 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_FLOPPYDRIVEIMPL
21#define ____H_FLOPPYDRIVEIMPL
22
23#include "VirtualBoxBase.h"
24
25class Machine;
26
27class ATL_NO_VTABLE FloppyDrive :
28 public VirtualBoxBaseNEXT,
29 public VirtualBoxSupportErrorInfoImpl <FloppyDrive, IFloppyDrive>,
30 public VirtualBoxSupportTranslation <FloppyDrive>,
31 public IFloppyDrive
32{
33public:
34
35 struct Data
36 {
37 Data()
38 {
39 mEnabled = true;
40 mDriveState = DriveState_NotMounted;
41 }
42
43 bool operator== (const Data &that) const
44 {
45 return this == &that ||
46 (mDriveState == that.mDriveState &&
47 mFloppyImage.equalsTo (that.mFloppyImage) &&
48 mHostDrive.equalsTo (that.mHostDrive));
49 }
50
51 BOOL mEnabled;
52 ComPtr <IFloppyImage> mFloppyImage;
53 ComPtr <IHostFloppyDrive> mHostDrive;
54 DriveState_T mDriveState;
55 };
56
57 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (FloppyDrive)
58
59 DECLARE_NOT_AGGREGATABLE(FloppyDrive)
60
61 DECLARE_PROTECT_FINAL_CONSTRUCT()
62
63 BEGIN_COM_MAP(FloppyDrive)
64 COM_INTERFACE_ENTRY(ISupportErrorInfo)
65 COM_INTERFACE_ENTRY(IFloppyDrive)
66 END_COM_MAP()
67
68 NS_DECL_ISUPPORTS
69
70 DECLARE_EMPTY_CTOR_DTOR (FloppyDrive)
71
72 HRESULT FinalConstruct();
73 void FinalRelease();
74
75 // public initializer/uninitializer for internal purposes only
76 HRESULT init (Machine *aParent);
77 HRESULT init (Machine *aParent, FloppyDrive *aThat);
78 HRESULT initCopy (Machine *parent, FloppyDrive *aThat);
79 void uninit();
80
81 // IFloppyDrive properties
82 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
83 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
84 STDMETHOD(COMGETTER(State)) (DriveState_T *aDriveState);
85
86 // IFloppyDrive methods
87 STDMETHOD(MountImage) (INPTR GUIDPARAM aImageId);
88 STDMETHOD(CaptureHostDrive) (IHostFloppyDrive *aHostFloppyDrive);
89 STDMETHOD(Unmount)();
90 STDMETHOD(GetImage) (IFloppyImage **aFloppyImage);
91 STDMETHOD(GetHostDrive) (IHostFloppyDrive **aHostFloppyDrive);
92
93 // public methods only for internal purposes
94
95 HRESULT loadSettings (const settings::Key &aMachineNode);
96 HRESULT saveSettings (settings::Key &aMachineNode);
97
98 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
99 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
100 bool rollback();
101 void commit();
102 void copyFrom (FloppyDrive *aThat);
103
104 // public methods for internal purposes only
105 // (ensure there is a caller and a read lock before calling them!)
106
107 Backupable <Data> &data() { return mData; }
108
109 // for VirtualBoxSupportErrorInfoImpl
110 static const wchar_t *getComponentName() { return L"FloppyDrive"; }
111
112private:
113
114 HRESULT unmount();
115
116 const ComObjPtr <Machine, ComWeakRef> mParent;
117 const ComObjPtr <FloppyDrive> mPeer;
118
119 Backupable <Data> mData;
120};
121
122#endif // ____H_FLOPPYDRIVEIMPL
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