1 | /* $Id: TokenImpl.h 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Token COM class implementations - MachineToken and MediumLockToken
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2020 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_TokenImpl_h
|
---|
19 | #define MAIN_INCLUDED_TokenImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "TokenWrap.h"
|
---|
25 | #include "MachineImpl.h"
|
---|
26 |
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The MachineToken class automates cleanup of a SessionMachine object.
|
---|
30 | */
|
---|
31 | class ATL_NO_VTABLE MachineToken :
|
---|
32 | public TokenWrap
|
---|
33 | {
|
---|
34 | public:
|
---|
35 |
|
---|
36 | DECLARE_EMPTY_CTOR_DTOR(MachineToken)
|
---|
37 |
|
---|
38 | HRESULT FinalConstruct();
|
---|
39 | void FinalRelease();
|
---|
40 |
|
---|
41 | // public initializer/uninitializer for internal purposes only
|
---|
42 | HRESULT init(const ComObjPtr<SessionMachine> &pSessionMachine);
|
---|
43 | void uninit(bool fAbandon);
|
---|
44 |
|
---|
45 | private:
|
---|
46 |
|
---|
47 | // wrapped IToken methods
|
---|
48 | HRESULT abandon(AutoCaller &aAutoCaller);
|
---|
49 | HRESULT dummy();
|
---|
50 |
|
---|
51 | // data
|
---|
52 | struct Data
|
---|
53 | {
|
---|
54 | Data()
|
---|
55 | {
|
---|
56 | }
|
---|
57 |
|
---|
58 | ComObjPtr<SessionMachine> pSessionMachine;
|
---|
59 | };
|
---|
60 |
|
---|
61 | Data m;
|
---|
62 | };
|
---|
63 |
|
---|
64 |
|
---|
65 | class Medium;
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * The MediumLockToken class automates cleanup of a Medium lock.
|
---|
69 | */
|
---|
70 | class ATL_NO_VTABLE MediumLockToken :
|
---|
71 | public TokenWrap
|
---|
72 | {
|
---|
73 | public:
|
---|
74 |
|
---|
75 | DECLARE_EMPTY_CTOR_DTOR(MediumLockToken)
|
---|
76 |
|
---|
77 | HRESULT FinalConstruct();
|
---|
78 | void FinalRelease();
|
---|
79 |
|
---|
80 | // public initializer/uninitializer for internal purposes only
|
---|
81 | HRESULT init(const ComObjPtr<Medium> &pMedium, bool fWrite);
|
---|
82 | void uninit();
|
---|
83 |
|
---|
84 | private:
|
---|
85 |
|
---|
86 | // wrapped IToken methods
|
---|
87 | HRESULT abandon(AutoCaller &aAutoCaller);
|
---|
88 | HRESULT dummy();
|
---|
89 |
|
---|
90 | // data
|
---|
91 | struct Data
|
---|
92 | {
|
---|
93 | Data() :
|
---|
94 | fWrite(false)
|
---|
95 | {
|
---|
96 | }
|
---|
97 |
|
---|
98 | ComObjPtr<Medium> pMedium;
|
---|
99 | bool fWrite;
|
---|
100 | };
|
---|
101 |
|
---|
102 | Data m;
|
---|
103 | };
|
---|
104 |
|
---|
105 |
|
---|
106 | #endif /* !MAIN_INCLUDED_TokenImpl_h */
|
---|
107 |
|
---|
108 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|