BLPAPI C++ 3.26.6
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
37
38#ifndef INCLUDED_BLPAPI_TOPIC
39#define INCLUDED_BLPAPI_TOPIC
40
67
68#ifndef INCLUDED_BLPAPI_DEFS
69#include <blpapi_defs.h>
70#endif
71
72#ifndef INCLUDED_BLPAPI_SERVICE
73#include <blpapi_service.h>
74#endif
75
76struct blpapi_Topic;
77#ifdef __cplusplus
78extern "C" {
79#endif
80
82typedef struct blpapi_Topic blpapi_Topic_t;
83
87
97BLPAPI_EXPORT
98blpapi_Topic_t *blpapi_Topic_create(blpapi_Topic_t *from);
99
107BLPAPI_EXPORT
108void blpapi_Topic_destroy(blpapi_Topic_t *victim);
109
122BLPAPI_EXPORT
123int blpapi_Topic_compare(const blpapi_Topic_t *lhs, const blpapi_Topic_t *rhs);
124
134BLPAPI_EXPORT
135blpapi_Service_t *blpapi_Topic_service(const blpapi_Topic_t *topic);
136
147BLPAPI_EXPORT
148int blpapi_Topic_isActive(const blpapi_Topic_t *topic);
149
152
153#ifdef __cplusplus
154}
155
156#include <utility>
157
158namespace BloombergLP {
159namespace blpapi {
166
177class Topic {
178
179 blpapi_Topic_t *d_handle;
180
181 public:
182 Topic();
188
189 explicit Topic(blpapi_Topic_t *handle);
193
194 Topic(const Topic& original);
198
199 ~Topic();
203
204 Topic& operator=(const Topic& rhs);
205
206 bool isValid() const;
211
212 bool isActive() const;
217
218 Service service() const;
222
224 const blpapi_Topic_t *impl() const;
225
226 blpapi_Topic_t *impl();
228};
229
232
233bool operator==(Topic const& lhs, Topic const& rhs);
234
235bool operator!=(Topic const& lhs, Topic const& rhs);
236
237bool operator<(Topic const& lhs, Topic const& rhs);
238
239// ============================================================================
240// INLINE FUNCTION DEFINITIONS
241// ============================================================================
242
243// -----------
244// class Topic
245// -----------
246
248 : d_handle(0)
249{
250}
251
252inline Topic::Topic(blpapi_Topic_t *handle)
253 : d_handle(handle)
254{
255}
256
257inline Topic::Topic(Topic const& original)
258 : d_handle(blpapi_Topic_create(original.d_handle))
259{
260}
261
262inline Topic::~Topic() { blpapi_Topic_destroy(d_handle); }
263
264inline Topic& Topic::operator=(Topic const& rhs)
265{
266 using std::swap;
267
268 Topic tmp(rhs);
269 swap(tmp.d_handle, d_handle);
270
271 return *this;
272}
273
274inline bool Topic::isValid() const { return 0 != d_handle; }
275
276inline bool Topic::isActive() const
277{
278 return blpapi_Topic_isActive(d_handle) != 0;
279}
280
282{
283 return Service(blpapi_Topic_service(d_handle));
284}
285
287inline const blpapi_Topic_t *Topic::impl() const { return d_handle; }
288
289inline blpapi_Topic_t *Topic::impl() { return d_handle; }
291
292inline bool operator==(Topic const& lhs, Topic const& rhs)
293{
294 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) == 0;
295}
296
297inline bool operator!=(Topic const& lhs, Topic const& rhs)
298{
299 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) != 0;
300}
301
302inline bool operator<(Topic const& lhs, Topic const& rhs)
303{
304 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) < 0;
305}
306
307} // close namespace blpapi
308} // close namespace BloombergLP
309
310#endif // #ifdef __cplusplus
311#endif // #ifndef INCLUDED_BLPAPI_TOPIC
Common definitions used by the library.
A service which provides access to API data (provide or consume).
Definition blpapi_service.h:619
Definition blpapi_topic.h:177
Service service() const
Definition blpapi_topic.h:281
Topic & operator=(const Topic &rhs)
Definition blpapi_topic.h:264
bool isActive() const
Definition blpapi_topic.h:276
bool isValid() const
Definition blpapi_topic.h:274
Topic()
Definition blpapi_topic.h:247
~Topic()
Definition blpapi_topic.h:262
void swap(Event::iterator &lhs, Event::iterator &rhs)
Swap the contents of the lhs and rhs iterators.
Definition blpapi_event.h:860
Definition blpapi_abstractsession.h:452
bool operator==(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:718
bool operator!=(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:741
bool operator<(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:746
Definition blpapi_abstractsession.h:451