BLPAPI C++  3.24.2
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 
28 #ifndef INCLUDED_BLPAPI_RESOLUTIONLIST
29 #define INCLUDED_BLPAPI_RESOLUTIONLIST
30 
61 #ifndef INCLUDED_BLPAPI_TYPES
62 #include <blpapi_types.h>
63 #endif
64 
65 #ifndef INCLUDED_BLPAPI_CORRELATIONID
66 #include <blpapi_correlationid.h>
67 #endif
68 
69 #ifndef INCLUDED_BLPAPI_DEFS
70 #include <blpapi_defs.h>
71 #endif
72 
73 #ifndef INCLUDED_BLPAPI_ELEMENT
74 #include <blpapi_element.h>
75 #endif
76 
77 #ifndef INCLUDED_BLPAPI_NAME
78 #include <blpapi_name.h>
79 #endif
80 
81 #ifndef INCLUDED_BLPAPI_MESSAGE
82 #include <blpapi_message.h>
83 #endif
84 
85 #include <stddef.h>
86 
87 struct blpapi_ResolutionList;
88 typedef struct blpapi_ResolutionList blpapi_ResolutionList_t;
89 
90 #ifdef __cplusplus
91 extern "C" {
92 #endif
93 
96  const blpapi_Message_t *message, const blpapi_Name_t *attribute);
97 
101 
104 
107  const char *topic,
108  const blpapi_CorrelationId_t *correlationId);
109 
112  const blpapi_Message_t *topic,
113  const blpapi_CorrelationId_t *correlationId);
114 
117  blpapi_ResolutionList_t *list, const blpapi_Name_t *name);
118 
121  blpapi_CorrelationId_t *result,
122  size_t index);
123 
126  const char **topic,
127  const blpapi_CorrelationId_t *id);
128 
131  const blpapi_ResolutionList_t *list, const char **topic, size_t index);
132 
135  int *status,
136  const blpapi_CorrelationId_t *id);
137 
140  const blpapi_ResolutionList_t *list, int *status, size_t index);
141 
144  blpapi_Element_t **element,
145  const blpapi_Name_t *attribute,
146  const blpapi_CorrelationId_t *id);
147 
150  blpapi_Element_t **element,
151  const blpapi_Name_t *attribute,
152  size_t index);
153 
156  blpapi_Message_t **element,
157  const blpapi_CorrelationId_t *id);
158 
161  blpapi_Message_t **element,
162  size_t index);
163 
166 
167 #ifdef __cplusplus
168 }
169 
170 #ifndef INCLUDED_BLPAPI_EXCEPTION
171 #include <blpapi_exception.h>
172 #endif
173 
181 namespace BloombergLP {
182 namespace blpapi {
183 
196 
197  blpapi_ResolutionList_t *d_handle_p;
198 
199  public:
200  enum Status {
210 
215 
221 
225  };
226 
227  // CLASS METHODS
229  Message const& message, Name const& attribute);
242  ResolutionList();
247  ResolutionList(const ResolutionList& original);
252  virtual ~ResolutionList();
257  // MANIPULATORS
258 
259  virtual int add(const char *topic,
260  const CorrelationId& correlationId = CorrelationId());
268  virtual int add(Message const& topicSubscribedMessage,
269  const CorrelationId& correlationId = CorrelationId());
278  int addAttribute(const Name& attribute);
287  // ACCESSORS
288 
289  virtual CorrelationId correlationIdAt(size_t index) const;
296  virtual const char *topicString(const CorrelationId& correlationId) const;
303  virtual const char *topicStringAt(size_t index) const;
309  virtual int status(const CorrelationId& correlationId) const;
321  virtual int statusAt(size_t index) const;
333  const Name& attribute, const CorrelationId& correlationId) const;
346  Element attributeAt(const Name& attribute, size_t index) const;
357  virtual Message const message(const CorrelationId& correlationId) const;
368  virtual Message const messageAt(size_t index) const;
378  virtual size_t size() const;
383  const blpapi_ResolutionList_t *impl() const;
384 
386 };
387 
391 // ============================================================================
392 // INLINE FUNCTION DEFINITIONS
393 // ============================================================================
394 
395 // --------------------
396 // class ResolutionList
397 // --------------------
398 
400  Message const&, Name const&)
401 {
403 
404  // Unreachable code, previous statement throws.
405  return Element();
406 }
407 
409  : d_handle_p(blpapi_ResolutionList_create(0))
410 {
411 }
412 
414  : d_handle_p(blpapi_ResolutionList_create(original.d_handle_p))
415 {
416 }
417 
419 {
420  blpapi_ResolutionList_destroy(d_handle_p);
421 }
422 
424  const char *topic, const CorrelationId& correlationId)
425 {
426  return blpapi_ResolutionList_add(d_handle_p, topic, &correlationId.impl());
427 }
428 
429 inline int ResolutionList::add(Message const& topicSubscribedMessage,
430  const CorrelationId& correlationId)
431 {
433  d_handle_p, topicSubscribedMessage.impl(), &correlationId.impl());
434 }
435 
437 {
439 
440  // Unreachable code, previous statement throws.
442 }
443 
445 {
446  blpapi_CorrelationId_t correlationId;
448  d_handle_p, &correlationId, index));
449 
450  return CorrelationId(correlationId);
451 }
452 
453 inline const char *ResolutionList::topicString(
454  const CorrelationId& correlationId) const
455 {
456  const char *topic = 0;
458  d_handle_p, &topic, &correlationId.impl()));
459 
460  return topic;
461 }
462 
463 inline const char *ResolutionList::topicStringAt(size_t index) const
464 {
465  const char *topic = 0;
467  blpapi_ResolutionList_topicStringAt(d_handle_p, &topic, index));
468 
469  return topic;
470 }
471 
472 inline int ResolutionList::status(const CorrelationId& correlationId) const
473 {
474  int result = 0;
476  d_handle_p, &result, &correlationId.impl()));
477 
478  return result;
479 }
480 
481 inline int ResolutionList::statusAt(size_t index) const
482 {
483  int result = 0;
485  blpapi_ResolutionList_statusAt(d_handle_p, &result, index));
486 
487  return result;
488 }
489 
491  const Name&, const CorrelationId&) const
492 {
494 
495  // Unreachable code, previous statement throws.
496  return Element();
497 }
498 
499 inline Element ResolutionList::attributeAt(const Name&, size_t) const
500 {
502 
503  // Unreachable code, previous statement throws.
504  return Element();
505 }
506 
508  const CorrelationId& correlationId) const
509 {
510  blpapi_Message_t *messageByCid = 0;
512  d_handle_p, &messageByCid, &correlationId.impl()));
513 
514  bool makeMessageCopyable = true;
515  BLPAPI_CALL_MESSAGE_ADDREF(messageByCid);
516  return Message(messageByCid, makeMessageCopyable);
517 }
518 
519 inline Message const ResolutionList::messageAt(size_t index) const
520 {
521  blpapi_Message_t *messageByIndex = 0;
523  d_handle_p, &messageByIndex, index));
524 
525  bool makeMessageCopyable = true;
526  BLPAPI_CALL_MESSAGE_ADDREF(messageByIndex);
527  return Message(messageByIndex, makeMessageCopyable);
528 }
529 
530 inline size_t ResolutionList::size() const
531 {
532  return static_cast<size_t>(blpapi_ResolutionList_size(d_handle_p));
533 }
534 
536 {
537  return d_handle_p;
538 }
539 
540 inline blpapi_ResolutionList_t *ResolutionList::impl() { return d_handle_p; }
541 
542 } // close namespace blpapi
543 } // close namespace BloombergLP
544 
545 #endif // #ifdef __cplusplus
546 #endif // #ifndef INCLUDED_BLPAPI_RESOLUTIONLIST
int blpapi_ResolutionList_add(blpapi_ResolutionList_t *list, const char *topic, const blpapi_CorrelationId_t *correlationId)
Definition: blpapi_message.h:159
ResolutionList()
Definition: blpapi_resolutionlist.h:408
static Element extractAttributeFromResolutionSuccess(Message const &message, Name const &attribute)
Definition: blpapi_resolutionlist.h:399
#define BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_BAD_TOPIC
Definition: blpapi_defs.h:141
virtual ~ResolutionList()
Definition: blpapi_resolutionlist.h:418
struct blpapi_Element blpapi_Element_t
Definition: blpapi_types.h:136
virtual int statusAt(size_t index) const
Definition: blpapi_resolutionlist.h:481
#define BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_SERVICE_AUTHORIZATION_FAILED
Definition: blpapi_defs.h:140
Not yet resolved.
Definition: blpapi_resolutionlist.h:201
Common definitions used by the library.
virtual size_t size() const
Definition: blpapi_resolutionlist.h:530
int blpapi_ResolutionList_messageAt(const blpapi_ResolutionList_t *list, blpapi_Message_t **element, size_t index)
Definition: blpapi_abstractsession.h:220
Definition: blpapi_name.h:150
blpapi_ResolutionList_t * blpapi_ResolutionList_create(blpapi_ResolutionList_t *from)
int blpapi_ResolutionList_statusAt(const blpapi_ResolutionList_t *list, int *status, size_t index)
struct blpapi_ResolutionList blpapi_ResolutionList_t
Definition: blpapi_resolutionlist.h:88
Resolved successfully.
Definition: blpapi_resolutionlist.h:203
virtual int status(const CorrelationId &correlationId) const
Definition: blpapi_resolutionlist.h:472
struct blpapi_Name blpapi_Name_t
Definition: blpapi_types.h:154
virtual int add(const char *topic, const CorrelationId &correlationId=CorrelationId())
Definition: blpapi_resolutionlist.h:423
Status
Definition: blpapi_resolutionlist.h:200
#define BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_TOPIC_AUTHORIZATION_FAILED
Definition: blpapi_defs.h:142
int blpapi_ResolutionList_addFromMessage(blpapi_ResolutionList_t *list, const blpapi_Message_t *topic, const blpapi_CorrelationId_t *correlationId)
const blpapi_ResolutionList_t * impl() const
Definition: blpapi_resolutionlist.h:535
int blpapi_ResolutionList_addAttribute(blpapi_ResolutionList_t *list, const blpapi_Name_t *name)
Provide a key to identify individual subscriptions or requests.
struct blpapi_Message blpapi_Message_t
Definition: blpapi_message.h:70
int blpapi_ResolutionList_topicString(const blpapi_ResolutionList_t *list, const char **topic, const blpapi_CorrelationId_t *id)
static void throwOnError(int errorCode)
Definition: blpapi_exception.h:526
virtual Message const messageAt(size_t index) const
Definition: blpapi_resolutionlist.h:519
Currently unused.
Definition: blpapi_resolutionlist.h:222
int addAttribute(const Name &attribute)
Definition: blpapi_resolutionlist.h:436
Definition: blpapi_element.h:464
Element attributeAt(const Name &attribute, size_t index) const
Definition: blpapi_resolutionlist.h:499
void blpapi_ResolutionList_destroy(blpapi_ResolutionList_t *list)
#define BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_BAD_SERVICE
Definition: blpapi_defs.h:139
int blpapi_ResolutionList_size(const blpapi_ResolutionList_t *list)
Definition: blpapi_correlationid.h:201
int blpapi_ResolutionList_attribute(const blpapi_ResolutionList_t *list, blpapi_Element_t **element, const blpapi_Name_t *attribute, const blpapi_CorrelationId_t *id)
#define BLPAPI_RESOLUTIONLIST_UNRESOLVED
Definition: blpapi_defs.h:137
blpapi_Element_t * blpapi_ResolutionList_extractAttributeFromResolutionSuccess(const blpapi_Message_t *message, const blpapi_Name_t *attribute)
Defines a message containing elements.
virtual const char * topicStringAt(size_t index) const
Definition: blpapi_resolutionlist.h:463
virtual CorrelationId correlationIdAt(size_t index) const
Definition: blpapi_resolutionlist.h:444
int blpapi_ResolutionList_message(const blpapi_ResolutionList_t *list, blpapi_Message_t **element, const blpapi_CorrelationId_t *id)
#define BLPAPI_RESOLUTIONLIST_RESOLVED
Definition: blpapi_defs.h:138
int blpapi_ResolutionList_correlationIdAt(const blpapi_ResolutionList_t *list, blpapi_CorrelationId_t *result, size_t index)
Defines Exceptions that can be thrown by the blpapi library.
virtual const char * topicString(const CorrelationId &correlationId) const
Definition: blpapi_resolutionlist.h:453
int blpapi_ResolutionList_topicStringAt(const blpapi_ResolutionList_t *list, const char **topic, size_t index)
int blpapi_ResolutionList_attributeAt(const blpapi_ResolutionList_t *list, blpapi_Element_t **element, const blpapi_Name_t *attribute, size_t index)
#define BLPAPI_ERROR_UNSUPPORTED_OPERATION
Definition: blpapi_error.h:84
#define BLPAPI_EXPORT
Definition: blpapi_defs.h:171
virtual Message const message(const CorrelationId &correlationId) const
Definition: blpapi_resolutionlist.h:507
int blpapi_ResolutionList_status(const blpapi_ResolutionList_t *list, int *status, const blpapi_CorrelationId_t *id)
#define BLPAPI_CALL_MESSAGE_ADDREF(a1)
Definition: blpapi_call.h:360
Element attribute(const Name &attribute, const CorrelationId &correlationId) const
Definition: blpapi_resolutionlist.h:490
Provide BLPAPI types.
Provide a representation of an item in a message.
Provide a representation of strings for use as container keys.
Definition: blpapi_resolutionlist.h:195