1 | /* $Id: EventImpl.cpp 30311 2010-06-18 13:03:20Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM Event class implementation
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010 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 | #include "EventImpl.h"
|
---|
19 |
|
---|
20 | struct VBoxEvent::Data
|
---|
21 | {
|
---|
22 | Data()
|
---|
23 | :
|
---|
24 | mType(VBoxEventType_Invalid),
|
---|
25 | mWaitable(FALSE)
|
---|
26 | {}
|
---|
27 | VBoxEventType_T mType;
|
---|
28 | BOOL mWaitable;
|
---|
29 | };
|
---|
30 |
|
---|
31 | HRESULT VBoxEvent::FinalConstruct()
|
---|
32 | {
|
---|
33 | m = new Data;
|
---|
34 | return S_OK;
|
---|
35 | }
|
---|
36 |
|
---|
37 | void VBoxEvent::FinalRelease()
|
---|
38 | {
|
---|
39 | uninit();
|
---|
40 | delete m;
|
---|
41 | }
|
---|
42 |
|
---|
43 |
|
---|
44 | HRESULT VBoxEvent::init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWaitable)
|
---|
45 | {
|
---|
46 | HRESULT rc = S_OK;
|
---|
47 |
|
---|
48 | m->mType = aType;
|
---|
49 | m->mWaitable = aWaitable;
|
---|
50 |
|
---|
51 | return rc;
|
---|
52 | }
|
---|
53 |
|
---|
54 | void VBoxEvent::uninit()
|
---|
55 | {
|
---|
56 | m->mType = VBoxEventType_Invalid;
|
---|
57 | }
|
---|
58 |
|
---|
59 | STDMETHODIMP VBoxEvent::COMGETTER(Type)(VBoxEventType_T *aType)
|
---|
60 | {
|
---|
61 | // never changes till event alive, no locking?
|
---|
62 | *aType = m->mType;
|
---|
63 | return S_OK;
|
---|
64 | }
|
---|
65 |
|
---|
66 | STDMETHODIMP VBoxEvent::COMGETTER(Source)(IEventSource* *aSource)
|
---|
67 | {
|
---|
68 | return E_NOTIMPL;
|
---|
69 | }
|
---|
70 |
|
---|
71 | STDMETHODIMP VBoxEvent::COMGETTER(Waitable)(BOOL *aWaitable)
|
---|
72 | {
|
---|
73 | // never changes till event alive, no locking?
|
---|
74 | *aWaitable = m->mWaitable;
|
---|
75 | return S_OK;
|
---|
76 | }
|
---|
77 |
|
---|
78 |
|
---|
79 | STDMETHODIMP VBoxEvent::SetProcessed()
|
---|
80 | {
|
---|
81 | return E_NOTIMPL;
|
---|
82 | }
|
---|
83 |
|
---|
84 | STDMETHODIMP VBoxEvent::WaitProcessed(LONG aTimeout, BOOL *aResult)
|
---|
85 | {
|
---|
86 | return E_NOTIMPL;
|
---|
87 | }
|
---|
88 |
|
---|
89 |
|
---|
90 | struct EventSource::Data
|
---|
91 | {
|
---|
92 | Data()
|
---|
93 | :
|
---|
94 | mBogus(0)
|
---|
95 | {}
|
---|
96 | int32_t mBogus;
|
---|
97 | };
|
---|
98 |
|
---|
99 | HRESULT EventSource::FinalConstruct()
|
---|
100 | {
|
---|
101 | m = new Data;
|
---|
102 | return S_OK;
|
---|
103 | }
|
---|
104 |
|
---|
105 | void EventSource::FinalRelease()
|
---|
106 | {
|
---|
107 | uninit();
|
---|
108 | delete m;
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 | HRESULT EventSource::init()
|
---|
113 | {
|
---|
114 | HRESULT rc = S_OK;
|
---|
115 | return rc;
|
---|
116 | }
|
---|
117 |
|
---|
118 | void EventSource::uninit()
|
---|
119 | {
|
---|
120 | }
|
---|
121 |
|
---|
122 | STDMETHODIMP EventSource::RegisterListener(IEventListener * aListener,
|
---|
123 | ComSafeArrayIn(VBoxEventType, aInterested),
|
---|
124 | BOOL aActive)
|
---|
125 | {
|
---|
126 | return E_NOTIMPL;
|
---|
127 | }
|
---|
128 |
|
---|
129 | STDMETHODIMP EventSource::UnregisterListener(IEventListener * aListener)
|
---|
130 | {
|
---|
131 | return E_NOTIMPL;
|
---|
132 | }
|
---|
133 |
|
---|
134 | STDMETHODIMP EventSource::FireEvent(IEvent * aEvent,
|
---|
135 | LONG aTimeout,
|
---|
136 | BOOL *aProcessed)
|
---|
137 | {
|
---|
138 | return E_NOTIMPL;
|
---|
139 | }
|
---|
140 |
|
---|
141 |
|
---|
142 | STDMETHODIMP EventSource::GetEvent(IEventListener * aListener,
|
---|
143 | LONG aTimeout,
|
---|
144 | IEvent * *aEvent)
|
---|
145 | {
|
---|
146 | return E_NOTIMPL;
|
---|
147 | }
|
---|
148 |
|
---|
149 | STDMETHODIMP EventSource::EventProcessed(IEventListener * aListener,
|
---|
150 | IEvent * aEvent)
|
---|
151 | {
|
---|
152 | return E_NOTIMPL;
|
---|
153 | }
|
---|
154 |
|
---|