VirtualBox

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

Last change on this file since 79862 was 79054, checked in by vboxsync, 6 years ago

Main/AdditionsFacilityImpl: Simplified the data by kicking out the unused status backlog and caching the s_aFacilityInfo index corresponding to mData.mType. Added a critique on inconsisten locking (mostly harmless now, but very iffy previously with std::vector hold the status).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: AdditionsFacilityImpl.h 79054 2019-06-08 23:20:47Z vboxsync $ */
2/** @file
3 * VirtualBox Main - Additions facility class.
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 <iprt/time.h>
25#include "AdditionsFacilityWrap.h"
26
27class Guest;
28
29/**
30 * A guest additions facility.
31 */
32class ATL_NO_VTABLE AdditionsFacility :
33 public AdditionsFacilityWrap
34{
35public:
36
37 DECLARE_EMPTY_CTOR_DTOR(AdditionsFacility)
38
39 /** @name Initializer & uninitializer methods
40 * @{ */
41 HRESULT init(Guest *a_pParent, AdditionsFacilityType_T a_enmFacility, AdditionsFacilityStatus_T a_enmStatus,
42 uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
43 void uninit();
44 HRESULT FinalConstruct();
45 void FinalRelease();
46 /** @} */
47
48public:
49 /** @name public internal methods
50 * @{ */
51 LONG64 i_getLastUpdated() const;
52#if 0 /* unused */
53 AdditionsFacilityType_T i_getType() const;
54 AdditionsFacilityClass_T i_getClass() const;
55 const char *i_getName() const;
56#endif
57 AdditionsFacilityStatus_T i_getStatus() const;
58 bool i_update(AdditionsFacilityStatus_T a_enmStatus, uint32_t a_fFlags, PCRTTIMESPEC a_pTimeSpecTS);
59 /** @} */
60
61private:
62
63 /** @name Wrapped IAdditionsFacility properties
64 * @{ */
65 HRESULT getClassType(AdditionsFacilityClass_T *aClassType);
66 HRESULT getLastUpdated(LONG64 *aLastUpdated);
67 HRESULT getName(com::Utf8Str &aName);
68 HRESULT getStatus(AdditionsFacilityStatus_T *aStatus);
69 HRESULT getType(AdditionsFacilityType_T *aType);
70 /** @} */
71
72 struct Data
73 {
74 /** Last update timestamp. */
75 RTTIMESPEC mTimestamp;
76 /** The facilitie's current status. */
77 AdditionsFacilityStatus_T mStatus;
78 /** Flags. */
79 uint32_t mfFlags;
80 /** The facilitie's ID/type (static). */
81 AdditionsFacilityType_T mType;
82 /** Index into s_aFacilityInfo. */
83 size_t midxInfo;
84 } mData;
85
86 /** Facility <-> string mappings. */
87 struct FacilityInfo
88 {
89 /** The facilitie's name. */
90 const char *mName; /* utf-8 */
91 /** The facilitie's type. */
92 AdditionsFacilityType_T mType;
93 /** The facilitie's class. */
94 AdditionsFacilityClass_T mClass;
95 };
96 static const FacilityInfo s_aFacilityInfo[8];
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