VirtualBox

source: vbox/trunk/src/VBox/Main/include/TokenImpl.h@ 96407

Last change on this file since 96407 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: TokenImpl.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * Token COM class implementations - MachineToken and MediumLockToken
4 */
5
6/*
7 * Copyright (C) 2013-2022 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_TokenImpl_h
29#define MAIN_INCLUDED_TokenImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "TokenWrap.h"
35#include "MachineImpl.h"
36
37
38/**
39 * The MachineToken class automates cleanup of a SessionMachine object.
40 */
41class ATL_NO_VTABLE MachineToken :
42 public TokenWrap
43{
44public:
45
46 DECLARE_COMMON_CLASS_METHODS(MachineToken)
47
48 HRESULT FinalConstruct();
49 void FinalRelease();
50
51 // public initializer/uninitializer for internal purposes only
52 HRESULT init(const ComObjPtr<SessionMachine> &pSessionMachine);
53 void uninit(bool fAbandon);
54
55private:
56
57 // wrapped IToken methods
58 HRESULT abandon(AutoCaller &aAutoCaller);
59 HRESULT dummy();
60
61 // data
62 struct Data
63 {
64 Data()
65 {
66 }
67
68 ComObjPtr<SessionMachine> pSessionMachine;
69 };
70
71 Data m;
72};
73
74
75class Medium;
76
77/**
78 * The MediumLockToken class automates cleanup of a Medium lock.
79 */
80class ATL_NO_VTABLE MediumLockToken :
81 public TokenWrap
82{
83public:
84
85 DECLARE_COMMON_CLASS_METHODS(MediumLockToken)
86
87 HRESULT FinalConstruct();
88 void FinalRelease();
89
90 // public initializer/uninitializer for internal purposes only
91 HRESULT init(const ComObjPtr<Medium> &pMedium, bool fWrite);
92 void uninit();
93
94private:
95
96 // wrapped IToken methods
97 HRESULT abandon(AutoCaller &aAutoCaller);
98 HRESULT dummy();
99
100 // data
101 struct Data
102 {
103 Data() :
104 fWrite(false)
105 {
106 }
107
108 ComObjPtr<Medium> pMedium;
109 bool fWrite;
110 };
111
112 Data m;
113};
114
115
116#endif /* !MAIN_INCLUDED_TokenImpl_h */
117
118/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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