BLPAPI C++ 3.26.6
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
616// ============================================================================
617// INLINE FUNCTION DEFINITIONS
618// ============================================================================
619
620// --------------------
621// class ResolutionList
622// --------------------
623
625 Message const&, Name const&)
626{
627 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
628
629 // Unreachable code, previous statement throws.
630 return Element();
631}
632
634 : d_handle_p(blpapi_ResolutionList_create(0))
635{
636}
637
639 : d_handle_p(blpapi_ResolutionList_create(original.d_handle_p))
640{
641}
642
644{
645 blpapi_ResolutionList_destroy(d_handle_p);
646}
647
649 const char *topic, const CorrelationId& correlationId)
650{
651 return blpapi_ResolutionList_add(d_handle_p, topic, &correlationId.impl());
652}
653
654inline int ResolutionList::add(Message const& topicSubscribedMessage,
655 const CorrelationId& correlationId)
656{
657 return blpapi_ResolutionList_addFromMessage(
658 d_handle_p, topicSubscribedMessage.impl(), &correlationId.impl());
659}
660
662{
663 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
664
665 // Unreachable code, previous statement throws.
666 return BLPAPI_ERROR_UNSUPPORTED_OPERATION;
667}
668
670{
671 blpapi_CorrelationId_t correlationId;
672 ExceptionUtil::throwOnError(blpapi_ResolutionList_correlationIdAt(
673 d_handle_p, &correlationId, index));
674
675 return CorrelationId(correlationId);
676}
677
679 const CorrelationId& correlationId) const
680{
681 const char *topic = 0;
682 ExceptionUtil::throwOnError(blpapi_ResolutionList_topicString(
683 d_handle_p, &topic, &correlationId.impl()));
684
685 return topic;
686}
687
688inline const char *ResolutionList::topicStringAt(size_t index) const
689{
690 const char *topic = 0;
692 blpapi_ResolutionList_topicStringAt(d_handle_p, &topic, index));
693
694 return topic;
695}
696
697inline int ResolutionList::status(const CorrelationId& correlationId) const
698{
699 int result = 0;
700 ExceptionUtil::throwOnError(blpapi_ResolutionList_status(
701 d_handle_p, &result, &correlationId.impl()));
702
703 return result;
704}
705
706inline int ResolutionList::statusAt(size_t index) const
707{
708 int result = 0;
710 blpapi_ResolutionList_statusAt(d_handle_p, &result, index));
711
712 return result;
713}
714
716 const Name&, const CorrelationId&) const
717{
718 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
719
720 // Unreachable code, previous statement throws.
721 return Element();
722}
723
724inline Element ResolutionList::attributeAt(const Name&, size_t) const
725{
726 ExceptionUtil::throwOnError(BLPAPI_ERROR_UNSUPPORTED_OPERATION);
727
728 // Unreachable code, previous statement throws.
729 return Element();
730}
731
733 const CorrelationId& correlationId) const
734{
735 blpapi_Message_t *messageByCid = 0;
736 ExceptionUtil::throwOnError(blpapi_ResolutionList_message(
737 d_handle_p, &messageByCid, &correlationId.impl()));
738
739 bool makeMessageCopyable = true;
740 BLPAPI_CALL_MESSAGE_ADDREF(messageByCid);
741 return Message(messageByCid, makeMessageCopyable);
742}
743
744inline Message const ResolutionList::messageAt(size_t index) const
745{
746 blpapi_Message_t *messageByIndex = 0;
747 ExceptionUtil::throwOnError(blpapi_ResolutionList_messageAt(
748 d_handle_p, &messageByIndex, index));
749
750 bool makeMessageCopyable = true;
751 BLPAPI_CALL_MESSAGE_ADDREF(messageByIndex);
752 return Message(messageByIndex, makeMessageCopyable);
753}
754
755inline size_t ResolutionList::size() const
756{
757 return static_cast<size_t>(blpapi_ResolutionList_size(d_handle_p));
758}
759
761inline const blpapi_ResolutionList_t *ResolutionList::impl() const
762{
763 return d_handle_p;
764}
765
766inline blpapi_ResolutionList_t *ResolutionList::impl() { return d_handle_p; }
768
769} // close namespace blpapi
770} // close namespace BloombergLP
771
772#endif // #ifdef __cplusplus
773#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:306
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:724
virtual const char * topicString(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:678
virtual ~ResolutionList()
Definition blpapi_resolutionlist.h:643
virtual Message const message(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:732
virtual const char * topicStringAt(size_t index) const
Definition blpapi_resolutionlist.h:688
virtual size_t size() const
Definition blpapi_resolutionlist.h:755
static Element extractAttributeFromResolutionSuccess(Message const &message, Name const &attribute)
Definition blpapi_resolutionlist.h:624
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:715
virtual int statusAt(size_t index) const
Definition blpapi_resolutionlist.h:706
virtual CorrelationId correlationIdAt(size_t index) const
Definition blpapi_resolutionlist.h:669
int addAttribute(const Name &attribute)
Definition blpapi_resolutionlist.h:661
virtual int status(const CorrelationId &correlationId) const
Definition blpapi_resolutionlist.h:697
ResolutionList()
Definition blpapi_resolutionlist.h:633
virtual int add(const char *topic, const CorrelationId &correlationId=CorrelationId())
Definition blpapi_resolutionlist.h:648
virtual Message const messageAt(size_t index) const
Definition blpapi_resolutionlist.h:744
Definition blpapi_abstractsession.h:452
Definition blpapi_abstractsession.h:451