VirtualBox

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

Last change on this file since 28398 was 26561, checked in by vboxsync, 15 years ago

*: set svn:eol-style correctly.

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