BLPAPI C++ 3.26.5
Loading...
Searching...
No Matches
blpapi_resolutionlist.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_RESOLUTIONLIST
37#define INCLUDED_BLPAPI_RESOLUTIONLIST
38
68
69#ifndef INCLUDED_BLPAPI_TYPES
70#include <blpapi_types.h>
71#endif
72
73#ifndef INCLUDED_BLPAPI_CORRELATIONID
75#endif
76
77#ifndef INCLUDED_BLPAPI_DEFS
78#include <blpapi_defs.h>
79#endif
80
81#ifndef INCLUDED_BLPAPI_ELEMENT
82#include <blpapi_element.h>
83#endif
84
85#ifndef INCLUDED_BLPAPI_NAME
86#include <blpapi_name.h>
87#endif
88
89#ifndef INCLUDED_BLPAPI_MESSAGE
90#include <blpapi_message.h>
91#endif
92
93#include <stddef.h>
94
95struct blpapi_ResolutionList;
96#ifdef __cplusplus
97extern "C" {
98#endif
99
101typedef struct blpapi_ResolutionList blpapi_ResolutionList_t;
102
106
107BLPAPI_EXPORT
108blpapi_Element_t *blpapi_ResolutionList_extractAttributeFromResolutionSuccess(
109 const blpapi_Message_t *message, const blpapi_Name_t *attribute);
110
111BLPAPI_EXPORT
112blpapi_ResolutionList_t *blpapi_ResolutionList_create(
113 blpapi_ResolutionList_t *from);
114
115BLPAPI_EXPORT
116void blpapi_ResolutionList_destroy(blpapi_ResolutionList_t *list);
117
118BLPAPI_EXPORT
119int blpapi_ResolutionList_add(blpapi_ResolutionList_t *list,
120 const char *topic,
121 const blpapi_CorrelationId_t *correlationId);
122
123BLPAPI_EXPORT
124int blpapi_ResolutionList_addFromMessage(blpapi_ResolutionList_t *list,
125 const blpapi_Message_t *topic,
126 const blpapi_CorrelationId_t *correlationId);
127
128BLPAPI_EXPORT
129int blpapi_ResolutionList_addAttribute(
130 blpapi_ResolutionList_t *list, const blpapi_Name_t *name);
131
132BLPAPI_EXPORT
133int blpapi_ResolutionList_correlationIdAt(const blpapi_ResolutionList_t *list,
134 blpapi_CorrelationId_t *result,
135 size_t index);
136
137BLPAPI_EXPORT
138int blpapi_ResolutionList_topicString(const blpapi_ResolutionList_t *list,
139 const char **topic,
140 const blpapi_CorrelationId_t *id);
141
142BLPAPI_EXPORT
143int blpapi_ResolutionList_topicStringAt(
144 const blpapi_ResolutionList_t *list, const char **topic, size_t index);
145
146BLPAPI_EXPORT
147int blpapi_ResolutionList_status(const blpapi_ResolutionList_t *list,
148 int *status,
149 const blpapi_CorrelationId_t *id);
150
151BLPAPI_EXPORT
152int blpapi_ResolutionList_statusAt(
153 const blpapi_ResolutionList_t *list, int *status, size_t index);
154
155BLPAPI_EXPORT
156int blpapi_ResolutionList_attribute(const blpapi_ResolutionList_t *list,
157 blpapi_Element_t **element,
158 const blpapi_Name_t *attribute,
159 const blpapi_CorrelationId_t *id);
160
161BLPAPI_EXPORT
162int blpapi_ResolutionList_attributeAt(const blpapi_ResolutionList_t *list,
163 blpapi_Element_t **element,
164 const blpapi_Name_t *attribute,
165 size_t index);
166
167BLPAPI_EXPORT
168int blpapi_ResolutionList_message(const blpapi_ResolutionList_t *list,
169 blpapi_Message_t **element,
170 const blpapi_CorrelationId_t *id);
171
172BLPAPI_EXPORT
173int blpapi_ResolutionList_messageAt(const blpapi_ResolutionList_t *list,
174 blpapi_Message_t **element,
175 size_t index);
176
177BLPAPI_EXPORT
178int blpapi_ResolutionList_size(const blpapi_ResolutionList_t *list);
179
182
183#ifdef __cplusplus
184}
185
186#ifndef INCLUDED_BLPAPI_EXCEPTION
187#include <blpapi_exception.h>
188#endif
189
196
197namespace BloombergLP {
198namespace blpapi {
199
212
213 blpapi_ResolutionList_t *d_handle_p;
214
215 public:
216 enum Status {
217 UNRESOLVED = BLPAPI_RESOLUTIONLIST_UNRESOLVED,
219 RESOLVED = BLPAPI_RESOLUTIONLIST_RESOLVED,
222 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_BAD_SERVICE,
226
228 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_SERVICE_AUTHORIZATION_FAILED,
231
233 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_BAD_TOPIC,
237
239 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_TOPIC_AUTHORIZATION_FAILED
241 };
242
243 // CLASS METHODS
245 Message const& message, Name const& attribute);
257
262
263 ResolutionList(const ResolutionList& original);
267
268 virtual ~ResolutionList();
272
273 // MANIPULATORS
274
275 virtual int add(const char *topic,
276 const CorrelationId& correlationId = CorrelationId());
283
284 virtual int add(Message const& topicSubscribedMessage,
285 const CorrelationId& correlationId = CorrelationId());
293
294 int addAttribute(const Name& attribute);
302
303 // ACCESSORS
304
305 virtual CorrelationId correlationIdAt(size_t index) const;
311
312 virtual const char *topicString(const CorrelationId& correlationId) const;
318
319 virtual const char *topicStringAt(size_t index) const;
324
325 virtual int status(const CorrelationId& correlationId) const;
336
337 virtual int statusAt(size_t index) const;
347
349 const Name& attribute, const CorrelationId& correlationId) const;
361
362 Element attributeAt(const Name& attribute, size_t index) const;
372
373 virtual Message const message(const CorrelationId& correlationId) const;
383
384 virtual Message const messageAt(size_t index) const;
393
394 virtual size_t size() const;
398
399 const blpapi_ResolutionList_t *impl() const;
400
401 blpapi_ResolutionList_t *impl();
402};
403
406
407// ============================================================================
408// INLINE FUNCTION DEFINITIONS
409// ============================================================================
410
411// --------------------
412// class ResolutionList
413// --------------------
414
416 Message const&, Name const&)
417{
418 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
419
420 // Unreachable code, previous statement throws.
421 return Element();
422}
423
425 : d_handle_p(blpapi_ResolutionList_create(0))
426{
427}
428
430 : d_handle_p(blpapi_ResolutionList_create(original.d_handle_p))
431{
432}
433
435{
436 blpapi_ResolutionList_destroy(d_handle_p);
437}
438
440 const char *topic, const CorrelationId& correlationId)
441{
442 return blpapi_ResolutionList_add(d_handle_p, topic, &correlationId.impl());
443}
444
445inline int ResolutionList::add(Message const& topicSubscribedMessage,
446 const CorrelationId& correlationId)
447{
448 return blpapi_ResolutionList_addFromMessage(
449 d_handle_p, topicSubscribedMessage.impl(), &correlationId.impl());
450}
451
453{
454 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
455
456 // Unreachable code, previous statement throws.
457 return BLPAPI_ERROR_UNSUPPORTED_OPERATION;
458}
459
461{
462 blpapi_CorrelationId_t correlationId;
463 ExceptionUtil::throwOnError(blpapi_ResolutionList_correlationIdAt(
464 d_handle_p, &correlationId, index));
465
466 return CorrelationId(correlationId);
467}
468
470 const CorrelationId& correlationId) const
471{
472 const char *topic = 0;
473 ExceptionUtil::throwOnError(blpapi_ResolutionList_topicString(
474 d_handle_p, &topic, &correlationId.impl()));
475
476 return topic;
477}
478
479inline const char *ResolutionList::topicStringAt(size_t index) const
480{
481 const char *topic = 0;
483 blpapi_ResolutionList_topicStringAt(d_handle_p, &topic, index));
484
485 return topic;
486}
487
488inline int ResolutionList::status(const CorrelationId& correlationId) const
489{
490 int result = 0;
491 ExceptionUtil::throwOnError(blpapi_ResolutionList_status(
492 d_handle_p, &result, &correlationId.impl()));
493
494 return result;
495}
496
497inline int ResolutionList::statusAt(size_t index) const
498{
499 int result = 0;
501 blpapi_ResolutionList_statusAt(d_handle_p, &result, index));
502
503 return result;
504}
505
507 const Name&, const CorrelationId&) const
508{
509 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
510
511 // Unreachable code, previous statement throws.
512 return Element();
513}
514
515inline Element ResolutionList::attributeAt(const Name&, size_t) const
516{
517 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
518
519 // Unreachable code, previous statement throws.
520 return Element();
521}
522
524 const CorrelationId& correlationId) const
525{
526 blpapi_Message_t *messageByCid = 0;
527 ExceptionUtil::throwOnError(blpapi_ResolutionList_message(
528 d_handle_p, &messageByCid, &correlationId.impl()));
529
530 bool makeMessageCopyable = true;
531 BLPAPI_CALL_MESSAGE_ADDREF(messageByCid);
532 return Message(messageByCid, makeMessageCopyable);
533}
534
535inline Message const ResolutionList::messageAt(size_t index) const
536{
537 blpapi_Message_t *messageByIndex = 0;
538 ExceptionUtil::throwOnError(blpapi_ResolutionList_messageAt(
539 d_handle_p, &messageByIndex, index));
540
541 bool makeMessageCopyable = true;
542 BLPAPI_CALL_MESSAGE_ADDREF(messageByIndex);
543 return Message(messageByIndex, makeMessageCopyable);
544}
545
546inline size_t ResolutionList::size() const
547{
548 return static_cast<size_t>(blpapi_ResolutionList_size(d_handle_p));
549}
550
551inline const blpapi_ResolutionList_t *ResolutionList::impl() const
552{
553 return d_handle_p;
554}
555
556inline blpapi_ResolutionList_t *ResolutionList::impl() { return d_handle_p; }
557
558} // close namespace blpapi
559} // close namespace BloombergLP
560
561#endif // #ifdef __cplusplus
562#endif // #ifndef INCLUDED_BLPAPI_RESOLUTIONLIST
#define BLPAPI_CALL_MESSAGE_ADDREF(a1)
Definition blpapi_call.h:368
Provide a key to identify individual subscriptions or requests.
Common definitions used by the library.
Provide a representation of an item in a message.
Defines Exceptions that can be thrown by the blpapi library.
Defines a message containing elements.
Provide a representation of strings for use as container keys.
Provide BLPAPI types.
Definition blpapi_correlationid.h:225
Definition blpapi_element.h:1167
static void throwOnError(int errorCode)
Definition blpapi_exception.h:541
Definition blpapi_message.h:177
Definition blpapi_name.h:242
Definition blpapi_resolutionlist.h:211
Element attributeAt(const Name &attribute, size_t index) const
Definition blpapi_resolutionlist.h:515
virtual const char * topicString(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:469
virtual ~ResolutionList()
Definition blpapi_resolutionlist.h:434
virtual Message const message(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:523
virtual const char * topicStringAt(size_t index) const
Definition blpapi_resolutionlist.h:479
virtual size_t size() const
Definition blpapi_resolutionlist.h:546
static Element extractAttributeFromResolutionSuccess(Message const &message, Name const &attribute)
Definition blpapi_resolutionlist.h:415
Status
Definition blpapi_resolutionlist.h:216
@ RESOLUTION_FAILURE_SERVICE_AUTHORIZATION_FAILED
Definition blpapi_resolutionlist.h:227
@ RESOLUTION_FAILURE_BAD_SERVICE
Definition blpapi_resolutionlist.h:221
@ RESOLUTION_FAILURE_TOPIC_AUTHORIZATION_FAILED
Currently unused.
Definition blpapi_resolutionlist.h:238
@ RESOLUTION_FAILURE_BAD_TOPIC
Definition blpapi_resolutionlist.h:232
@ UNRESOLVED
Not yet resolved.
Definition blpapi_resolutionlist.h:217
@ RESOLVED
Resolved successfully.
Definition blpapi_resolutionlist.h:219
Element attribute(const Name &attribute, const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:506
virtual int statusAt(size_t index) const
Definition blpapi_resolutionlist.h:497
virtual CorrelationId correlationIdAt(size_t index) const
Definition blpapi_resolutionlist.h:460
int addAttribute(const Name &attribute)
Definition blpapi_resolutionlist.h:452
virtual int status(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:488
ResolutionList()
Definition blpapi_resolutionlist.h:424
virtual int add(const char *topic, const CorrelationId &correlationId=CorrelationId())
Definition blpapi_resolutionlist.h:439
virtual Message const messageAt(size_t index) const
Definition blpapi_resolutionlist.h:535
const blpapi_ResolutionList_t * impl() const
Definition blpapi_resolutionlist.h:551
Definition blpapi_abstractsession.h:212
Definition blpapi_abstractsession.h:211