VirtualBox

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

Last change on this file since 94624 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 4.5 KB
Line 
1/* $Id: MediumAttachmentImpl.h 93115 2022-01-01 11:31:46Z vboxsync $ */
2/** @file
3 *
4 * VirtualBox COM class implementation
5 */
6
7/*
8 * Copyright (C) 2006-2022 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
27class ATL_NO_VTABLE MediumAttachment :
28 public MediumAttachmentWrap
29{
30public:
31
32 DECLARE_COMMON_CLASS_METHODS(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
112private:
113
114 // Wrapped IMediumAttachment properties
115 HRESULT getMachine(ComPtr<IMachine> &aMachine);
116 HRESULT getMedium(ComPtr<IMedium> &aHardDisk);
117 HRESULT getController(com::Utf8Str &aController);
118 HRESULT getPort(LONG *aPort);
119 HRESULT getDevice(LONG *aDevice);
120 HRESULT getType(DeviceType_T *aType);
121 HRESULT getPassthrough(BOOL *aPassthrough);
122 HRESULT getTemporaryEject(BOOL *aTemporaryEject);
123 HRESULT getIsEjected(BOOL *aEjected);
124 HRESULT getDiscard(BOOL *aDiscard);
125 HRESULT getNonRotational(BOOL *aNonRotational);
126 HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup);
127 HRESULT getHotPluggable(BOOL *aHotPluggable);
128
129 struct Data;
130 Data *m;
131
132 Utf8Str mLogName; /**< For logging purposes */
133};
134
135#endif /* !MAIN_INCLUDED_MediumAttachmentImpl_h */
136/* 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