BLPAPI C++ 3.26.5
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
35
36#ifndef INCLUDED_BLPAPI_TOPIC
37#define INCLUDED_BLPAPI_TOPIC
38
66
67#ifndef INCLUDED_BLPAPI_DEFS
68#include <blpapi_defs.h>
69#endif
70
71#ifndef INCLUDED_BLPAPI_SERVICE
72#include <blpapi_service.h>
73#endif
74
75struct blpapi_Topic;
76#ifdef __cplusplus
77extern "C" {
78#endif
79
81typedef struct blpapi_Topic blpapi_Topic_t;
82
86
87BLPAPI_EXPORT
88blpapi_Topic_t *blpapi_Topic_create(blpapi_Topic_t *from);
89
90BLPAPI_EXPORT
91void blpapi_Topic_destroy(blpapi_Topic_t *victim);
92
93BLPAPI_EXPORT
94int blpapi_Topic_compare(const blpapi_Topic_t *lhs, const blpapi_Topic_t *rhs);
95
96BLPAPI_EXPORT
97blpapi_Service_t *blpapi_Topic_service(const blpapi_Topic_t *topic);
98
99BLPAPI_EXPORT
100int blpapi_Topic_isActive(const blpapi_Topic_t *topic);
101
104
105#ifdef __cplusplus
106}
107
108#include <utility>
109
116
117namespace BloombergLP {
118namespace blpapi {
119
130class Topic {
131
132 blpapi_Topic_t *d_handle;
133
134 public:
135 Topic();
141
142 explicit Topic(blpapi_Topic_t *handle);
146
147 Topic(const Topic& original);
151
152 ~Topic();
156
157 Topic& operator=(const Topic& rhs);
158
159 bool isValid() const;
164
165 bool isActive() const;
170
171 Service service() const;
175
176 const blpapi_Topic_t *impl() const;
177
178 blpapi_Topic_t *impl();
179};
180
183
184bool operator==(Topic const& lhs, Topic const& rhs);
185
186bool operator!=(Topic const& lhs, Topic const& rhs);
187
188bool operator<(Topic const& lhs, Topic const& rhs);
189
190// ============================================================================
191// INLINE FUNCTION DEFINITIONS
192// ============================================================================
193
194// -----------
195// class Topic
196// -----------
197
199 : d_handle(0)
200{
201}
202
203inline Topic::Topic(blpapi_Topic_t *handle)
204 : d_handle(handle)
205{
206}
207
208inline Topic::Topic(Topic const& original)
209 : d_handle(blpapi_Topic_create(original.d_handle))
210{
211}
212
213inline Topic::~Topic() { blpapi_Topic_destroy(d_handle); }
214
215inline Topic& Topic::operator=(Topic const& rhs)
216{
217 using std::swap;
218
219 Topic tmp(rhs);
220 swap(tmp.d_handle, d_handle);
221
222 return *this;
223}
224
225inline bool Topic::isValid() const { return 0 != d_handle; }
226
227inline bool Topic::isActive() const
228{
229 return blpapi_Topic_isActive(d_handle) != 0;
230}
231
233{
234 return Service(blpapi_Topic_service(d_handle));
235}
236
237inline const blpapi_Topic_t *Topic::impl() const { return d_handle; }
238
239inline blpapi_Topic_t *Topic::impl() { return d_handle; }
240
241inline bool operator==(Topic const& lhs, Topic const& rhs)
242{
243 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) == 0;
244}
245
246inline bool operator!=(Topic const& lhs, Topic const& rhs)
247{
248 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) != 0;
249}
250
251inline bool operator<(Topic const& lhs, Topic const& rhs)
252{
253 return blpapi_Topic_compare(lhs.impl(), rhs.impl()) < 0;
254}
255
256} // close namespace blpapi
257} // close namespace BloombergLP
258
259#endif // #ifdef __cplusplus
260#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:320
Definition blpapi_topic.h:130
Service service() const
Definition blpapi_topic.h:232
const blpapi_Topic_t * impl() const
Definition blpapi_topic.h:237
Topic & operator=(const Topic &rhs)
Definition blpapi_topic.h:215
bool isActive() const
Definition blpapi_topic.h:227
bool isValid() const
Definition blpapi_topic.h:225
Topic()
Definition blpapi_topic.h:198
~Topic()
Definition blpapi_topic.h:213
void swap(Event::iterator &lhs, Event::iterator &rhs)
Swap the contents of the lhs and rhs iterators.
Definition blpapi_event.h:739
Definition blpapi_abstractsession.h:212
bool operator==(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:637
bool operator!=(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:660
bool operator<(const CorrelationId &lhs, const CorrelationId &rhs)
Definition blpapi_correlationid.h:665
Definition blpapi_abstractsession.h:211