1 | /* $Id: VirtualBoxClientImpl.h 52442 2014-08-21 16:03:15Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | * Header file for the VirtualBoxClient (IVirtualBoxClient) class, VBoxC.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2010-2014 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef ____H_VIRTUALBOXCLIENTIMPL
|
---|
20 | #define ____H_VIRTUALBOXCLIENTIMPL
|
---|
21 |
|
---|
22 | #include "VirtualBoxClientWrap.h"
|
---|
23 | #include "EventImpl.h"
|
---|
24 |
|
---|
25 | #ifdef RT_OS_WINDOWS
|
---|
26 | # include "win/resource.h"
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | class ATL_NO_VTABLE VirtualBoxClient :
|
---|
30 | public VirtualBoxClientWrap
|
---|
31 | #ifdef RT_OS_WINDOWS
|
---|
32 | , public CComCoClass<VirtualBoxClient, &CLSID_VirtualBoxClient>
|
---|
33 | #endif
|
---|
34 | {
|
---|
35 | public:
|
---|
36 | DECLARE_CLASSFACTORY()
|
---|
37 |
|
---|
38 | DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX)
|
---|
39 |
|
---|
40 | DECLARE_NOT_AGGREGATABLE(VirtualBoxClient)
|
---|
41 |
|
---|
42 | HRESULT FinalConstruct();
|
---|
43 | void FinalRelease();
|
---|
44 |
|
---|
45 | // public initializer/uninitializer for internal purposes only
|
---|
46 | HRESULT init();
|
---|
47 | void uninit();
|
---|
48 |
|
---|
49 | private:
|
---|
50 | // wrapped IVirtualBoxClient properties
|
---|
51 | virtual HRESULT getVirtualBox(ComPtr<IVirtualBox> &aVirtualBox);
|
---|
52 | virtual HRESULT getSession(ComPtr<ISession> &aSession);
|
---|
53 | virtual HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
|
---|
54 |
|
---|
55 | // wrapped IVirtualBoxClient methods
|
---|
56 | virtual HRESULT checkMachineError(const ComPtr<IMachine> &aMachine);
|
---|
57 |
|
---|
58 | /** Instance counter for simulating something similar to a singleton.
|
---|
59 | * Only the first instance will be a usable object, all additional
|
---|
60 | * instances will return a failure at creation time and will not work. */
|
---|
61 | static uint32_t g_cInstances;
|
---|
62 |
|
---|
63 | static DECLCALLBACK(int) SVCWatcherThread(RTTHREAD ThreadSelf, void *pvUser);
|
---|
64 |
|
---|
65 | struct Data
|
---|
66 | {
|
---|
67 | Data()
|
---|
68 | {}
|
---|
69 |
|
---|
70 | ComPtr<IVirtualBox> m_pVirtualBox;
|
---|
71 | const ComObjPtr<EventSource> m_pEventSource;
|
---|
72 |
|
---|
73 | RTTHREAD m_ThreadWatcher;
|
---|
74 | RTSEMEVENT m_SemEvWatcher;
|
---|
75 | };
|
---|
76 |
|
---|
77 | Data mData;
|
---|
78 | };
|
---|
79 |
|
---|
80 | #endif // ____H_VIRTUALBOXCLIENTIMPL
|
---|
81 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|