VirtualBox

source: vbox/trunk/src/VBox/Main/include/SATAControllerImpl.h@ 7442

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

Main: Applied SATA changes from #2406. Increased XML settings version format from 1.2 to 1.3.pre.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.0 KB
Line 
1/* $Id: SATAControllerImpl.h 7442 2008-03-13 14:33:18Z vboxsync $ */
2
3/** @file
4 *
5 * VBox SATAController COM Class declaration.
6 */
7
8/*
9 * Copyright (C) 2008 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_SATACONTROLLERIMPL
21#define ____H_SATACONTROLLERIMPL
22
23#include "VirtualBoxBase.h"
24
25#include <list>
26
27class Machine;
28
29class ATL_NO_VTABLE SATAController :
30 public VirtualBoxBaseWithChildrenNEXT,
31 public VirtualBoxSupportErrorInfoImpl <SATAController, ISATAController>,
32 public VirtualBoxSupportTranslation <SATAController>,
33 public ISATAController
34{
35private:
36
37 struct Data
38 {
39 /* Constructor. */
40 Data() : mEnabled (FALSE),
41 mPortIde0Master (0),
42 mPortIde0Slave (1),
43 mPortIde1Master (2),
44 mPortIde1Slave (3) { }
45
46 bool operator== (const Data &that) const
47 {
48 return this == &that || ((mEnabled == that.mEnabled) &&
49 (mPortIde0Master == that.mPortIde0Master) &&
50 (mPortIde0Slave == that.mPortIde0Slave) &&
51 (mPortIde1Master == that.mPortIde1Master) &&
52 (mPortIde1Slave == that.mPortIde1Slave));
53 }
54
55 /** Enabled indicator. */
56 BOOL mEnabled;
57 /** Port which acts as primary master for ide emulation. */
58 ULONG mPortIde0Master;
59 /** Port which acts as primary slave for ide emulation. */
60 ULONG mPortIde0Slave;
61 /** Port which acts as secondary master for ide emulation. */
62 ULONG mPortIde1Master;
63 /** Port which acts as secondary slave for ide emulation. */
64 ULONG mPortIde1Slave;
65 };
66
67public:
68
69 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (SATAController)
70
71 DECLARE_NOT_AGGREGATABLE (SATAController)
72
73 DECLARE_PROTECT_FINAL_CONSTRUCT()
74
75 BEGIN_COM_MAP(SATAController)
76 COM_INTERFACE_ENTRY (ISupportErrorInfo)
77 COM_INTERFACE_ENTRY (ISATAController)
78 END_COM_MAP()
79
80 NS_DECL_ISUPPORTS
81
82 DECLARE_EMPTY_CTOR_DTOR (SATAController)
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, SATAController *aThat);
90 HRESULT initCopy (Machine *aParent, SATAController *aThat);
91 void uninit();
92
93 // ISATAController properties
94 STDMETHOD(COMGETTER(Enabled)) (BOOL *aEnabled);
95 STDMETHOD(COMSETTER(Enabled)) (BOOL aEnabled);
96
97 // ISATAController methods
98 STDMETHOD(GetIDEEmulationPort) (LONG DevicePosition, LONG *aPortNumber);
99 STDMETHOD(SetIDEEmulationPort) (LONG DevicePosition, LONG aPortNumber);
100
101 // public methods only for internal purposes
102
103 HRESULT loadSettings (const settings::Key &aMachineNode);
104 HRESULT saveSettings (settings::Key &aMachineNode);
105
106 bool isModified();
107 bool isReallyModified();
108 bool rollback();
109 void commit();
110 void copyFrom (SATAController *aThat);
111
112 HRESULT onMachineRegistered (BOOL aRegistered);
113
114 // public methods for internal purposes only
115 // (ensure there is a caller and a read lock before calling them!)
116
117 /** @note this doesn't require a read lock since mParent is constant. */
118 const ComObjPtr <Machine, ComWeakRef> &parent() { return mParent; };
119
120 const Backupable<Data> &data() { return mData; }
121
122 // for VirtualBoxSupportErrorInfoImpl
123 static const wchar_t *getComponentName() { return L"SATAController"; }
124
125private:
126
127 void printList();
128
129 /** Parent object. */
130 const ComObjPtr<Machine, ComWeakRef> mParent;
131 /** Peer object. */
132 const ComObjPtr <SATAController> mPeer;
133 /** Data. */
134 Backupable <Data> mData;
135
136};
137
138#endif //!____H_SATACONTROLLERIMPL
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