1 | /** @file
|
---|
2 | *
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef ____H_HARDDISKATTACHMENTIMPL
|
---|
23 | #define ____H_HARDDISKATTACHMENTIMPL
|
---|
24 |
|
---|
25 | #include "VirtualBoxBase.h"
|
---|
26 | #include "Collection.h"
|
---|
27 |
|
---|
28 | #include "HardDiskImpl.h"
|
---|
29 |
|
---|
30 | class ATL_NO_VTABLE HardDiskAttachment :
|
---|
31 | public VirtualBoxSupportErrorInfoImpl <HardDiskAttachment, IHardDiskAttachment>,
|
---|
32 | public VirtualBoxSupportTranslation <HardDiskAttachment>,
|
---|
33 | public VirtualBoxBase,
|
---|
34 | public IHardDiskAttachment
|
---|
35 | {
|
---|
36 | public:
|
---|
37 |
|
---|
38 | DECLARE_EMPTY_CTOR_DTOR (HardDiskAttachment)
|
---|
39 |
|
---|
40 | DECLARE_NOT_AGGREGATABLE(HardDiskAttachment)
|
---|
41 |
|
---|
42 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
43 |
|
---|
44 | BEGIN_COM_MAP(HardDiskAttachment)
|
---|
45 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
46 | COM_INTERFACE_ENTRY(IHardDiskAttachment)
|
---|
47 | END_COM_MAP()
|
---|
48 |
|
---|
49 | NS_DECL_ISUPPORTS
|
---|
50 |
|
---|
51 | HRESULT FinalConstruct();
|
---|
52 | void FinalRelease();
|
---|
53 |
|
---|
54 | // public initializer/uninitializer for internal purposes only
|
---|
55 | HRESULT init (HardDisk *aHD, DiskControllerType_T aCtl, LONG aDev, BOOL aDirty);
|
---|
56 |
|
---|
57 | // IHardDiskAttachment properties
|
---|
58 | STDMETHOD(COMGETTER(HardDisk)) (IHardDisk **aHardDisk);
|
---|
59 | STDMETHOD(COMGETTER(Controller)) (DiskControllerType_T *aController);
|
---|
60 | STDMETHOD(COMGETTER(DeviceNumber)) (LONG *aDeviceNumber);
|
---|
61 |
|
---|
62 | // public methods for internal purposes only
|
---|
63 |
|
---|
64 | BOOL isDirty() const { return mDirty; }
|
---|
65 |
|
---|
66 | const ComObjPtr <HardDisk> &hardDisk() const { return mHardDisk; }
|
---|
67 | DiskControllerType_T controller() const { return mController; }
|
---|
68 | LONG deviceNumber() const { return mDeviceNumber; }
|
---|
69 |
|
---|
70 | /** @note Don't forget to lock this object! */
|
---|
71 | void updateHardDisk (const ComObjPtr <HardDisk> &aHardDisk, BOOL aDirty)
|
---|
72 | {
|
---|
73 | mHardDisk = aHardDisk;
|
---|
74 | mDirty = aDirty;
|
---|
75 | }
|
---|
76 |
|
---|
77 | // for VirtualBoxSupportErrorInfoImpl
|
---|
78 | static const wchar_t *getComponentName() { return L"HardDiskAttachment"; }
|
---|
79 |
|
---|
80 | private:
|
---|
81 |
|
---|
82 | BOOL mDirty;
|
---|
83 | ComObjPtr <HardDisk> mHardDisk;
|
---|
84 | DiskControllerType_T mController;
|
---|
85 | LONG mDeviceNumber;
|
---|
86 | };
|
---|
87 |
|
---|
88 | COM_DECL_READONLY_ENUM_AND_COLLECTION (HardDiskAttachment)
|
---|
89 |
|
---|
90 | #endif // ____H_HARDDISKATTACHMENTIMPL
|
---|