BLPAPI C++  3.24.11
blpapi_providersession.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_PROVIDERSESSION
29 #define INCLUDED_BLPAPI_PROVIDERSESSION
30 
147 #ifndef INCLUDED_BLPAPI_ABSTRACTSESSION
148 #include <blpapi_abstractsession.h>
149 #endif
150 
151 #ifndef INCLUDED_BLPAPI_CALL
152 #include <blpapi_call.h>
153 #endif
154 
155 #ifndef INCLUDED_BLPAPI_CORRELATIONID
156 #include <blpapi_correlationid.h>
157 #endif
158 
159 #ifndef INCLUDED_BLPAPI_DEFS
160 #include <blpapi_defs.h>
161 #endif
162 
163 #ifndef INCLUDED_BLPAPI_EVENT
164 #include <blpapi_event.h>
165 #endif
166 
167 #ifndef INCLUDED_BLPAPI_EVENTDISPATCHER
168 #include <blpapi_eventdispatcher.h>
169 #endif
170 
171 #ifndef INCLUDED_BLPAPI_IDENTITY
172 #include <blpapi_identity.h>
173 #endif
174 
175 #ifndef INCLUDED_BLPAPI_REQUEST
176 #include <blpapi_request.h>
177 #endif
178 
179 #ifndef INCLUDED_BLPAPI_RESOLUTIONLIST
180 #include <blpapi_resolutionlist.h>
181 #endif
182 
183 #ifndef INCLUDED_BLPAPI_SERVICE
184 #include <blpapi_service.h>
185 #endif
186 
187 #ifndef INCLUDED_BLPAPI_SESSIONOPTIONS
188 #include <blpapi_sessionoptions.h>
189 #endif
190 
191 #ifndef INCLUDED_BLPAPI_SUBSCRIPTIONLIST
192 #include <blpapi_subscriptionlist.h>
193 #endif
194 
195 #ifndef INCLUDED_BLPAPI_TOPIC
196 #include <blpapi_topic.h>
197 #endif
198 
199 #ifndef INCLUDED_BLPAPI_TOPICLIST
200 #include <blpapi_topiclist.h>
201 #endif
202 
203 #ifndef INCLUDED_BLPAPI_TYPES
204 #include <blpapi_types.h>
205 #endif
206 
207 #include <stddef.h>
208 
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212 
213 struct blpapi_ServiceRegistrationOptions;
214 typedef struct blpapi_ServiceRegistrationOptions
216 
218  blpapi_ProviderSession_t *session,
219  void *userData);
220 
223  blpapi_SessionOptions_t *parameters,
225  blpapi_EventDispatcher_t *dispatcher,
226  void *userData);
227 
230 
233 
236 
239 
242 
245  blpapi_Event_t **eventPointer,
246  unsigned int timeoutInMilliseconds);
247 
250  blpapi_ProviderSession_t *session, blpapi_Event_t **eventPointer);
251 
254  const char *serviceName,
255  const blpapi_Identity_t *identity,
256  blpapi_ServiceRegistrationOptions_t *registrationOptions);
257 
260  blpapi_ProviderSession_t *session,
261  const char *serviceName,
262  int begin,
263  int end,
264  int priority);
265 
268  blpapi_ProviderSession_t *session,
269  const char *serviceName,
270  int begin,
271  int end);
272 
275  blpapi_ProviderSession_t *session,
276  const char *serviceName,
277  const blpapi_Identity_t *identity,
278  blpapi_CorrelationId_t *correlationId,
279  blpapi_ServiceRegistrationOptions_t *registrationOptions);
280 
283  blpapi_ProviderSession_t *session, const char *serviceName);
284 
287  blpapi_ResolutionList_t *resolutionList,
288  int resolveMode,
289  const blpapi_Identity_t *identity);
290 
293  const blpapi_ResolutionList_t *resolutionList,
294  int resolveMode,
295  const blpapi_Identity_t *identity);
296 
299  blpapi_TopicList_t *topicList,
300  int resolveMode,
301  const blpapi_Identity_t *identity);
302 
305  const blpapi_TopicList_t *topicList,
306  int resolveMode,
307  const blpapi_Identity_t *identity);
308 
311  const blpapi_Message_t *message,
312  blpapi_Topic_t **topic);
313 
316  const blpapi_Message_t *message,
317  blpapi_Topic_t **topic);
318 
321  blpapi_ProviderSession_t *session,
322  const blpapi_Service_t *service,
323  blpapi_Topic_t **topic);
324 
327  const blpapi_Topic_t **topics,
328  size_t numTopics);
329 
332  blpapi_ProviderSession_t *session,
333  const blpapi_Topic_t **topics,
334  size_t numTopics,
335  const char *message);
336 
339  blpapi_ProviderSession_t *session, blpapi_Event_t *event);
340 
343  blpapi_Event_t *event,
344  int isPartialResponse);
345 
348  blpapi_ProviderSession_t *session);
349 
352  blpapi_ProviderSession_t *session, int *allFlushed, int timeoutMsecs);
353 
354 // ServiceRegistrationOptions
355 
358  void);
359 
363  const blpapi_ServiceRegistrationOptions_t *parameters);
364 
368 
373 
374 // SUBSERVICE CODES
378  int start,
379  int end,
380  int priority);
381 
385 
389  const char *groupId,
390  unsigned int groupIdLength);
391 
394  blpapi_ServiceRegistrationOptions_t *parameters, int priority);
395 
398  blpapi_ServiceRegistrationOptions_t *parameters, int parts);
399 
403  char *groupdIdBuffer,
404  int *groupIdLength);
405 
409 
413 
414 #ifdef __cplusplus
415 }
416 
417 #include <cassert>
418 
426 namespace BloombergLP {
427 namespace blpapi {
428 
430 extern "C" inline void blpapi_providerEventHandlerAdapter(
431  blpapi_Event_t *event,
432  blpapi_ProviderSession_t *session,
433  void *userData);
435 
436 class ProviderSession;
437 // ==========================
438 // class ProviderEventHandler
439 // ==========================
440 
442  public:
443  virtual ~ProviderEventHandler() { }
444 
445  virtual bool processEvent(const Event& event, ProviderSession *session)
446  = 0;
457 };
458 
470 
472 
473  public:
485  };
486 
490 
493 
497 
502 
508 
512  };
513 
530  const ServiceRegistrationOptions& rhs);
536  void setGroupId(const char *groupId, unsigned int groupIdLength);
548  int setServicePriority(int priority);
563  void setPartsToRegister(int parts);
571  void addActiveSubServiceCodeRange(int begin, int end, int priority);
587  int getGroupId(char *groupId, int *groupIdLength) const;
597  int getServicePriority() const;
605  int getPartsToRegister() const;
611  blpapi_ServiceRegistrationOptions_t *handle() const;
614 };
615 
646 
647  public:
648  typedef ::BloombergLP::blpapi::ProviderEventHandler EventHandler;
649 
650  private:
651  blpapi_ProviderSession_t *d_handle_p;
652  EventHandler *d_eventHandler_p;
653 
654  private:
656  blpapi_ProviderSession_t *session,
657  void *userData);
658 
659  void dispatchEvent(const Event& event);
660 
661  private:
662  // NOT IMPLEMENTED
664  ProviderSession& operator=(const ProviderSession&);
665 
666  public:
667  enum ResolveMode {
673  };
674 
675  explicit ProviderSession(const SessionOptions& options = SessionOptions(),
676  EventHandler *eventHandler = 0,
677  EventDispatcher *eventDispatcher = 0);
712  explicit ProviderSession(blpapi_ProviderSession_t *handle);
715 
716  virtual ~ProviderSession();
721  // MANIPULATORS
722  virtual bool start();
727  virtual bool startAsync();
732  virtual void stop();
737  virtual void stopAsync();
742  virtual Event nextEvent(int timeout = 0);
747  virtual int tryNextEvent(Event *event);
752  virtual bool registerService(const char *serviceName,
753  const Identity& providerIdentity = Identity(),
754  const ServiceRegistrationOptions& registrationOptions
779  virtual void activateSubServiceCodeRange(
780  const char *serviceName, int begin, int end, int priority);
792  virtual void deactivateSubServiceCodeRange(
793  const char *serviceName, int begin, int end);
803  virtual CorrelationId registerServiceAsync(const char *serviceName,
804  const Identity& providerIdentity = Identity(),
805  const CorrelationId& correlationId = CorrelationId(),
806  const ServiceRegistrationOptions& registrationOptions
832  virtual bool deregisterService(const char *serviceName);
849  virtual void resolve(ResolutionList *resolutionList,
850  ResolveMode resolveMode = DONT_REGISTER_SERVICES,
851  const Identity& providerIdentity = Identity());
876  virtual void resolveAsync(const ResolutionList& resolutionList,
877  ResolveMode resolveMode = DONT_REGISTER_SERVICES,
878  const Identity& providerIdentity = Identity());
901  virtual Topic getTopic(const Message& message);
911  virtual Topic createServiceStatusTopic(const Service& service);
918  virtual void publish(const Event& event);
923  virtual void sendResponse(
924  const Event& event, bool isPartialResponse = false);
931  virtual void createTopics(TopicList *topicList,
932  ResolveMode resolveMode = DONT_REGISTER_SERVICES,
933  const Identity& providerIdentity = Identity());
952  virtual void createTopicsAsync(const TopicList& topicList,
953  ResolveMode resolveMode = DONT_REGISTER_SERVICES,
954  const Identity& providerIdentity = Identity());
970  virtual void deleteTopic(const Topic& topic);
987  virtual void deleteTopics(const std::vector<Topic>& topics);
993  virtual void deleteTopics(const Topic *topics, size_t numTopics);
1000  virtual void terminateSubscriptionsOnTopic(
1001  const Topic& topic, const char *message = 0);
1012  virtual void terminateSubscriptionsOnTopics(
1013  const std::vector<Topic>& topics, const char *message = 0);
1020  virtual void terminateSubscriptionsOnTopics(
1021  const Topic *topics, size_t numTopics, const char *message = 0);
1029  virtual bool flushPublishedEvents(int timeoutMsecs);
1042  blpapi_ProviderSession_t *handle() const;
1047 
1050  virtual Topic createTopic(const Message& message);
1057 };
1058 
1062 //=============================================================================
1063 // INLINE FUNCTION DEFINITIONS
1064 //=============================================================================
1065 
1066 // ---------------------
1067 // class ProviderSession
1068 // ---------------------
1069 
1070 inline ProviderSession::ProviderSession(const SessionOptions& parameters,
1071  EventHandler *handler,
1072  EventDispatcher *dispatcher)
1073  : d_eventHandler_p(handler)
1074 {
1075  if (dispatcher && !handler) {
1077  "Event dispatcher provided without handler.");
1078  }
1079  d_handle_p = blpapi_ProviderSession_create(parameters.handle(),
1080  handler ? &blpapi_providerEventHandlerAdapter : 0,
1081  dispatcher ? dispatcher->impl() : 0,
1082  this);
1083  initAbstractSessionHandle(
1085 }
1086 
1087 inline ProviderSession::ProviderSession(blpapi_ProviderSession_t *newHandle)
1088  : d_handle_p(newHandle)
1089 {
1090  initAbstractSessionHandle(
1092 }
1093 
1095 {
1096  blpapi_ProviderSession_destroy(d_handle_p);
1097 }
1098 
1100 {
1101  return blpapi_ProviderSession_start(d_handle_p) ? false : true;
1102 }
1103 
1105 {
1106  return blpapi_ProviderSession_startAsync(d_handle_p) ? false : true;
1107 }
1108 
1110 {
1111  blpapi_ProviderSession_stop(d_handle_p);
1112 }
1113 
1115 {
1117 }
1118 
1120 {
1121  if (timeout < 0) {
1122  throw InvalidArgumentException("Timeout must be >= 0.");
1123  }
1124 
1125  blpapi_Event_t *event = 0;
1127  d_handle_p, &event, static_cast<unsigned>(timeout)));
1128  return Event(event);
1129 }
1130 
1132 {
1133  assert(event);
1134 
1135  blpapi_Event_t *impl = 0;
1136  int ret = blpapi_ProviderSession_tryNextEvent(d_handle_p, &impl);
1137  if (0 == ret) {
1138  *event = Event(impl);
1139  }
1140  return ret;
1141 }
1142 
1143 inline bool ProviderSession::registerService(const char *serviceName,
1144  const Identity& identity,
1145  const ServiceRegistrationOptions& registrationOptions)
1146 {
1147  return blpapi_ProviderSession_registerService(d_handle_p,
1148  serviceName,
1149  identity.handle(),
1150  registrationOptions.handle())
1151  ? false
1152  : true;
1153 }
1154 
1156  const char *serviceName, int begin, int end, int priority)
1157 {
1160  d_handle_p, serviceName, begin, end, priority));
1161 }
1162 
1164  const char *serviceName, int begin, int end)
1165 {
1168  d_handle_p, serviceName, begin, end));
1169 }
1170 
1172  const char *serviceName,
1173  const Identity& identity,
1174  const CorrelationId& correlationId,
1175  const ServiceRegistrationOptions& registrationOptions)
1176 {
1177  blpapi_CorrelationId_t retv = correlationId.impl();
1180  serviceName,
1181  identity.handle(),
1182  &retv,
1183  registrationOptions.handle()));
1184 
1185  return CorrelationId(retv);
1186 }
1187 
1188 inline bool ProviderSession::deregisterService(const char *serviceName)
1189 {
1191  d_handle_p, serviceName)
1192  == 0
1193  ? true
1194  : false;
1195 }
1196 
1197 inline void ProviderSession::resolve(ResolutionList *resolutionList,
1198  ResolveMode resolveMode,
1199  const Identity& identity)
1200 {
1201  assert(resolutionList);
1202 
1204  resolutionList->impl(),
1205  resolveMode,
1206  identity.handle()));
1207  return;
1208 }
1209 
1210 inline void ProviderSession::resolveAsync(const ResolutionList& resolutionList,
1211  ResolveMode resolveMode,
1212  const Identity& identity)
1213 {
1215  resolutionList.impl(),
1216  resolveMode,
1217  identity.handle()));
1218  return;
1219 }
1220 
1222 {
1223  blpapi_Topic_t *topic = 0;
1225  d_handle_p, message.impl(), &topic));
1226 
1227  return Topic(topic);
1228 }
1229 
1231 {
1232  blpapi_Topic_t *topic = 0;
1234  d_handle_p, message.impl(), &topic));
1235 
1236  return Topic(topic);
1237 }
1238 
1240 {
1241  blpapi_Topic_t *topic = 0;
1244  d_handle_p, service.handle(), &topic));
1245 
1246  return Topic(topic);
1247 }
1248 
1250  ResolveMode resolveMode,
1251  const Identity& identity)
1252 {
1253  assert(topicList);
1254 
1256  d_handle_p, topicList->impl(), resolveMode, identity.handle()));
1257  return;
1258 }
1259 
1260 inline void ProviderSession::createTopicsAsync(const TopicList& topicList,
1261  ResolveMode resolveMode,
1262  const Identity& identity)
1263 {
1265  d_handle_p, topicList.impl(), resolveMode, identity.handle()));
1266  return;
1267 }
1268 
1269 inline void ProviderSession::deleteTopic(const Topic& topic)
1270 {
1271  const blpapi_Topic_t *topicImpl = topic.impl();
1273  d_handle_p, &topicImpl, 1));
1274 }
1275 
1276 inline void ProviderSession::deleteTopics(const std::vector<Topic>& topics)
1277 {
1278  if (topics.size() == 0) {
1279  return;
1280  }
1281  std::vector<const blpapi_Topic_t *> topicImplList;
1282  topicImplList.reserve(topics.size());
1283  for (std::vector<Topic>::const_iterator it = topics.begin();
1284  it != topics.end();
1285  ++it) {
1286  topicImplList.push_back(it->impl());
1287  }
1289  d_handle_p, &topicImplList[0], topicImplList.size()));
1290 }
1291 
1293  const Topic *topics, size_t numTopics)
1294 {
1295  if (numTopics == 0) {
1296  return;
1297  }
1298 
1299  assert(topics);
1300 
1301  std::vector<const blpapi_Topic_t *> topicImplList;
1302  topicImplList.reserve(numTopics);
1303  for (size_t i = 0; i < numTopics; ++i) {
1304  topicImplList.push_back(topics[i].impl());
1305  }
1307  d_handle_p, &topicImplList[0], topicImplList.size()));
1308 }
1309 
1311  const Topic& topic, const char *message)
1312 {
1313  const blpapi_Topic_t *topicImpl = topic.impl();
1316  d_handle_p, &topicImpl, 1, message));
1317 }
1318 
1320  const std::vector<Topic>& topics, const char *message)
1321 {
1322  if (topics.empty()) {
1323  return;
1324  }
1325  terminateSubscriptionsOnTopics(&topics.front(), topics.size(), message);
1326 }
1327 
1329  const Topic *topics, size_t numTopics, const char *message)
1330 {
1331  if (numTopics == 0) {
1332  return;
1333  }
1334 
1335  assert(topics);
1336 
1337  std::vector<const blpapi_Topic_t *> topicImplList;
1338  topicImplList.reserve(numTopics);
1339  for (size_t i = 0; i < numTopics; ++i) {
1340  topicImplList.push_back(topics[i].impl());
1341  }
1344  d_handle_p,
1345  &topicImplList[0],
1346  topicImplList.size(),
1347  message));
1348 }
1349 
1350 inline void ProviderSession::publish(const Event& event)
1351 {
1353  blpapi_ProviderSession_publish(d_handle_p, event.impl()));
1354  return;
1355 }
1356 
1358  const Event& event, bool isPartialResponse)
1359 {
1361  d_handle_p, event.impl(), isPartialResponse));
1362  return;
1363 }
1364 
1365 inline blpapi_ProviderSession_t *ProviderSession::handle() const
1366 {
1367  return d_handle_p;
1368 }
1369 
1370 inline void ProviderSession::dispatchEvent(const Event& event)
1371 {
1372  assert(d_eventHandler_p);
1373 
1374  d_eventHandler_p->processEvent(event, this);
1375 }
1376 
1377 inline bool ProviderSession::flushPublishedEvents(int timeoutMsecs)
1378 {
1379  int allFlushed = 0;
1381  d_handle_p, &allFlushed, timeoutMsecs);
1382  if (rc != 0) {
1384  }
1385  return allFlushed ? true : false;
1386 }
1387 
1388 // --------------------------------
1389 // class ServiceRegistrationOptions
1390 // --------------------------------
1391 
1393 {
1395 }
1396 
1398  const ServiceRegistrationOptions& original)
1399 {
1400  d_handle_p
1401  = blpapi_ServiceRegistrationOptions_duplicate(original.handle());
1402 }
1403 
1405 {
1407 }
1408 
1410  const ServiceRegistrationOptions& rhs)
1411 {
1412  blpapi_ServiceRegistrationOptions_copy(this->handle(), rhs.handle());
1413  return *this;
1414 }
1415 
1416 // SUBSERVICE CODES
1418  int begin, int end, int priority)
1419 {
1422  d_handle_p, begin, end, priority));
1423 }
1424 
1426 {
1428  d_handle_p);
1429 }
1430 
1432  const char *groupId, unsigned int groupIdLength)
1433 {
1435  d_handle_p, groupId, groupIdLength);
1436 }
1437 
1439 {
1441  d_handle_p, priority);
1442 }
1443 
1445 {
1447  d_handle_p, parts);
1448 }
1449 
1451  char *groupIdBuffer, int *groupIdLength) const
1452 {
1454  d_handle_p, groupIdBuffer, groupIdLength);
1455 }
1456 
1458 {
1460 }
1461 
1463 {
1465  d_handle_p);
1466 }
1467 
1469 ServiceRegistrationOptions::handle() const
1470 {
1471  return d_handle_p;
1472 }
1473 
1474 // --------------------------
1475 // class ProviderEventHandler
1476 // --------------------------
1477 
1479 extern "C" inline void blpapi_providerEventHandlerAdapter(
1480  blpapi_Event_t *event, blpapi_ProviderSession_t *, void *userData)
1481 {
1482  assert(userData);
1483 
1484  reinterpret_cast<ProviderSession *>(userData)->dispatchEvent(Event(event));
1485 }
1487 
1488 } // close namespace blpapi
1489 } // close namespace BloombergLP
1490 
1491 #endif // #ifdef __cplusplus
1492 #endif // #ifndef INCLUDED_BLPAPI_PROVIDERSESSION
int blpapi_ServiceRegistrationOptions_addActiveSubServiceCodeRange(blpapi_ServiceRegistrationOptions_t *parameters, int start, int end, int priority)
ResolveMode
Definition: blpapi_providersession.h:667
struct blpapi_Message blpapi_Message_t
Definition: blpapi_dispatchtbl.h:78
int blpapi_ServiceRegistrationOptions_getGroupId(blpapi_ServiceRegistrationOptions_t *parameters, char *groupdIdBuffer, int *groupIdLength)
Definition: blpapi_message.h:161
virtual bool processEvent(const Event &event, ProviderSession *session)=0
#define BLPAPI_REGISTRATIONPARTS_PUBLISHING
Definition: blpapi_defs.h:128
void removeAllActiveSubServiceCodeRanges()
Definition: blpapi_providersession.h:1425
int blpapi_ServiceRegistrationOptions_setServicePriority(blpapi_ServiceRegistrationOptions_t *parameters, int priority)
int blpapi_ProviderSession_flushPublishedEvents(blpapi_ProviderSession_t *session, int *allFlushed, int timeoutMsecs)
virtual void createTopics(TopicList *topicList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1249
int setServicePriority(int priority)
Definition: blpapi_providersession.h:1438
#define BLPAPI_CALL_PROVIDERSESSION_DEACTIVATESUBSERVICECODERANGE( a1, a2, a3, a4)
Definition: blpapi_call.h:440
Low priority (0)
Definition: blpapi_providersession.h:479
#define BLPAPI_RESOLVEMODE_DONT_REGISTER_SERVICES
Definition: blpapi_defs.h:116
virtual void deleteTopics(const std::vector< Topic > &topics)
Definition: blpapi_providersession.h:1276
virtual ~ProviderSession()
Definition: blpapi_providersession.h:1094
int blpapi_ProviderSession_registerServiceAsync(blpapi_ProviderSession_t *session, const char *serviceName, const blpapi_Identity_t *identity, blpapi_CorrelationId_t *correlationId, blpapi_ServiceRegistrationOptions_t *registrationOptions)
Medium priority (INT_MAX/2)
Definition: blpapi_providersession.h:481
int blpapi_ProviderSession_deleteTopics(blpapi_ProviderSession_t *session, const blpapi_Topic_t **topics, size_t numTopics)
virtual bool flushPublishedEvents(int timeoutMsecs)
Definition: blpapi_providersession.h:1377
Common definitions used by the library.
struct blpapi_Event blpapi_Event_t
Definition: blpapi_types.h:139
RegistrationParts
Definition: blpapi_providersession.h:489
int blpapi_ProviderSession_deactivateSubServiceCodeRange(blpapi_ProviderSession_t *session, const char *serviceName, int begin, int end)
void setGroupId(const char *groupId, unsigned int groupIdLength)
Definition: blpapi_providersession.h:1431
struct blpapi_TopicList blpapi_TopicList_t
Definition: blpapi_topiclist.h:88
int blpapi_ServiceRegistrationOptions_getPartsToRegister(blpapi_ServiceRegistrationOptions_t *parameters)
Definition: blpapi_abstractsession.h:187
virtual void deactivateSubServiceCodeRange(const char *serviceName, int begin, int end)
Definition: blpapi_providersession.h:1163
virtual Topic createTopic(const Message &message)
Definition: blpapi_providersession.h:1221
::BloombergLP::blpapi::ProviderEventHandler EventHandler
Definition: blpapi_providersession.h:648
virtual Topic getTopic(const Message &message)
Definition: blpapi_providersession.h:1230
#define BLPAPI_CALL(FUNCNAME)
Definition: blpapi_call.h:353
Definition: blpapi_service.h:304
High priority (INT_MAX)
Definition: blpapi_providersession.h:483
blpapi_SessionOptions_t * handle() const
Definition: blpapi_sessionoptions.h:1401
void blpapi_ProviderSession_destroy(blpapi_ProviderSession_t *session)
virtual void publish(const Event &event)
Definition: blpapi_providersession.h:1350
virtual void terminateSubscriptionsOnTopic(const Topic &topic, const char *message=0)
Definition: blpapi_providersession.h:1310
struct blpapi_ResolutionList blpapi_ResolutionList_t
Definition: blpapi_resolutionlist.h:88
int blpapi_ProviderSession_publish(blpapi_ProviderSession_t *session, blpapi_Event_t *event)
virtual void resolveAsync(const ResolutionList &resolutionList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1210
int blpapi_ProviderSession_start(blpapi_ProviderSession_t *session)
virtual void activateSubServiceCodeRange(const char *serviceName, int begin, int end, int priority)
Definition: blpapi_providersession.h:1155
int blpapi_ProviderSession_stop(blpapi_ProviderSession_t *session)
Definition: blpapi_abstractsession.h:253
virtual void stopAsync()
Definition: blpapi_providersession.h:1114
blpapi_Service_t * handle() const
Definition: blpapi_service.h:706
int blpapi_ServiceRegistrationOptions_getServicePriority(blpapi_ServiceRegistrationOptions_t *parameters)
int blpapi_ProviderSession_createTopics(blpapi_ProviderSession_t *session, blpapi_TopicList_t *topicList, int resolveMode, const blpapi_Identity_t *identity)
blpapi_ServiceRegistrationOptions_t * blpapi_ServiceRegistrationOptions_create(void)
const blpapi_ResolutionList_t * impl() const
Definition: blpapi_resolutionlist.h:535
Provide access to the entitlements for a user.
int blpapi_ProviderSession_terminateSubscriptionsOnTopics(blpapi_ProviderSession_t *session, const blpapi_Topic_t **topics, size_t numTopics, const char *message)
int blpapi_ProviderSession_activateSubServiceCodeRange(blpapi_ProviderSession_t *session, const char *serviceName, int begin, int end, int priority)
void blpapi_ServiceRegistrationOptions_removeAllActiveSubServiceCodeRanges(blpapi_ServiceRegistrationOptions_t *parameters)
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_GETPARTSTOREGISTER(a1)
Definition: blpapi_call.h:426
A service which provides access to API data (provide or consume).
ServiceRegistrationOptions & operator=(const ServiceRegistrationOptions &rhs)
Definition: blpapi_providersession.h:1409
int blpapi_ProviderSession_tryNextEvent(blpapi_ProviderSession_t *session, blpapi_Event_t **eventPointer)
friend void blpapi_providerEventHandlerAdapter(blpapi_Event_t *event, blpapi_ProviderSession_t *session, void *userData)
A component which defines events related operations.
virtual void resolve(ResolutionList *resolutionList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1197
int blpapi_ProviderSession_getTopic(blpapi_ProviderSession_t *session, const blpapi_Message_t *message, blpapi_Topic_t **topic)
Provide a key to identify individual subscriptions or requests.
#define BLPAPI_REGISTRATIONPARTS_OPERATIONS
Definition: blpapi_defs.h:129
int blpapi_ProviderSession_stopAsync(blpapi_ProviderSession_t *session)
virtual void stop()
Definition: blpapi_providersession.h:1109
blpapi_AbstractSession_t * blpapi_ProviderSession_getAbstractSession(blpapi_ProviderSession_t *session)
virtual void deleteTopic(const Topic &topic)
Definition: blpapi_providersession.h:1269
register to receive subscribe and unsubscribe messages
Definition: blpapi_providersession.h:491
int blpapi_ProviderSession_createTopicsAsync(blpapi_ProviderSession_t *session, const blpapi_TopicList_t *topicList, int resolveMode, const blpapi_Identity_t *identity)
struct blpapi_ServiceRegistrationOptions blpapi_ServiceRegistrationOptions_t
Definition: blpapi_dispatchtbl.h:93
static void throwOnError(int errorCode)
Definition: blpapi_exception.h:526
virtual Topic createServiceStatusTopic(const Service &service)
Definition: blpapi_providersession.h:1239
~ServiceRegistrationOptions()
Definition: blpapi_providersession.h:1404
virtual bool start()
Definition: blpapi_providersession.h:1099
Defines a request which can be sent for a service.
#define BLPAPI_CALL_PROVIDERSESSION_DELETETOPICS(a1, a2, a3)
Definition: blpapi_call.h:429
#define BLPAPI_CALL_PROVIDERSESSION_TERMINATESUBSCRIPTIONSONTOPICS( a1, a2, a3, a4)
Definition: blpapi_call.h:432
const blpapi_Topic_t * impl() const
Definition: blpapi_topic.h:221
struct blpapi_Identity blpapi_Identity_t
Definition: blpapi_types.h:188
int getServicePriority() const
Definition: blpapi_providersession.h:1457
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_ADDACTIVATESUBSERVICECODERANGE(a1, a2, a3, a4)
Definition: blpapi_call.h:444
Try to register services found in ResolutionList if necessary.
Definition: blpapi_providersession.h:668
struct blpapi_EventDispatcher blpapi_EventDispatcher_t
Definition: blpapi_types.h:142
#define BLPAPI_REGISTRATIONPARTS_SUBSCRIBER_RESOLUTION
Definition: blpapi_defs.h:130
#define BLPAPI_CALL_PROVIDERSESSION_ACTIVATESUBSERVICECODERANGE( a1, a2, a3, a4, a5)
Definition: blpapi_call.h:436
const blpapi_TopicList_t * impl() const
Definition: blpapi_topiclist.h:410
int blpapi_ProviderSession_resolve(blpapi_ProviderSession_t *session, blpapi_ResolutionList_t *resolutionList, int resolveMode, const blpapi_Identity_t *identity)
virtual bool deregisterService(const char *serviceName)
Definition: blpapi_providersession.h:1188
#define BLPAPI_REGISTRATIONPARTS_PUBLISHER_RESOLUTION
Definition: blpapi_defs.h:131
Definition: blpapi_correlationid.h:201
#define BLPAPI_CALL_PROVIDERSESSION_DEREGISTERSERVICE(a1, a2)
Definition: blpapi_call.h:420
int blpapi_ProviderSession_deregisterService(blpapi_ProviderSession_t *session, const char *serviceName)
int getGroupId(char *groupId, int *groupIdLength) const
Definition: blpapi_providersession.h:1450
Definition: blpapi_eventdispatcher.h:116
int blpapi_ProviderSession_startAsync(blpapi_ProviderSession_t *session)
Provide representation of a Topic.
void blpapi_ServiceRegistrationOptions_setGroupId(blpapi_ServiceRegistrationOptions_t *parameters, const char *groupId, unsigned int groupIdLength)
Provide a dispatcher to dispatch events.
#define BLPAPI_SERVICEREGISTRATIONOPTIONS_PRIORITY_LOW
Definition: blpapi_defs.h:123
struct blpapi_Topic blpapi_Topic_t
Definition: blpapi_dispatchtbl.h:75
virtual ~ProviderEventHandler()
Definition: blpapi_providersession.h:443
virtual int tryNextEvent(Event *event)
Definition: blpapi_providersession.h:1131
Definition: blpapi_topiclist.h:177
void setPartsToRegister(int parts)
Definition: blpapi_providersession.h:1444
int blpapi_ProviderSession_resolveAsync(blpapi_ProviderSession_t *session, const blpapi_ResolutionList_t *resolutionList, int resolveMode, const blpapi_Identity_t *identity)
Definition: blpapi_identity.h:131
int blpapi_ProviderSession_createServiceStatusTopic(blpapi_ProviderSession_t *session, const blpapi_Service_t *service, blpapi_Topic_t **topic)
Definition: blpapi_providersession.h:645
Definition: blpapi_providersession.h:670
void blpapi_ServiceRegistrationOptions_copy(blpapi_ServiceRegistrationOptions_t *lhs, const blpapi_ServiceRegistrationOptions_t *rhs)
int blpapi_ProviderSession_nextEvent(blpapi_ProviderSession_t *session, blpapi_Event_t **eventPointer, unsigned int timeoutInMilliseconds)
virtual void sendResponse(const Event &event, bool isPartialResponse=false)
Definition: blpapi_providersession.h:1357
Definition: blpapi_topic.h:114
virtual bool registerService(const char *serviceName, const Identity &providerIdentity=Identity(), const ServiceRegistrationOptions &registrationOptions=ServiceRegistrationOptions())
Definition: blpapi_providersession.h:1143
void addActiveSubServiceCodeRange(int begin, int end, int priority)
Definition: blpapi_providersession.h:1417
#define BLPAPI_RESOLVEMODE_AUTO_REGISTER_SERVICES
Definition: blpapi_defs.h:117
Definition: blpapi_event.h:196
void blpapi_ServiceRegistrationOptions_destroy(blpapi_ServiceRegistrationOptions_t *parameters)
#define BLPAPI_REGISTRATIONPARTS_DEFAULT
Definition: blpapi_defs.h:127
virtual CorrelationId registerServiceAsync(const char *serviceName, const Identity &providerIdentity=Identity(), const CorrelationId &correlationId=CorrelationId(), const ServiceRegistrationOptions &registrationOptions=ServiceRegistrationOptions())
Definition: blpapi_providersession.h:1171
virtual void terminateSubscriptionsOnTopics(const std::vector< Topic > &topics, const char *message=0)
Definition: blpapi_providersession.h:1319
Definition: blpapi_session.h:334
struct blpapi_AbstractSession blpapi_AbstractSession_t
Definition: blpapi_types.h:127
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_REMOVEALLACTIVESUBSERVICECODERANGES(a1)
Definition: blpapi_call.h:449
int blpapi_ProviderSession_sendResponse(blpapi_ProviderSession_t *session, blpapi_Event_t *event, int isPartialResponse)
void blpapi_ServiceRegistrationOptions_setPartsToRegister(blpapi_ServiceRegistrationOptions_t *parameters, int parts)
virtual bool startAsync()
Definition: blpapi_providersession.h:1104
struct blpapi_ProviderSession blpapi_ProviderSession_t
Definition: blpapi_types.h:160
blpapi_ServiceRegistrationOptions_t * blpapi_ServiceRegistrationOptions_duplicate(const blpapi_ServiceRegistrationOptions_t *parameters)
virtual Event nextEvent(int timeout=0)
Definition: blpapi_providersession.h:1119
#define BLPAPI_CALL_SERVICEREGISTRATIONOPTIONS_SETPARTSTOREGISTER(a1, a2)
Definition: blpapi_call.h:423
int blpapi_ProviderSession_registerService(blpapi_ProviderSession_t *session, const char *serviceName, const blpapi_Identity_t *identity, blpapi_ServiceRegistrationOptions_t *registrationOptions)
A common interface shared between publish and consumer sessions.
#define BLPAPI_EXPORT
Definition: blpapi_defs.h:171
struct blpapi_Service blpapi_Service_t
Definition: blpapi_types.h:166
#define BLPAPI_SERVICEREGISTRATIONOPTIONS_PRIORITY_MEDIUM
Definition: blpapi_defs.h:124
struct blpapi_SessionOptions blpapi_SessionOptions_t
Definition: blpapi_types.h:172
Provide functions for dispatchtbl.
ServiceRegistrationOptions()
Definition: blpapi_providersession.h:1392
virtual void createTopicsAsync(const TopicList &topicList, ResolveMode resolveMode=DONT_REGISTER_SERVICES, const Identity &providerIdentity=Identity())
Definition: blpapi_providersession.h:1260
Provide a list of subscriptions.
blpapi_Event_t * impl() const
Definition: blpapi_event.h:553
Definition: blpapi_providersession.h:469
Provide BLPAPI types.
Definition: blpapi_providersession.h:441
Definition: blpapi_exception.h:238
int blpapi_ProviderSession_createTopic(blpapi_ProviderSession_t *session, const blpapi_Message_t *message, blpapi_Topic_t **topic)
Provide a representation of a list of topics.
blpapi_ProviderSession_t * blpapi_ProviderSession_create(blpapi_SessionOptions_t *parameters, blpapi_ProviderEventHandler_t handler, blpapi_EventDispatcher_t *dispatcher, void *userData)
blpapi_Identity_t * handle() const
Definition: blpapi_identity.h:381
void(* blpapi_ProviderEventHandler_t)(blpapi_Event_t *event, blpapi_ProviderSession_t *session, void *userData)
Definition: blpapi_providersession.h:217
Definition: blpapi_resolutionlist.h:195
ServiceRegistrationPriority
Definition: blpapi_providersession.h:478
Definition: blpapi_sessionoptions.h:431
blpapi_EventDispatcher_t * impl() const
Definition: blpapi_eventdispatcher.h:198
A common interface shared between publisher and consumer sessions.
int getPartsToRegister() const
Definition: blpapi_providersession.h:1462
#define BLPAPI_SERVICEREGISTRATIONOPTIONS_PRIORITY_HIGH
Definition: blpapi_defs.h:125
Provide a representation of a list of topics.