BLPAPI C++ 3.25.7
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
28#ifndef INCLUDED_BLPAPI_VERSIONINFO
29#define INCLUDED_BLPAPI_VERSIONINFO
30
130#ifndef INCLUDED_BLPAPI_CALL
131#include <blpapi_call.h>
132#endif
133
134#ifndef INCLUDED_BLPAPI_DEFS
135#include <blpapi_defs.h>
136#endif
137
138#ifndef INCLUDED_BLPAPI_VERSIONMACROS
139#include <blpapi_versionmacros.h>
140#endif
141
142#ifdef __cplusplus
143extern "C" {
144#endif // ifdef __cplusplus
145
147void blpapi_getVersionInfo(int *majorVersion,
148 int *minorVersion,
149 int *patchVersion,
150 int *buildVersion);
167#ifdef __cplusplus
168}
169
170#include <ostream>
171#include <sstream>
172#include <string>
173
181namespace BloombergLP {
182namespace blpapi {
183
195
196 private:
198 int d_major;
200 int d_minor;
202 int d_patch;
204 int d_build;
205
206 VersionInfo(int major, int minor, int patch, int build);
213 public:
214 // CREATORS
215 static VersionInfo headerVersion();
232 VersionInfo();
238 // ACCESSORS
239 int majorVersion() const;
243 int minorVersion() const;
247 int patchVersion() const;
251 int buildVersion() const;
256 static std::string versionIdentifier();
263};
264
268std::ostream& operator<<(std::ostream& stream, const VersionInfo& rhs);
275//=============================================================================
276// INLINE FUNCTION DEFINITIONS
277//=============================================================================
278
279// -----------------
280// class VersionInfo
281// -----------------
282// CREATORS
283inline VersionInfo::VersionInfo(int major, int minor, int patch, int build)
284 : d_major(major)
285 , d_minor(minor)
286 , d_patch(patch)
287 , d_build(build)
288{
289}
290
298
300{
301 int major, minor, patch, build;
302 blpapi_getVersionInfo(&major, &minor, &patch, &build);
303 return VersionInfo(major, minor, patch, build);
304}
305
307{
308 blpapi_getVersionInfo(&d_major, &d_minor, &d_patch, &d_build);
309}
310
311// ACCESSORS
312inline int VersionInfo::majorVersion() const { return d_major; }
313
314inline int VersionInfo::minorVersion() const { return d_minor; }
315
316inline int VersionInfo::patchVersion() const { return d_patch; }
317
318inline int VersionInfo::buildVersion() const { return d_build; }
319
321{
322 std::ostringstream oss;
323 oss << "blpapi-cpp; headers " << headerVersion() << "; runtime "
324 << runtimeVersion();
325 return oss.str();
326}
327
328inline std::ostream& operator<<(std::ostream& stream, const VersionInfo& rhs)
329{
330 return stream << rhs.majorVersion() << '.' << rhs.minorVersion() << '.'
331 << rhs.patchVersion() << '.' << rhs.buildVersion();
332}
333
334} // close namespace blpapi
335} // close namespace BloombergLP
336
337#endif // ifdef __cplusplus
338
339#endif // INCLUDED_BLPAPI_VERSIONINFO
Provide functions for dispatchtbl.
Common definitions used by the library.
#define BLPAPI_EXPORT
Definition blpapi_defs.h:171
BLPAPI_EXPORT void blpapi_getVersionInfo(int *majorVersion, int *minorVersion, int *patchVersion, int *buildVersion)
BLPAPI_EXPORT const char * blpapi_getVersionIdentifier(void)
Provide preprocessor macros for BLPAPI library version information.
#define BLPAPI_VERSION_MINOR
Definition blpapi_versionmacros.h:50
#define BLPAPI_VERSION_MAJOR
Definition blpapi_versionmacros.h:49
#define BLPAPI_VERSION_PATCH
Definition blpapi_versionmacros.h:51
#define BLPAPI_VERSION_BUILD
Definition blpapi_versionmacros.h:52
Definition blpapi_versioninfo.h:194
static std::string versionIdentifier()
Definition blpapi_versioninfo.h:320
static VersionInfo headerVersion()
Definition blpapi_versioninfo.h:291
int patchVersion() const
Definition blpapi_versioninfo.h:316
int minorVersion() const
Definition blpapi_versioninfo.h:314
int buildVersion() const
Definition blpapi_versioninfo.h:318
int majorVersion() const
Definition blpapi_versioninfo.h:312
static VersionInfo runtimeVersion()
Definition blpapi_versioninfo.h:299
VersionInfo()
Definition blpapi_versioninfo.h:306
std::ostream & operator<<(std::ostream &os, const CorrelationId &correlator)
Definition blpapi_correlationid.h:592
Definition blpapi_abstractsession.h:195