VirtualBox

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

Last change on this file since 34575 was 33078, checked in by vboxsync, 14 years ago

Main: change per-machine media registries so that removeable media files (ISO, RAW) can appear in more than one registry; fix saving registry with removeable media (mount at runtime), hopefully

  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2009 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 "VirtualBoxBase.h"
22
23class ATL_NO_VTABLE MediumAttachment :
24 public VirtualBoxBase,
25 VBOX_SCRIPTABLE_IMPL(IMediumAttachment)
26{
27public:
28 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumAttachment, IMediumAttachment)
29
30 DECLARE_NOT_AGGREGATABLE(MediumAttachment)
31
32 DECLARE_PROTECT_FINAL_CONSTRUCT()
33
34 BEGIN_COM_MAP(MediumAttachment)
35 COM_INTERFACE_ENTRY(ISupportErrorInfo)
36 COM_INTERFACE_ENTRY(IMediumAttachment)
37 COM_INTERFACE_ENTRY(IDispatch)
38 END_COM_MAP()
39
40 MediumAttachment() { };
41 ~MediumAttachment() { };
42
43 // public initializer/uninitializer for internal purposes only
44 HRESULT init(Machine *aParent,
45 Medium *aMedium,
46 const Bstr &aControllerName,
47 LONG aPort,
48 LONG aDevice,
49 DeviceType_T aType,
50 bool fPassthrough,
51 ULONG aBandwidthLimit);
52 void uninit();
53
54 HRESULT FinalConstruct();
55 void FinalRelease();
56
57 // IMediumAttachment properties
58 STDMETHOD(COMGETTER(Medium))(IMedium **aMedium);
59 STDMETHOD(COMGETTER(Controller))(BSTR *aController);
60 STDMETHOD(COMGETTER(Port))(LONG *aPort);
61 STDMETHOD(COMGETTER(Device))(LONG *aDevice);
62 STDMETHOD(COMGETTER(Type))(DeviceType_T *aType);
63 STDMETHOD(COMGETTER(Passthrough))(BOOL *aPassthrough);
64 STDMETHOD(COMGETTER(BandwidthLimit))(ULONG *aLimit);
65 STDMETHOD(COMSETTER(BandwidthLimit))(ULONG aLimit);
66
67 // public internal methods
68 void rollback();
69 void commit();
70
71 // unsafe public methods for internal purposes only (ensure there is
72 // a caller and a read lock before calling them!)
73 bool isImplicit() const;
74 void setImplicit(bool aImplicit);
75
76 const ComObjPtr<Medium>& getMedium() const;
77 Bstr getControllerName() const;
78 LONG getPort() const;
79 LONG getDevice() const;
80 DeviceType_T getType() const;
81 bool getPassthrough() const;
82
83 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice);
84
85 /** Must be called from under this object's write lock. */
86 void updateMedium(const ComObjPtr<Medium> &aMedium);
87
88 /** Must be called from under this object's write lock. */
89 void updatePassthrough(bool aPassthrough);
90
91 /** Get a unique and somewhat descriptive name for logging. */
92 const char* getLogName(void) const { return mLogName.c_str(); }
93
94private:
95 struct Data;
96 Data *m;
97
98 Utf8Str mLogName; /**< For logging purposes */
99};
100
101#endif // ____H_MEDIUMATTACHMENTIMPL
102/* 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