VirtualBox

source: vbox/trunk/src/VBox/Main/include/MediumAttachmentImpl.h@ 96910

Last change on this file since 96910 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.7 KB
Line 
1/* $Id: MediumAttachmentImpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 *
4 * VirtualBox COM class implementation
5 */
6
7/*
8 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
9 *
10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
26 * SPDX-License-Identifier: GPL-3.0-only
27 */
28
29#ifndef MAIN_INCLUDED_MediumAttachmentImpl_h
30#define MAIN_INCLUDED_MediumAttachmentImpl_h
31#ifndef RT_WITHOUT_PRAGMA_ONCE
32# pragma once
33#endif
34
35#include "MediumAttachmentWrap.h"
36
37class ATL_NO_VTABLE MediumAttachment :
38 public MediumAttachmentWrap
39{
40public:
41
42 DECLARE_COMMON_CLASS_METHODS(MediumAttachment)
43
44 HRESULT FinalConstruct();
45 void FinalRelease();
46
47 // public initializer/uninitializer for internal purposes only
48 HRESULT init(Machine *aParent,
49 Medium *aMedium,
50 const Utf8Str &aControllerName,
51 LONG aPort,
52 LONG aDevice,
53 DeviceType_T aType,
54 bool aImplicit,
55 bool aPassthrough,
56 bool aTempEject,
57 bool aNonRotational,
58 bool aDiscard,
59 bool aHotPluggable,
60 const Utf8Str &strBandwidthGroup);
61 HRESULT initCopy(Machine *aParent, MediumAttachment *aThat);
62 void uninit();
63
64 // public internal methods
65 void i_rollback();
66 void i_commit();
67
68 // unsafe public methods for internal purposes only (ensure there is
69 // a caller and a read lock before calling them!)
70 bool i_isImplicit() const;
71 void i_setImplicit(bool aImplicit);
72
73 const ComObjPtr<Medium>& i_getMedium() const;
74 const Utf8Str &i_getControllerName() const;
75 LONG i_getPort() const;
76 LONG i_getDevice() const;
77 DeviceType_T i_getType() const;
78 bool i_getPassthrough() const;
79 bool i_getTempEject() const;
80 bool i_getNonRotational() const;
81 bool i_getDiscard() const;
82 Utf8Str& i_getBandwidthGroup() const;
83 bool i_getHotPluggable() const;
84
85 bool i_matches(const Utf8Str &aControllerName, LONG aPort, LONG aDevice);
86
87 /** Must be called from under this object's write lock. */
88 void i_updateName(const Utf8Str &aName);
89
90 /** Must be called from under this object's write lock. */
91 void i_updateMedium(const ComObjPtr<Medium> &aMedium);
92
93 /** Must be called from under this object's write lock. */
94 void i_updatePassthrough(bool aPassthrough);
95
96 /** Must be called from under this object's write lock. */
97 void i_updateTempEject(bool aTempEject);
98
99 /** Must be called from under this object's write lock. */
100 void i_updateNonRotational(bool aNonRotational);
101
102 /** Must be called from under this object's write lock. */
103 void i_updateDiscard(bool aDiscard);
104
105 /** Must be called from under this object's write lock. */
106 void i_updateEjected();
107
108 /** Must be called from under this object's write lock. */
109 void i_updateBandwidthGroup(const Utf8Str &aBandwidthGroup);
110
111 void i_updateParentMachine(Machine * const pMachine);
112
113 /** Must be called from under this object's write lock. */
114 void i_updateHotPluggable(bool aHotPluggable);
115
116 /** Construct a unique and somewhat descriptive name for logging. */
117 void i_updateLogName(void);
118
119 /** Get a unique and somewhat descriptive name for logging. */
120 const char *i_getLogName(void) const { return mLogName.c_str(); }
121
122private:
123
124 // Wrapped IMediumAttachment properties
125 HRESULT getMachine(ComPtr<IMachine> &aMachine);
126 HRESULT getMedium(ComPtr<IMedium> &aHardDisk);
127 HRESULT getController(com::Utf8Str &aController);
128 HRESULT getPort(LONG *aPort);
129 HRESULT getDevice(LONG *aDevice);
130 HRESULT getType(DeviceType_T *aType);
131 HRESULT getPassthrough(BOOL *aPassthrough);
132 HRESULT getTemporaryEject(BOOL *aTemporaryEject);
133 HRESULT getIsEjected(BOOL *aEjected);
134 HRESULT getDiscard(BOOL *aDiscard);
135 HRESULT getNonRotational(BOOL *aNonRotational);
136 HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
137 HRESULT getHotPluggable(BOOL *aHotPluggable);
138
139 struct Data;
140 Data *m;
141
142 Utf8Str mLogName; /**< For logging purposes */
143};
144
145#endif /* !MAIN_INCLUDED_MediumAttachmentImpl_h */
146/* 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