BLPAPI C++ 3.26.6
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
37
38#ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
39#define INCLUDED_BLPAPI_EVENTDISPATCHER
40
67
68#ifndef INCLUDED_BLPAPI_DEFS
69#include <blpapi_defs.h>
70#endif
71
72#ifndef INCLUDED_BLPAPI_TYPES
73#include <blpapi_types.h>
74#endif
75
76#include <stddef.h> // for size_t
77
78#ifdef __cplusplus
79extern "C" {
80#endif
81
83
86
101BLPAPI_EXPORT
102blpapi_EventDispatcher_t *blpapi_EventDispatcher_create(
103 size_t numDispatcherThreads);
104
112BLPAPI_EXPORT
113void blpapi_EventDispatcher_destroy(blpapi_EventDispatcher_t *handle);
114
124BLPAPI_EXPORT
125int blpapi_EventDispatcher_start(blpapi_EventDispatcher_t *handle);
126
141BLPAPI_EXPORT
142int blpapi_EventDispatcher_stop(blpapi_EventDispatcher_t *handle, int async);
143
152BLPAPI_EXPORT
153int blpapi_EventDispatcher_dispatchEvents(blpapi_EventDispatcher_t *handle);
154
157
158#ifdef __cplusplus
159} // extern "C"
160
161namespace BloombergLP {
162namespace blpapi {
169
184class EventDispatcher {
185
186 blpapi_EventDispatcher_t *d_impl_p;
187
188 private:
189 // NOT IMPLEMENTED
190 EventDispatcher(const EventDispatcher&);
191 EventDispatcher& operator=(const EventDispatcher&);
192
193 public:
194 explicit EventDispatcher(size_t numDispatcherThreads = 1);
204
209
210 int start();
215
216 int stop(bool async = false);
228
230 blpapi_EventDispatcher_t *impl() const;
235};
236
239
240// ============================================================================
241// INLINE AND TEMPLATE FUNCTION IMPLEMENTATIONS
242// ============================================================================
243
244// ---------------------
245// class EventDispatcher
246// ---------------------
247
248inline EventDispatcher::EventDispatcher(size_t numDispatcherThreads)
249 : d_impl_p(blpapi_EventDispatcher_create(numDispatcherThreads))
250{
251}
252
254{
255 blpapi_EventDispatcher_destroy(d_impl_p);
256}
257
259{
260 return blpapi_EventDispatcher_start(d_impl_p);
261}
262
263inline int EventDispatcher::stop(bool async)
264{
265 return blpapi_EventDispatcher_stop(d_impl_p, async);
266}
267
269inline blpapi_EventDispatcher_t *EventDispatcher::impl() const
270{
271 return d_impl_p;
272}
274
275} // close namespace blpapi
276} // close namespace BloombergLP
277
278#endif // ifdef __cplusplus
279
280#endif // #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
Common definitions used by the library.
Provide BLPAPI types.
~EventDispatcher()
Definition blpapi_eventdispatcher.h:253
int start()
Definition blpapi_eventdispatcher.h:258
int stop(bool async=false)
Definition blpapi_eventdispatcher.h:263
Definition blpapi_abstractsession.h:452
Definition blpapi_abstractsession.h:451