VirtualBox

source: vbox/trunk/src/VBox/Main/include/AdditionsFacilityImpl.h@ 77863

Last change on this file since 77863 was 76562, checked in by vboxsync, 6 years ago

Main: Use MAIN_INCLUDED_ and MAIN_INCLUDED_SRC_ as header guard prefixes with scm.

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