1 | /** @file
|
---|
2 | * VirtualBox COM class implementation
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2011 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | */
|
---|
16 |
|
---|
17 | #ifndef ____H_ADDITIONSFACILITYIMPL
|
---|
18 | #define ____H_ADDITIONSFACILITYIMPL
|
---|
19 |
|
---|
20 | #include "VirtualBoxBase.h"
|
---|
21 | #include <iprt/time.h>
|
---|
22 |
|
---|
23 | class Guest;
|
---|
24 |
|
---|
25 | class ATL_NO_VTABLE AdditionsFacility :
|
---|
26 | public VirtualBoxBase,
|
---|
27 | VBOX_SCRIPTABLE_IMPL(IAdditionsFacility)
|
---|
28 | {
|
---|
29 | public:
|
---|
30 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(AdditionsFacility, IAdditionsFacility)
|
---|
31 |
|
---|
32 | DECLARE_NOT_AGGREGATABLE(AdditionsFacility)
|
---|
33 |
|
---|
34 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
35 |
|
---|
36 | BEGIN_COM_MAP(AdditionsFacility)
|
---|
37 | VBOX_DEFAULT_INTERFACE_ENTRIES(IAdditionsFacility)
|
---|
38 | END_COM_MAP()
|
---|
39 |
|
---|
40 | DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
|
---|
41 |
|
---|
42 | // public initializer/uninitializer for internal purposes only
|
---|
43 | HRESULT init(Guest *aParent, AdditionsFacilityType_T enmFacility, AdditionsFacilityStatus_T enmStatus);
|
---|
44 | void uninit();
|
---|
45 |
|
---|
46 | HRESULT FinalConstruct();
|
---|
47 | void FinalRelease();
|
---|
48 |
|
---|
49 | // IAdditionsFacility properties
|
---|
50 | STDMETHOD(COMGETTER(ClassType))(AdditionsFacilityClass_T *aClass);
|
---|
51 | STDMETHOD(COMGETTER(LastUpdated))(LONG64 *aTimestamp);
|
---|
52 | STDMETHOD(COMGETTER(Name))(BSTR *aName);
|
---|
53 | STDMETHOD(COMGETTER(Status))(AdditionsFacilityStatus_T *aStatus);
|
---|
54 | STDMETHOD(COMGETTER(Type))(AdditionsFacilityType_T *aType);
|
---|
55 |
|
---|
56 | public:
|
---|
57 | /** Facility <-> string mappings. */
|
---|
58 | struct FacilityInfo
|
---|
59 | {
|
---|
60 | /** The facilitie's name. */
|
---|
61 | const char *mName; /* utf-8 */
|
---|
62 | /** The facilitie's type. */
|
---|
63 | AdditionsFacilityType_T mType;
|
---|
64 | /** The facilitie's class. */
|
---|
65 | AdditionsFacilityClass_T mClass;
|
---|
66 | };
|
---|
67 | static const FacilityInfo sFacilityInfo[8];
|
---|
68 |
|
---|
69 | // public internal methods
|
---|
70 | static const AdditionsFacility::FacilityInfo &typeToInfo(AdditionsFacilityType_T aType);
|
---|
71 | AdditionsFacilityClass_T getClass() const;
|
---|
72 | LONG64 getLastUpdated() const;
|
---|
73 | Bstr getName() const;
|
---|
74 | AdditionsFacilityStatus_T getStatus() const;
|
---|
75 | AdditionsFacilityType_T getType() const;
|
---|
76 | HRESULT update(AdditionsFacilityStatus_T aStatus, RTTIMESPEC aTimestamp);
|
---|
77 |
|
---|
78 | private:
|
---|
79 | struct Data
|
---|
80 | {
|
---|
81 | /** Timestamp of last updated status.
|
---|
82 | * @todo Add a UpdateRecord struct to keep track of all
|
---|
83 | * status changed + their time; nice for some GUIs. */
|
---|
84 | RTTIMESPEC mLastUpdated;
|
---|
85 | /** The facilitie's current status. */
|
---|
86 | AdditionsFacilityStatus_T mStatus;
|
---|
87 | /** The facilitie's ID/type. */
|
---|
88 | AdditionsFacilityType_T mType;
|
---|
89 | } mData;
|
---|
90 | };
|
---|
91 |
|
---|
92 | #endif // ____H_ADDITIONSFACILITYIMPL
|
---|
93 |
|
---|