VirtualBox

source: vbox/trunk/src/VBox/Main/include/MediumFormatImpl.h@ 30760

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

Main: separate internal machine data structs into MachineImplPrivate.h to significantly speed up compilation and for better interface separation; remove obsolete ConsoleEvents.h file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: MediumFormatImpl.h 30760 2010-07-09 13:12:04Z vboxsync $ */
2
3/** @file
4 *
5 * VirtualBox COM class implementation
6 */
7
8/*
9 * Copyright (C) 2008-2009 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20#ifndef ____H_MEDIUMFORMAT
21#define ____H_MEDIUMFORMAT
22
23#include "VirtualBoxBase.h"
24
25struct VDBACKENDINFO;
26
27/**
28 * The MediumFormat class represents the backend used to store medium data
29 * (IMediumFormat interface).
30 *
31 * @note Instances of this class are permanently caller-referenced by Medium
32 * objects (through addCaller()) so that an attempt to uninitialize or delete
33 * them before all Medium objects are uninitialized will produce an endless
34 * wait!
35 */
36class ATL_NO_VTABLE MediumFormat :
37 public VirtualBoxBase,
38 VBOX_SCRIPTABLE_IMPL(IMediumFormat)
39{
40public:
41
42 struct Property
43 {
44 Bstr name;
45 Bstr description;
46 DataType_T type;
47 ULONG flags;
48 Bstr defaultValue;
49 };
50
51 typedef std::list <Bstr> BstrList;
52 typedef std::list <Property> PropertyList;
53
54 struct Data
55 {
56 Data() : capabilities (0) {}
57
58 const Bstr id;
59 const Bstr name;
60 const BstrList fileExtensions;
61 const uint64_t capabilities;
62 const PropertyList properties;
63 };
64
65 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(MediumFormat, IMediumFormat)
66
67 DECLARE_NOT_AGGREGATABLE (MediumFormat)
68
69 DECLARE_PROTECT_FINAL_CONSTRUCT()
70
71 BEGIN_COM_MAP(MediumFormat)
72 COM_INTERFACE_ENTRY (ISupportErrorInfo)
73 COM_INTERFACE_ENTRY (IMediumFormat)
74 COM_INTERFACE_ENTRY (IDispatch)
75 END_COM_MAP()
76
77 DECLARE_EMPTY_CTOR_DTOR (MediumFormat)
78
79 HRESULT FinalConstruct();
80 void FinalRelease();
81
82 // public initializer/uninitializer for internal purposes only
83 HRESULT init (const VDBACKENDINFO *aVDInfo);
84 void uninit();
85
86 // IMediumFormat properties
87 STDMETHOD(COMGETTER(Id)) (BSTR *aId);
88 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
89 STDMETHOD(COMGETTER(FileExtensions)) (ComSafeArrayOut (BSTR, aFileExtensions));
90 STDMETHOD(COMGETTER(Capabilities)) (ULONG *aCaps);
91
92 // IMediumFormat methods
93 STDMETHOD(DescribeProperties) (ComSafeArrayOut (BSTR, aNames),
94 ComSafeArrayOut (BSTR, aDescriptions),
95 ComSafeArrayOut (DataType_T, aTypes),
96 ComSafeArrayOut (ULONG, aFlags),
97 ComSafeArrayOut (BSTR, aDefaults));
98
99 // public methods only for internal purposes
100
101 // public methods for internal purposes only
102 // (ensure there is a caller and a read lock before calling them!)
103
104 /** Const, no need to lock */
105 const Bstr &id() const { return m.id; }
106 /** Const, no need to lock */
107 const BstrList &fileExtensions() const { return m.fileExtensions; }
108 /** Const, no need to lock */
109 uint64_t capabilities() const { return m.capabilities; }
110 /** Const, no need to lock */
111 const PropertyList &properties() const { return m.properties; }
112
113private:
114
115 Data m;
116};
117
118#endif // ____H_MEDIUMFORMAT
119
120/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette