BLPAPI C++  3.24.8
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 
28 #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
29 #define INCLUDED_BLPAPI_EVENTDISPATCHER
30 
59 #ifndef INCLUDED_BLPAPI_DEFS
60 #include <blpapi_defs.h>
61 #endif
62 
63 #ifndef INCLUDED_BLPAPI_TYPES
64 #include <blpapi_types.h>
65 #endif
66 
67 #include <stddef.h> // for size_t
68 
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
75  size_t numDispatcherThreads);
76 
79 
82 
85 
88 
89 #ifdef __cplusplus
90 } // extern "C"
91 
99 namespace BloombergLP {
100 namespace blpapi {
101 
117 
118  blpapi_EventDispatcher_t *d_impl_p;
119 
120  private:
121  // NOT IMPLEMENTED
123  EventDispatcher& operator=(const EventDispatcher&);
124 
125  public:
126  explicit EventDispatcher(size_t numDispatcherThreads = 1);
142  int start();
148  int stop(bool async = false);
165 };
166 
170 // ============================================================================
171 // INLINE AND TEMPLATE FUNCTION IMPLEMENTATIONS
172 // ============================================================================
173 
174 // ---------------------
175 // class EventDispatcher
176 // ---------------------
177 
178 inline EventDispatcher::EventDispatcher(size_t numDispatcherThreads)
179  : d_impl_p(blpapi_EventDispatcher_create(numDispatcherThreads))
180 {
181 }
182 
184 {
186 }
187 
189 {
190  return blpapi_EventDispatcher_start(d_impl_p);
191 }
192 
193 inline int EventDispatcher::stop(bool async)
194 {
195  return blpapi_EventDispatcher_stop(d_impl_p, async);
196 }
197 
199 {
200  return d_impl_p;
201 }
202 
203 } // close namespace blpapi
204 } // close namespace BloombergLP
205 
206 #endif // ifdef __cplusplus
207 
208 #endif // #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
~EventDispatcher()
Definition: blpapi_eventdispatcher.h:183
Common definitions used by the library.
Definition: blpapi_abstractsession.h:187
int blpapi_EventDispatcher_start(blpapi_EventDispatcher_t *handle)
int start()
Definition: blpapi_eventdispatcher.h:188
void blpapi_EventDispatcher_destroy(blpapi_EventDispatcher_t *handle)
int stop(bool async=false)
Definition: blpapi_eventdispatcher.h:193
int blpapi_EventDispatcher_dispatchEvents(blpapi_EventDispatcher_t *handle)
struct blpapi_EventDispatcher blpapi_EventDispatcher_t
Definition: blpapi_types.h:142
blpapi_EventDispatcher_t * blpapi_EventDispatcher_create(size_t numDispatcherThreads)
int blpapi_EventDispatcher_stop(blpapi_EventDispatcher_t *handle, int async)
Definition: blpapi_eventdispatcher.h:116
#define BLPAPI_EXPORT
Definition: blpapi_defs.h:171
Provide BLPAPI types.
blpapi_EventDispatcher_t * impl() const
Definition: blpapi_eventdispatcher.h:198