1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2013 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ____H_MEDIUMATTACHMENTIMPL
|
---|
19 | #define ____H_MEDIUMATTACHMENTIMPL
|
---|
20 |
|
---|
21 | #include "MediumAttachmentWrap.h"
|
---|
22 |
|
---|
23 | class ATL_NO_VTABLE MediumAttachment :
|
---|
24 | public MediumAttachmentWrap
|
---|
25 | {
|
---|
26 | public:
|
---|
27 |
|
---|
28 | DECLARE_EMPTY_CTOR_DTOR(MediumAttachment)
|
---|
29 |
|
---|
30 | HRESULT FinalConstruct();
|
---|
31 | void FinalRelease();
|
---|
32 |
|
---|
33 | // public initializer/uninitializer for internal purposes only
|
---|
34 | HRESULT init(Machine *aParent,
|
---|
35 | Medium *aMedium,
|
---|
36 | const Bstr &aControllerName,
|
---|
37 | LONG aPort,
|
---|
38 | LONG aDevice,
|
---|
39 | DeviceType_T aType,
|
---|
40 | bool fImplicit,
|
---|
41 | bool fPassthrough,
|
---|
42 | bool fTempEject,
|
---|
43 | bool fNonRotational,
|
---|
44 | bool fDiscard,
|
---|
45 | bool fHotPluggable,
|
---|
46 | const Utf8Str &strBandwidthGroup);
|
---|
47 | HRESULT initCopy(Machine *aParent, MediumAttachment *aThat);
|
---|
48 | void uninit();
|
---|
49 |
|
---|
50 | // public internal methods
|
---|
51 | void i_rollback();
|
---|
52 | void i_commit();
|
---|
53 |
|
---|
54 | // unsafe public methods for internal purposes only (ensure there is
|
---|
55 | // a caller and a read lock before calling them!)
|
---|
56 | bool i_isImplicit() const;
|
---|
57 | void i_setImplicit(bool aImplicit);
|
---|
58 |
|
---|
59 | const ComObjPtr<Medium>& i_getMedium() const;
|
---|
60 | const Bstr i_getControllerName() const;
|
---|
61 | LONG i_getPort() const;
|
---|
62 | LONG i_getDevice() const;
|
---|
63 | DeviceType_T i_getType() const;
|
---|
64 | bool i_getPassthrough() const;
|
---|
65 | bool i_getTempEject() const;
|
---|
66 | bool i_getNonRotational() const;
|
---|
67 | bool i_getDiscard() const;
|
---|
68 | Utf8Str& i_getBandwidthGroup() const;
|
---|
69 | bool i_getHotPluggable() const;
|
---|
70 |
|
---|
71 | bool i_matches(CBSTR aControllerName, LONG aPort, LONG aDevice);
|
---|
72 |
|
---|
73 | /** Must be called from under this object's write lock. */
|
---|
74 | void i_updateMedium(const ComObjPtr<Medium> &aMedium);
|
---|
75 |
|
---|
76 | /** Must be called from under this object's write lock. */
|
---|
77 | void i_updatePassthrough(bool aPassthrough);
|
---|
78 |
|
---|
79 | /** Must be called from under this object's write lock. */
|
---|
80 | void i_updateTempEject(bool aTempEject);
|
---|
81 |
|
---|
82 | /** Must be called from under this object's write lock. */
|
---|
83 | void i_updateNonRotational(bool aNonRotational);
|
---|
84 |
|
---|
85 | /** Must be called from under this object's write lock. */
|
---|
86 | void i_updateDiscard(bool aDiscard);
|
---|
87 |
|
---|
88 | /** Must be called from under this object's write lock. */
|
---|
89 | void i_updateEjected();
|
---|
90 |
|
---|
91 | /** Must be called from under this object's write lock. */
|
---|
92 | void i_updateBandwidthGroup(const Utf8Str &aBandwidthGroup);
|
---|
93 |
|
---|
94 | void i_updateParentMachine(Machine * const pMachine);
|
---|
95 |
|
---|
96 | /** Must be called from under this object's write lock. */
|
---|
97 | void i_updateHotPluggable(bool aHotPluggable);
|
---|
98 |
|
---|
99 | /** Get a unique and somewhat descriptive name for logging. */
|
---|
100 | const char* i_getLogName(void) const { return mLogName.c_str(); }
|
---|
101 |
|
---|
102 | private:
|
---|
103 |
|
---|
104 | // Wrapped IMediumAttachment properties
|
---|
105 | HRESULT getMedium(ComPtr<IMedium> &aHardDisk);
|
---|
106 | HRESULT getController(com::Utf8Str &aController);
|
---|
107 | HRESULT getPort(LONG *aPort);
|
---|
108 | HRESULT getDevice(LONG *aDevice);
|
---|
109 | HRESULT getType(DeviceType_T *aType);
|
---|
110 | HRESULT getPassthrough(BOOL *aPassthrough);
|
---|
111 | HRESULT getTemporaryEject(BOOL *aTemporaryEject);
|
---|
112 | HRESULT getIsEjected(BOOL *aEjected);
|
---|
113 | HRESULT getDiscard(BOOL *aDiscard);
|
---|
114 | HRESULT getNonRotational(BOOL *aNonRotational);
|
---|
115 | HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
|
---|
116 | HRESULT getHotPluggable(BOOL *aHotPluggable);
|
---|
117 |
|
---|
118 | struct Data;
|
---|
119 | Data *m;
|
---|
120 |
|
---|
121 | Utf8Str mLogName; /**< For logging purposes */
|
---|
122 | };
|
---|
123 |
|
---|
124 | #endif // ____H_MEDIUMATTACHMENTIMPL
|
---|
125 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|