VirtualBox

source: vbox/trunk/src/VBox/Main/include/HardDiskAttachmentImpl.h@ 7954

Last change on this file since 7954 was 7442, checked in by vboxsync, 17 years ago

Main: Applied SATA changes from #2406. Increased XML settings version format from 1.2 to 1.3.pre.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek 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 (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_HARDDISKATTACHMENTIMPL
19#define ____H_HARDDISKATTACHMENTIMPL
20
21#include "VirtualBoxBase.h"
22#include "Collection.h"
23
24#include "HardDiskImpl.h"
25
26class ATL_NO_VTABLE HardDiskAttachment :
27 public VirtualBoxSupportErrorInfoImpl <HardDiskAttachment, IHardDiskAttachment>,
28 public VirtualBoxSupportTranslation <HardDiskAttachment>,
29 public VirtualBoxBase,
30 public IHardDiskAttachment
31{
32public:
33
34 DECLARE_EMPTY_CTOR_DTOR (HardDiskAttachment)
35
36 DECLARE_NOT_AGGREGATABLE(HardDiskAttachment)
37
38 DECLARE_PROTECT_FINAL_CONSTRUCT()
39
40 BEGIN_COM_MAP(HardDiskAttachment)
41 COM_INTERFACE_ENTRY(ISupportErrorInfo)
42 COM_INTERFACE_ENTRY(IHardDiskAttachment)
43 END_COM_MAP()
44
45 NS_DECL_ISUPPORTS
46
47 HRESULT FinalConstruct();
48 void FinalRelease();
49
50 // public initializer/uninitializer for internal purposes only
51 HRESULT init (HardDisk *aHD, StorageBus_T aBus, LONG aChannel, LONG aDevice, BOOL aDirty);
52
53 // IHardDiskAttachment properties
54 STDMETHOD(COMGETTER(HardDisk)) (IHardDisk **aHardDisk);
55 STDMETHOD(COMGETTER(Bus)) (StorageBus_T *aBus);
56 STDMETHOD(COMGETTER(Channel)) (LONG *aChannel);
57 STDMETHOD(COMGETTER(Device)) (LONG *aDevice);
58
59 // public methods for internal purposes only
60 // (ensure there is a caller and a read or write lock before calling them!)
61
62 BOOL isDirty() const { return mDirty; }
63 void setDirty (BOOL aDirty) { mDirty = aDirty; }
64
65 const ComObjPtr <HardDisk> &hardDisk() const { return mHardDisk; }
66 StorageBus_T bus() const { return mBus; }
67 LONG channel() const { return mChannel; }
68 LONG device() const { return mDevice; }
69
70 void updateHardDisk (const ComObjPtr <HardDisk> &aHardDisk, BOOL aDirty)
71 {
72 mHardDisk = aHardDisk;
73 mDirty = aDirty;
74 }
75
76 // for VirtualBoxSupportErrorInfoImpl
77 static const wchar_t *getComponentName() { return L"HardDiskAttachment"; }
78
79private:
80
81 BOOL mDirty;
82 ComObjPtr <HardDisk> mHardDisk;
83 StorageBus_T mBus;
84 LONG mChannel;
85 LONG mDevice;
86};
87
88COM_DECL_READONLY_ENUM_AND_COLLECTION (HardDiskAttachment)
89
90#endif // ____H_HARDDISKATTACHMENTIMPL
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