BLPAPI C++ 3.26.5
Loading...
Searching...
No Matches
blpapi_versioninfo.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_VERSIONINFO
37#define INCLUDED_BLPAPI_VERSIONINFO
38
137
138#ifndef INCLUDED_BLPAPI_CALL
139#include <blpapi_call.h>
140#endif
141
142#ifndef INCLUDED_BLPAPI_DEFS
143#include <blpapi_defs.h>
144#endif
145
146#ifndef INCLUDED_BLPAPI_VERSIONMACROS
147#include <blpapi_versionmacros.h>
148#endif
149
150#ifdef __cplusplus
151extern "C" {
152#endif // ifdef __cplusplus
153
155
158
159BLPAPI_EXPORT
160void blpapi_getVersionInfo(int *majorVersion,
161 int *minorVersion,
162 int *patchVersion,
163 int *buildVersion);
169
170BLPAPI_EXPORT
171const char *blpapi_getVersionIdentifier(void);
179
182
183#ifdef __cplusplus
184}
185
186#include <ostream>
187#include <sstream>
188#include <string>
189
196
197namespace BloombergLP {
198namespace blpapi {
199
210class VersionInfo {
211
212 private:
214 int d_major;
216 int d_minor;
218 int d_patch;
220 int d_build;
221
222 VersionInfo(int major, int minor, int patch, int build);
228
229 public:
230 // CREATORS
231 static VersionInfo headerVersion();
239
240 static VersionInfo runtimeVersion();
247
248 VersionInfo();
253
254 // ACCESSORS
255 int majorVersion() const;
259 int minorVersion() const;
263 int patchVersion() const;
267 int buildVersion() const;
271
272 static std::string versionIdentifier();
279};
280
283
284std::ostream& operator<<(std::ostream& stream, const VersionInfo& rhs);
290
291//=============================================================================
292// INLINE FUNCTION DEFINITIONS
293//=============================================================================
294
295// -----------------
296// class VersionInfo
297// -----------------
298// CREATORS
299inline VersionInfo::VersionInfo(int major, int minor, int patch, int build)
300 : d_major(major)
301 , d_minor(minor)
302 , d_patch(patch)
303 , d_build(build)
304{
305}
306
307inline VersionInfo VersionInfo::headerVersion()
308{
309 return VersionInfo(BLPAPI_VERSION_MAJOR,
310 BLPAPI_VERSION_MINOR,
311 BLPAPI_VERSION_PATCH,
312 BLPAPI_VERSION_BUILD);
313}
314
315inline VersionInfo VersionInfo::runtimeVersion()
316{
317 int major, minor, patch, build;
318 blpapi_getVersionInfo(&major, &minor, &patch, &build);
319 return VersionInfo(major, minor, patch, build);
320}
321
323{
324 blpapi_getVersionInfo(&d_major, &d_minor, &d_patch, &d_build);
325}
326
327// ACCESSORS
328inline int VersionInfo::majorVersion() const { return d_major; }
329
330inline int VersionInfo::minorVersion() const { return d_minor; }
331
332inline int VersionInfo::patchVersion() const { return d_patch; }
333
334inline int VersionInfo::buildVersion() const { return d_build; }
335
337{
338 std::ostringstream oss;
339 oss << "blpapi-cpp; headers " << headerVersion() << "; runtime "
340 << runtimeVersion();
341 return oss.str();
342}
343
344inline std::ostream& operator<<(std::ostream& stream, const VersionInfo& rhs)
345{
346 return stream << rhs.majorVersion() << '.' << rhs.minorVersion() << '.'
347 << rhs.patchVersion() << '.' << rhs.buildVersion();
348}
349
350} // close namespace blpapi
351} // close namespace BloombergLP
352
353#endif // ifdef __cplusplus
354
355#endif // INCLUDED_BLPAPI_VERSIONINFO
Provide functions for dispatchtbl.
Common definitions used by the library.
Provide preprocessor macros for BLPAPI library version information.
Definition blpapi_versioninfo.h:210
static std::string versionIdentifier()
Definition blpapi_versioninfo.h:336
static VersionInfo headerVersion()
Definition blpapi_versioninfo.h:307
int patchVersion() const
Definition blpapi_versioninfo.h:332
int minorVersion() const
Definition blpapi_versioninfo.h:330
int buildVersion() const
Definition blpapi_versioninfo.h:334
int majorVersion() const
Definition blpapi_versioninfo.h:328
static VersionInfo runtimeVersion()
Definition blpapi_versioninfo.h:315
VersionInfo()
Definition blpapi_versioninfo.h:322
Definition blpapi_abstractsession.h:212
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:680
Definition blpapi_abstractsession.h:211