BLPAPI C++ 3.26.6
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
37
38#ifndef INCLUDED_BLPAPI_VERSIONINFO
39#define INCLUDED_BLPAPI_VERSIONINFO
40
130
131#include <blpapi_call.h>
132#include <blpapi_defs.h>
133#include <blpapi_versionmacros.h>
134
135#ifdef __cplusplus
136extern "C" {
137#endif // ifdef __cplusplus
138
143
160BLPAPI_EXPORT
161void blpapi_getVersionInfo(int *majorVersion,
162 int *minorVersion,
163 int *patchVersion,
164 int *buildVersion);
165
179BLPAPI_EXPORT
180const char *blpapi_getVersionIdentifier(void);
182
184
185#ifdef __cplusplus
186}
187
188#include <ostream>
189#include <sstream>
190#include <string>
191
192namespace BloombergLP {
193namespace blpapi {
200
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
281std::ostream& operator<<(std::ostream& stream, const VersionInfo& rhs);
287
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
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
#define BLPAPI_VERSION_MINOR
BLPAPI SDK minor version number.
Definition blpapi_versionmacros.h:64
#define BLPAPI_VERSION_MAJOR
BLPAPI SDK major version number.
Definition blpapi_versionmacros.h:62
#define BLPAPI_VERSION_PATCH
BLPAPI SDK patch version number.
Definition blpapi_versionmacros.h:66
#define BLPAPI_VERSION_BUILD
BLPAPI SDK build version number.
Definition blpapi_versionmacros.h:68
Definition blpapi_abstractsession.h:452
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:761
Definition blpapi_abstractsession.h:451