BLPAPI C++ 3.26.5
Loading...
Searching...
No Matches
blpapi_eventdispatcher.h
Go to the documentation of this file.
1/* Copyright 2012. Bloomberg Finance L.P.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions: The above
9 * copyright notice and this permission notice shall be included in all copies
10 * or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
18 * IN THE SOFTWARE.
19 */
20
35
36#ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
37#define INCLUDED_BLPAPI_EVENTDISPATCHER
38
66
67#ifndef INCLUDED_BLPAPI_DEFS
68#include <blpapi_defs.h>
69#endif
70
71#ifndef INCLUDED_BLPAPI_TYPES
72#include <blpapi_types.h>
73#endif
74
75#include <stddef.h> // for size_t
76
77#ifdef __cplusplus
78extern "C" {
79#endif
80
82
85
86BLPAPI_EXPORT
87blpapi_EventDispatcher_t *blpapi_EventDispatcher_create(
88 size_t numDispatcherThreads);
89
90BLPAPI_EXPORT
91void blpapi_EventDispatcher_destroy(blpapi_EventDispatcher_t *handle);
92
93BLPAPI_EXPORT
94int blpapi_EventDispatcher_start(blpapi_EventDispatcher_t *handle);
95
96BLPAPI_EXPORT
97int blpapi_EventDispatcher_stop(blpapi_EventDispatcher_t *handle, int async);
98
99BLPAPI_EXPORT
100int blpapi_EventDispatcher_dispatchEvents(blpapi_EventDispatcher_t *handle);
101
104
105#ifdef __cplusplus
106} // extern "C"
107
114
115namespace BloombergLP {
116namespace blpapi {
117
132class EventDispatcher {
133
134 blpapi_EventDispatcher_t *d_impl_p;
135
136 private:
137 // NOT IMPLEMENTED
138 EventDispatcher(const EventDispatcher&);
139 EventDispatcher& operator=(const EventDispatcher&);
140
141 public:
142 explicit EventDispatcher(size_t numDispatcherThreads = 1);
152
157
158 int start();
163
164 int stop(bool async = false);
176
177 blpapi_EventDispatcher_t *impl() const;
181};
182
185
186// ============================================================================
187// INLINE AND TEMPLATE FUNCTION IMPLEMENTATIONS
188// ============================================================================
189
190// ---------------------
191// class EventDispatcher
192// ---------------------
193
194inline EventDispatcher::EventDispatcher(size_t numDispatcherThreads)
195 : d_impl_p(blpapi_EventDispatcher_create(numDispatcherThreads))
196{
197}
198
200{
201 blpapi_EventDispatcher_destroy(d_impl_p);
202}
203
205{
206 return blpapi_EventDispatcher_start(d_impl_p);
207}
208
209inline int EventDispatcher::stop(bool async)
210{
211 return blpapi_EventDispatcher_stop(d_impl_p, async);
212}
213
214inline blpapi_EventDispatcher_t *EventDispatcher::impl() const
215{
216 return d_impl_p;
217}
218
219} // close namespace blpapi
220} // close namespace BloombergLP
221
222#endif // ifdef __cplusplus
223
224#endif // #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
Common definitions used by the library.
Provide BLPAPI types.
~EventDispatcher()
Definition blpapi_eventdispatcher.h:199
blpapi_EventDispatcher_t * impl() const
Definition blpapi_eventdispatcher.h:214
int start()
Definition blpapi_eventdispatcher.h:204
int stop(bool async=false)
Definition blpapi_eventdispatcher.h:209
Definition blpapi_abstractsession.h:212
Definition blpapi_abstractsession.h:211