BLPAPI C++ 3.25.10
Loading...
Searching...
No Matches
blpapi_topic.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_TOPIC
29#define INCLUDED_BLPAPI_TOPIC
30
59#ifndef INCLUDED_BLPAPI_DEFS
60#include <blpapi_defs.h>
61#endif
62
63#ifndef INCLUDED_BLPAPI_SERVICE
64#include <blpapi_service.h>
65#endif
66
67struct blpapi_Topic;
68typedef struct blpapi_Topic blpapi_Topic_t;
69
70#ifdef __cplusplus
71extern "C" {
72#endif
73
76
79
82
85
88
89#ifdef __cplusplus
90}
91
92#include <utility>
93
101namespace BloombergLP {
102namespace blpapi {
103
114class Topic {
115
116 blpapi_Topic_t *d_handle;
117
118 public:
119 Topic();
126 explicit Topic(blpapi_Topic_t *handle);
131 Topic(const Topic& original);
136 ~Topic();
141 Topic& operator=(const Topic& rhs);
142
143 bool isValid() const;
149 bool isActive() const;
155 Service service() const;
160 const blpapi_Topic_t *impl() const;
161
163};
164
168bool operator==(Topic const& lhs, Topic const& rhs);
169
170bool operator!=(Topic const& lhs, Topic const& rhs);
171
172bool operator<(Topic const& lhs, Topic const& rhs);
173
174// ============================================================================
175// INLINE FUNCTION DEFINITIONS
176// ============================================================================
177
178// -----------
179// class Topic
180// -----------
181
183 : d_handle(0)
184{
185}
186
188 : d_handle(handle)
189{
190}
191
192inline Topic::Topic(Topic const& original)
193 : d_handle(blpapi_Topic_create(original.d_handle))
194{
195}
196
197inline Topic::~Topic() { blpapi_Topic_destroy(d_handle); }
198
199inline Topic& Topic::operator=(Topic const& rhs)
200{
201 using std::swap;
202
203 Topic tmp(rhs);
204 swap(tmp.d_handle, d_handle);
205
206 return *this;
207}
208
209inline bool Topic::isValid() const { return 0 != d_handle; }
210
211inline bool Topic::isActive() const
212{
213 return blpapi_Topic_isActive(d_handle) != 0;
214}
215
217{
218 return Service(blpapi_Topic_service(d_handle));
219}
220
221inline const blpapi_Topic_t *Topic::impl() const { return d_handle; }
222
223inline blpapi_Topic_t *Topic::impl() { return d_handle; }
224
225inline bool operator==(Topic const& lhs, Topic const& rhs)
226{
227 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) == 0;
228}
229
230inline bool operator!=(Topic const& lhs, Topic const& rhs)
231{
232 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) != 0;
233}
234
235inline bool operator<(Topic const& lhs, Topic const& rhs)
236{
237 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) < 0;
238}
239
240} // close namespace blpapi
241} // close namespace BloombergLP
242
243#endif // #ifdef __cplusplus
244#endif // #ifndef INCLUDED_BLPAPI_TOPIC
Common definitions used by the library.
#define BLPAPI_EXPORT
Definition blpapi_defs.h:171
struct blpapi_Topic blpapi_Topic_t
Definition blpapi_dispatchtbl.h:75
A service which provides access to API data (provide or consume).
BLPAPI_EXPORT int blpapi_Topic_compare(const blpapi_Topic_t *lhs, const blpapi_Topic_t *rhs)
BLPAPI_EXPORT void blpapi_Topic_destroy(blpapi_Topic_t *victim)
BLPAPI_EXPORT blpapi_Topic_t * blpapi_Topic_create(blpapi_Topic_t *from)
BLPAPI_EXPORT blpapi_Service_t * blpapi_Topic_service(const blpapi_Topic_t *topic)
BLPAPI_EXPORT int blpapi_Topic_isActive(const blpapi_Topic_t *topic)
Definition blpapi_service.h:304
Definition blpapi_topic.h:114
Service service() const
Definition blpapi_topic.h:216
const blpapi_Topic_t * impl() const
Definition blpapi_topic.h:221
Topic & operator=(const Topic &rhs)
Definition blpapi_topic.h:199
bool isActive() const
Definition blpapi_topic.h:211
bool isValid() const
Definition blpapi_topic.h:209
Topic()
Definition blpapi_topic.h:182
~Topic()
Definition blpapi_topic.h:197
void swap(Event::iterator &lhs, Event::iterator &rhs)
Swap the contents of the lhs and rhs iterators.
Definition blpapi_event.h:723
struct blpapi_Service blpapi_Service_t
Definition blpapi_types.h:166
bool operator==(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:562
bool operator!=(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:582
bool operator<(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:587
Definition blpapi_abstractsession.h:195