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