VirtualBox

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

Last change on this file since 29945 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • 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 public com::SupportErrorInfoImpl<MediumAttachment, IMediumAttachment>,
26 public VirtualBoxSupportTranslation<MediumAttachment>,
27 VBOX_SCRIPTABLE_IMPL(IMediumAttachment)
28{
29public:
30
31 DECLARE_NOT_AGGREGATABLE(MediumAttachment)
32
33 DECLARE_PROTECT_FINAL_CONSTRUCT()
34
35 BEGIN_COM_MAP(MediumAttachment)
36 COM_INTERFACE_ENTRY(ISupportErrorInfo)
37 COM_INTERFACE_ENTRY(IMediumAttachment)
38 COM_INTERFACE_ENTRY(IDispatch)
39 END_COM_MAP()
40
41 MediumAttachment() { };
42 ~MediumAttachment() { };
43
44 // public initializer/uninitializer for internal purposes only
45 HRESULT init(Machine *aParent,
46 Medium *aMedium,
47 const Bstr &aControllerName,
48 LONG aPort,
49 LONG aDevice,
50 DeviceType_T aType,
51 bool fPassthrough);
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
65 // public internal methods
66 void rollback();
67 void commit();
68
69 // unsafe public methods for internal purposes only (ensure there is
70 // a caller and a read lock before calling them!)
71 bool isImplicit() const;
72 void setImplicit(bool aImplicit);
73
74 const ComObjPtr<Medium>& getMedium() const;
75 Bstr getControllerName() const;
76 LONG getPort() const;
77 LONG getDevice() const;
78 DeviceType_T getType() const;
79 bool getPassthrough() const;
80
81 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice);
82
83 /** Must be called from under this object's write lock. */
84 void updateMedium(const ComObjPtr<Medium> &aMedium, bool aImplicit);
85
86 /** Must be called from under this object's write lock. */
87 void updatePassthrough(bool aPassthrough);
88
89 /** Get a unique and somewhat descriptive name for logging. */
90 const char* getLogName(void) const { return mLogName.c_str(); }
91
92 /** For com::SupportErrorInfoImpl. */
93 static const char *ComponentName() { return "MediumAttachment"; }
94
95private:
96 struct Data;
97 Data *m;
98
99 Utf8Str mLogName; /**< For logging purposes */
100};
101
102#endif // ____H_MEDIUMATTACHMENTIMPL
103/* 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