1 | /* $Id: TokenImpl.h 69496 2017-10-28 14:55:58Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * Token COM class implementations: MachineToken and MediumLockToken
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2013-2017 Oracle Corporation
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | */
|
---|
19 |
|
---|
20 | #ifndef TOKEN_IMPL_H_
|
---|
21 | #define TOKEN_IMPL_H_
|
---|
22 |
|
---|
23 | #include "TokenWrap.h"
|
---|
24 | #include "MachineImpl.h"
|
---|
25 |
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The MachineToken class automates cleanup of a SessionMachine object.
|
---|
29 | */
|
---|
30 | class ATL_NO_VTABLE MachineToken :
|
---|
31 | public TokenWrap
|
---|
32 | {
|
---|
33 | public:
|
---|
34 |
|
---|
35 | DECLARE_EMPTY_CTOR_DTOR(MachineToken)
|
---|
36 |
|
---|
37 | HRESULT FinalConstruct();
|
---|
38 | void FinalRelease();
|
---|
39 |
|
---|
40 | // public initializer/uninitializer for internal purposes only
|
---|
41 | HRESULT init(const ComObjPtr<SessionMachine> &pSessionMachine);
|
---|
42 | void uninit(bool fAbandon);
|
---|
43 |
|
---|
44 | private:
|
---|
45 |
|
---|
46 | // wrapped IToken methods
|
---|
47 | HRESULT abandon(AutoCaller &aAutoCaller);
|
---|
48 | HRESULT dummy();
|
---|
49 |
|
---|
50 | // data
|
---|
51 | struct Data
|
---|
52 | {
|
---|
53 | Data()
|
---|
54 | {
|
---|
55 | }
|
---|
56 |
|
---|
57 | ComObjPtr<SessionMachine> pSessionMachine;
|
---|
58 | };
|
---|
59 |
|
---|
60 | Data m;
|
---|
61 | };
|
---|
62 |
|
---|
63 |
|
---|
64 | class Medium;
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * The MediumLockToken class automates cleanup of a Medium lock.
|
---|
68 | */
|
---|
69 | class ATL_NO_VTABLE MediumLockToken :
|
---|
70 | public TokenWrap
|
---|
71 | {
|
---|
72 | public:
|
---|
73 |
|
---|
74 | DECLARE_EMPTY_CTOR_DTOR(MediumLockToken)
|
---|
75 |
|
---|
76 | HRESULT FinalConstruct();
|
---|
77 | void FinalRelease();
|
---|
78 |
|
---|
79 | // public initializer/uninitializer for internal purposes only
|
---|
80 | HRESULT init(const ComObjPtr<Medium> &pMedium, bool fWrite);
|
---|
81 | void uninit();
|
---|
82 |
|
---|
83 | private:
|
---|
84 |
|
---|
85 | // wrapped IToken methods
|
---|
86 | HRESULT abandon(AutoCaller &aAutoCaller);
|
---|
87 | HRESULT dummy();
|
---|
88 |
|
---|
89 | // data
|
---|
90 | struct Data
|
---|
91 | {
|
---|
92 | Data() :
|
---|
93 | fWrite(false)
|
---|
94 | {
|
---|
95 | }
|
---|
96 |
|
---|
97 | ComObjPtr<Medium> pMedium;
|
---|
98 | bool fWrite;
|
---|
99 | };
|
---|
100 |
|
---|
101 | Data m;
|
---|
102 | };
|
---|
103 |
|
---|
104 |
|
---|
105 | #endif // TOKEN_IMPL_H_
|
---|
106 |
|
---|
107 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|