BLPAPI C++ 3.26.7
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
37
38#ifndef INCLUDED_BLPAPI_RESOLUTIONLIST
39#define INCLUDED_BLPAPI_RESOLUTIONLIST
40
69
70#ifndef INCLUDED_BLPAPI_TYPES
71#include <blpapi_types.h>
72#endif
73
74#ifndef INCLUDED_BLPAPI_CORRELATIONID
76#endif
77
78#ifndef INCLUDED_BLPAPI_DEFS
79#include <blpapi_defs.h>
80#endif
81
82#ifndef INCLUDED_BLPAPI_ELEMENT
83#include <blpapi_element.h>
84#endif
85
86#ifndef INCLUDED_BLPAPI_NAME
87#include <blpapi_name.h>
88#endif
89
90#ifndef INCLUDED_BLPAPI_MESSAGE
91#include <blpapi_message.h>
92#endif
93
94#include <stddef.h>
95
96struct blpapi_ResolutionList;
97#ifdef __cplusplus
98extern "C" {
99#endif
100
102typedef struct blpapi_ResolutionList blpapi_ResolutionList_t;
103
107
120BLPAPI_EXPORT
121blpapi_Element_t *blpapi_ResolutionList_extractAttributeFromResolutionSuccess(
122 const blpapi_Message_t *message, const blpapi_Name_t *attribute);
123
134BLPAPI_EXPORT
135blpapi_ResolutionList_t *blpapi_ResolutionList_create(
136 blpapi_ResolutionList_t *from);
137
145BLPAPI_EXPORT
146void blpapi_ResolutionList_destroy(blpapi_ResolutionList_t *list);
147
162BLPAPI_EXPORT
163int blpapi_ResolutionList_add(blpapi_ResolutionList_t *list,
164 const char *topic,
165 const blpapi_CorrelationId_t *correlationId);
166
181BLPAPI_EXPORT
182int blpapi_ResolutionList_addFromMessage(blpapi_ResolutionList_t *list,
183 const blpapi_Message_t *topic,
184 const blpapi_CorrelationId_t *correlationId);
185
198BLPAPI_EXPORT
199int blpapi_ResolutionList_addAttribute(
200 blpapi_ResolutionList_t *list, const blpapi_Name_t *name);
201
214BLPAPI_EXPORT
215int blpapi_ResolutionList_correlationIdAt(const blpapi_ResolutionList_t *list,
216 blpapi_CorrelationId_t *result,
217 size_t index);
218
232BLPAPI_EXPORT
233int blpapi_ResolutionList_topicString(const blpapi_ResolutionList_t *list,
234 const char **topic,
235 const blpapi_CorrelationId_t *id);
236
250BLPAPI_EXPORT
251int blpapi_ResolutionList_topicStringAt(
252 const blpapi_ResolutionList_t *list, const char **topic, size_t index);
253
269BLPAPI_EXPORT
270int blpapi_ResolutionList_status(const blpapi_ResolutionList_t *list,
271 int *status,
272 const blpapi_CorrelationId_t *id);
273
288BLPAPI_EXPORT
289int blpapi_ResolutionList_statusAt(
290 const blpapi_ResolutionList_t *list, int *status, size_t index);
291
310BLPAPI_EXPORT
311int blpapi_ResolutionList_attribute(const blpapi_ResolutionList_t *list,
312 blpapi_Element_t **element,
313 const blpapi_Name_t *attribute,
314 const blpapi_CorrelationId_t *id);
315
334BLPAPI_EXPORT
335int blpapi_ResolutionList_attributeAt(const blpapi_ResolutionList_t *list,
336 blpapi_Element_t **element,
337 const blpapi_Name_t *attribute,
338 size_t index);
339
354BLPAPI_EXPORT
355int blpapi_ResolutionList_message(const blpapi_ResolutionList_t *list,
356 blpapi_Message_t **element,
357 const blpapi_CorrelationId_t *id);
358
373BLPAPI_EXPORT
374int blpapi_ResolutionList_messageAt(const blpapi_ResolutionList_t *list,
375 blpapi_Message_t **element,
376 size_t index);
377
385BLPAPI_EXPORT
386int blpapi_ResolutionList_size(const blpapi_ResolutionList_t *list);
387
390
391#ifdef __cplusplus
392}
393
394#ifndef INCLUDED_BLPAPI_EXCEPTION
395#include <blpapi_exception.h>
396#endif
397
398namespace BloombergLP {
399namespace blpapi {
406
419
420 blpapi_ResolutionList_t *d_handle_p;
421
422 public:
423 enum Status {
424 UNRESOLVED = BLPAPI_RESOLUTIONLIST_UNRESOLVED,
426 RESOLVED = BLPAPI_RESOLUTIONLIST_RESOLVED,
429 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_BAD_SERVICE,
433
435 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_SERVICE_AUTHORIZATION_FAILED,
438
440 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_BAD_TOPIC,
444
446 = BLPAPI_RESOLUTIONLIST_RESOLUTION_FAILURE_TOPIC_AUTHORIZATION_FAILED
448 };
449
450 // CLASS METHODS
452 Message const& message, Name const& attribute);
464
469
470 ResolutionList(const ResolutionList& original);
474
475 virtual ~ResolutionList();
479
480 // MANIPULATORS
481
482 virtual int add(const char *topic,
483 const CorrelationId& correlationId = CorrelationId());
490
491 virtual int add(Message const& topicSubscribedMessage,
492 const CorrelationId& correlationId = CorrelationId());
500
501 int addAttribute(const Name& attribute);
509
510 // ACCESSORS
511
512 virtual CorrelationId correlationIdAt(size_t index) const;
518
519 virtual const char *topicString(const CorrelationId& correlationId) const;
525
526 virtual const char *topicStringAt(size_t index) const;
531
532 virtual int status(const CorrelationId& correlationId) const;
543
544 virtual int statusAt(size_t index) const;
554
556 const Name& attribute, const CorrelationId& correlationId) const;
568
569 Element attributeAt(const Name& attribute, size_t index) const;
579
580 virtual Message const message(const CorrelationId& correlationId) const;
590
591 virtual Message const messageAt(size_t index) const;
600
601 virtual size_t size() const;
605
607 const blpapi_ResolutionList_t *impl() const;
608
609 blpapi_ResolutionList_t *impl();
611};
612
615
616namespace util {
617
621
622constexpr const char *to_string(ResolutionList::Status status);
626
628
629} // close namespace util
630
631// ============================================================================
632// INLINE FUNCTION DEFINITIONS
633// ============================================================================
634
635// --------------------
636// class ResolutionList
637// --------------------
638
640 Message const&, Name const&)
641{
642 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
643
644 // Unreachable code, previous statement throws.
645 return Element();
646}
647
649 : d_handle_p(blpapi_ResolutionList_create(0))
650{
651}
652
654 : d_handle_p(blpapi_ResolutionList_create(original.d_handle_p))
655{
656}
657
659{
660 blpapi_ResolutionList_destroy(d_handle_p);
661}
662
664 const char *topic, const CorrelationId& correlationId)
665{
666 return blpapi_ResolutionList_add(d_handle_p, topic, &correlationId.impl());
667}
668
669inline int ResolutionList::add(Message const& topicSubscribedMessage,
670 const CorrelationId& correlationId)
671{
672 return blpapi_ResolutionList_addFromMessage(
673 d_handle_p, topicSubscribedMessage.impl(), &correlationId.impl());
674}
675
677{
678 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
679
680 // Unreachable code, previous statement throws.
681 return BLPAPI_ERROR_UNSUPPORTED_OPERATION;
682}
683
685{
686 blpapi_CorrelationId_t correlationId;
687 ExceptionUtil::throwOnError(blpapi_ResolutionList_correlationIdAt(
688 d_handle_p, &correlationId, index));
689
690 return CorrelationId(correlationId);
691}
692
694 const CorrelationId& correlationId) const
695{
696 const char *topic = 0;
697 ExceptionUtil::throwOnError(blpapi_ResolutionList_topicString(
698 d_handle_p, &topic, &correlationId.impl()));
699
700 return topic;
701}
702
703inline const char *ResolutionList::topicStringAt(size_t index) const
704{
705 const char *topic = 0;
707 blpapi_ResolutionList_topicStringAt(d_handle_p, &topic, index));
708
709 return topic;
710}
711
712inline int ResolutionList::status(const CorrelationId& correlationId) const
713{
714 int result = 0;
715 ExceptionUtil::throwOnError(blpapi_ResolutionList_status(
716 d_handle_p, &result, &correlationId.impl()));
717
718 return result;
719}
720
721inline int ResolutionList::statusAt(size_t index) const
722{
723 int result = 0;
725 blpapi_ResolutionList_statusAt(d_handle_p, &result, index));
726
727 return result;
728}
729
731 const Name&, const CorrelationId&) const
732{
733 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
734
735 // Unreachable code, previous statement throws.
736 return Element();
737}
738
739inline Element ResolutionList::attributeAt(const Name&, size_t) const
740{
741 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
742
743 // Unreachable code, previous statement throws.
744 return Element();
745}
746
748 const CorrelationId& correlationId) const
749{
750 blpapi_Message_t *messageByCid = 0;
751 ExceptionUtil::throwOnError(blpapi_ResolutionList_message(
752 d_handle_p, &messageByCid, &correlationId.impl()));
753
754 bool makeMessageCopyable = true;
755 BLPAPI_CALL_MESSAGE_ADDREF(messageByCid);
756 return Message(messageByCid, makeMessageCopyable);
757}
758
759inline Message const ResolutionList::messageAt(size_t index) const
760{
761 blpapi_Message_t *messageByIndex = 0;
762 ExceptionUtil::throwOnError(blpapi_ResolutionList_messageAt(
763 d_handle_p, &messageByIndex, index));
764
765 bool makeMessageCopyable = true;
766 BLPAPI_CALL_MESSAGE_ADDREF(messageByIndex);
767 return Message(messageByIndex, makeMessageCopyable);
768}
769
770inline size_t ResolutionList::size() const
771{
772 return static_cast<size_t>(blpapi_ResolutionList_size(d_handle_p));
773}
774
776inline const blpapi_ResolutionList_t *ResolutionList::impl() const
777{
778 return d_handle_p;
779}
780
781inline blpapi_ResolutionList_t *ResolutionList::impl() { return d_handle_p; }
783
784// --------------
785// namespace util
786// --------------
787constexpr const char *util::to_string(ResolutionList::Status status)
788{
789 switch (status) {
791 return "UNRESOLVED";
793 return "RESOLVED";
795 return "RESOLUTION_FAILURE_BAD_SERVICE";
797 return "RESOLUTION_FAILURE_SERVICE_AUTHORIZATION_FAILED";
799 return "RESOLUTION_FAILURE_BAD_TOPIC";
801 return "RESOLUTION_FAILURE_TOPIC_AUTHORIZATION_FAILED";
802 }
803 // Silence warnings on some compilers
804 return "UNDEFINED";
805}
806
807} // close namespace blpapi
808} // close namespace BloombergLP
809
810#endif // #ifdef __cplusplus
811#endif // #ifndef INCLUDED_BLPAPI_RESOLUTIONLIST
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:322
Definition blpapi_element.h:1098
static void throwOnError(int errorCode)
Definition blpapi_exception.h:556
Definition blpapi_message.h:344
Definition blpapi_name.h:228
Definition blpapi_resolutionlist.h:418
Element attributeAt(const Name &attribute, size_t index) const
Definition blpapi_resolutionlist.h:739
virtual const char * topicString(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:693
virtual ~ResolutionList()
Definition blpapi_resolutionlist.h:658
virtual Message const message(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:747
virtual const char * topicStringAt(size_t index) const
Definition blpapi_resolutionlist.h:703
virtual size_t size() const
Definition blpapi_resolutionlist.h:770
static Element extractAttributeFromResolutionSuccess(Message const &message, Name const &attribute)
Definition blpapi_resolutionlist.h:639
Status
Definition blpapi_resolutionlist.h:423
@ RESOLUTION_FAILURE_SERVICE_AUTHORIZATION_FAILED
Definition blpapi_resolutionlist.h:434
@ RESOLUTION_FAILURE_BAD_SERVICE
Definition blpapi_resolutionlist.h:428
@ RESOLUTION_FAILURE_TOPIC_AUTHORIZATION_FAILED
Currently unused.
Definition blpapi_resolutionlist.h:445
@ RESOLUTION_FAILURE_BAD_TOPIC
Definition blpapi_resolutionlist.h:439
@ UNRESOLVED
Not yet resolved.
Definition blpapi_resolutionlist.h:424
@ RESOLVED
Resolved successfully.
Definition blpapi_resolutionlist.h:426
Element attribute(const Name &attribute, const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:730
virtual int statusAt(size_t index) const
Definition blpapi_resolutionlist.h:721
virtual CorrelationId correlationIdAt(size_t index) const
Definition blpapi_resolutionlist.h:684
int addAttribute(const Name &attribute)
Definition blpapi_resolutionlist.h:676
virtual int status(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:712
ResolutionList()
Definition blpapi_resolutionlist.h:648
virtual int add(const char *topic, const CorrelationId &correlationId=CorrelationId())
Definition blpapi_resolutionlist.h:663
virtual Message const messageAt(size_t index) const
Definition blpapi_resolutionlist.h:759
constexpr const char * to_string(CorrelationId::ValueType valueType)
Definition blpapi_correlationid.h:830
Definition blpapi_abstractsession.h:448
Definition blpapi_abstractsession.h:447