VirtualBox

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

Last change on this file since 48112 was 40212, checked in by vboxsync, 13 years ago

Main: Added facility for auto-logon modules; added book-keeping of last facility statuses (10 max).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1/** @file
2 * VirtualBox COM class implementation
3 */
4
5/*
6 * Copyright (C) 2012 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 <vector>
21#include <iprt/time.h>
22
23#include "VirtualBoxBase.h"
24
25class Guest;
26
27class ATL_NO_VTABLE AdditionsFacility :
28 public VirtualBoxBase,
29 VBOX_SCRIPTABLE_IMPL(IAdditionsFacility)
30{
31public:
32 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(AdditionsFacility, IAdditionsFacility)
33
34 DECLARE_NOT_AGGREGATABLE(AdditionsFacility)
35
36 DECLARE_PROTECT_FINAL_CONSTRUCT()
37
38 BEGIN_COM_MAP(AdditionsFacility)
39 VBOX_DEFAULT_INTERFACE_ENTRIES(IAdditionsFacility)
40 END_COM_MAP()
41
42 DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
43
44 // public initializer/uninitializer for internal purposes only
45 HRESULT init(Guest *a_pParent, AdditionsFacilityType_T a_enmFacility, AdditionsFacilityStatus_T a_enmStatus,
46 uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
47 void uninit();
48
49 HRESULT FinalConstruct();
50 void FinalRelease();
51
52 // IAdditionsFacility properties
53 STDMETHOD(COMGETTER(ClassType))(AdditionsFacilityClass_T *aClass);
54 STDMETHOD(COMGETTER(LastUpdated))(LONG64 *aTimestamp);
55 STDMETHOD(COMGETTER(Name))(BSTR *aName);
56 STDMETHOD(COMGETTER(Status))(AdditionsFacilityStatus_T *aStatus);
57 STDMETHOD(COMGETTER(Type))(AdditionsFacilityType_T *aType);
58
59public:
60 /** Facility <-> string mappings. */
61 struct FacilityInfo
62 {
63 /** The facilitie's name. */
64 const char *mName; /* utf-8 */
65 /** The facilitie's type. */
66 AdditionsFacilityType_T mType;
67 /** The facilitie's class. */
68 AdditionsFacilityClass_T mClass;
69 };
70 static const FacilityInfo s_aFacilityInfo[8];
71
72 // public internal methods
73 static const AdditionsFacility::FacilityInfo &typeToInfo(AdditionsFacilityType_T aType);
74 AdditionsFacilityClass_T getClass() const;
75 LONG64 getLastUpdated() const;
76 Bstr getName() const;
77 AdditionsFacilityStatus_T getStatus() const;
78 AdditionsFacilityType_T getType() const;
79 void update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
80
81private:
82 /** A structure for keeping a facility status
83 * set at a certain time. Good for book-keeping. */
84 struct FacilityState
85 {
86 RTTIMESPEC mTimestamp;
87 /** The facilitie's current status. */
88 AdditionsFacilityStatus_T mStatus;
89 };
90
91 struct Data
92 {
93 /** Record of current and previous facility
94 * states, limited to the 10 last states set.
95 * Note: This intentionally only is kept in
96 * Main so far! */
97 std::vector<FacilityState> mStates;
98 /** The facilitie's ID/type. */
99 AdditionsFacilityType_T mType;
100 } mData;
101};
102
103#endif // ____H_ADDITIONSFACILITYIMPL
104
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