1 | /* $Id: AdditionsFacilityImpl.h 69500 2017-10-28 15:14:05Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2014-2017 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_ADDITIONSFACILITYIMPL
|
---|
19 | #define ____H_ADDITIONSFACILITYIMPL
|
---|
20 |
|
---|
21 | #include <vector>
|
---|
22 | #include <iprt/time.h>
|
---|
23 |
|
---|
24 | #include "AdditionsFacilityWrap.h"
|
---|
25 |
|
---|
26 | class Guest;
|
---|
27 |
|
---|
28 | class ATL_NO_VTABLE AdditionsFacility :
|
---|
29 | public AdditionsFacilityWrap
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
|
---|
34 |
|
---|
35 | // public initializer/uninitializer for internal purposes only
|
---|
36 | HRESULT init(Guest *a_pParent, AdditionsFacilityType_T a_enmFacility, AdditionsFacilityStatus_T a_enmStatus,
|
---|
37 | uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
|
---|
38 | void uninit();
|
---|
39 |
|
---|
40 | HRESULT FinalConstruct();
|
---|
41 | void FinalRelease();
|
---|
42 |
|
---|
43 |
|
---|
44 | public:
|
---|
45 | /** Facility <-> string mappings. */
|
---|
46 | struct FacilityInfo
|
---|
47 | {
|
---|
48 | /** The facilitie's name. */
|
---|
49 | const char *mName; /* utf-8 */
|
---|
50 | /** The facilitie's type. */
|
---|
51 | AdditionsFacilityType_T mType;
|
---|
52 | /** The facilitie's class. */
|
---|
53 | AdditionsFacilityClass_T mClass;
|
---|
54 | };
|
---|
55 | static const FacilityInfo s_aFacilityInfo[8];
|
---|
56 |
|
---|
57 | // public internal methods
|
---|
58 | static const AdditionsFacility::FacilityInfo &i_typeToInfo(AdditionsFacilityType_T aType);
|
---|
59 | AdditionsFacilityClass_T i_getClass() const;
|
---|
60 | LONG64 i_getLastUpdated() const;
|
---|
61 | com::Utf8Str i_getName() const;
|
---|
62 | AdditionsFacilityStatus_T i_getStatus() const;
|
---|
63 | AdditionsFacilityType_T i_getType() const;
|
---|
64 | void i_update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
|
---|
65 |
|
---|
66 | private:
|
---|
67 |
|
---|
68 | // Wrapped IAdditionsFacility properties
|
---|
69 | HRESULT getClassType(AdditionsFacilityClass_T *aClassType);
|
---|
70 | HRESULT getLastUpdated(LONG64 *aLastUpdated);
|
---|
71 | HRESULT getName(com::Utf8Str &aName);
|
---|
72 | HRESULT getStatus(AdditionsFacilityStatus_T *aStatus);
|
---|
73 | HRESULT getType(AdditionsFacilityType_T *aType);
|
---|
74 |
|
---|
75 | /** A structure for keeping a facility status
|
---|
76 | * set at a certain time. Good for book-keeping. */
|
---|
77 | struct FacilityState
|
---|
78 | {
|
---|
79 | RTTIMESPEC mTimestamp;
|
---|
80 | /** The facilitie's current status. */
|
---|
81 | AdditionsFacilityStatus_T mStatus;
|
---|
82 | };
|
---|
83 |
|
---|
84 | struct Data
|
---|
85 | {
|
---|
86 | /** Record of current and previous facility
|
---|
87 | * states, limited to the 10 last states set.
|
---|
88 | * Note: This intentionally only is kept in
|
---|
89 | * Main so far! */
|
---|
90 | std::vector<FacilityState> mStates;
|
---|
91 | /** The facilitie's ID/type. */
|
---|
92 | AdditionsFacilityType_T mType;
|
---|
93 | } mData;
|
---|
94 | };
|
---|
95 |
|
---|
96 | #endif // ____H_ADDITIONSFACILITYIMPL
|
---|
97 |
|
---|