OnixS C++ CME MDP Premium Market Data Handler 5.9.0
API Documentation
Loading...
Searching...
No Matches
Version.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
23#include <string>
24
27
29
32
39{
40public:
43
46 : major_(major)
47 , minor_(minor)
48 , patch_(patch)
49 {
50 }
51
53 Version(const Version& other)
54 : major_(other.major_)
55 , minor_(other.minor_)
56 , patch_(other.patch_)
57 {
58 }
59
62 {
63 return major_;
64 }
65
68 {
69 return minor_;
70 }
71
74 {
75 return patch_;
76 }
77
80 Version& operator=(const Version& other)
81 {
82 major_ = other.major_;
83 minor_ = other.minor_;
84 patch_ = other.patch_;
85
86 return *this;
87 }
88
91 static Version current();
92
93private:
94 VersionComponent major_;
95 VersionComponent minor_;
96 VersionComponent patch_;
97};
98
100inline bool operator==(const Version& left, const Version& right)
101{
102 return ((left.major)() == (right.major)() && (left.minor)() == (right.minor)() && left.patch() == right.patch());
103}
104
106inline bool operator!=(const Version& left, const Version& right)
107{
108 return !(left == right);
109}
110
113inline bool operator<(const Version& left, const Version& right)
114{
115 return (
116 (left.major)() < (right.major)() || ((left.major)() == (right.major)() && (left.minor)() < (right.minor)())
117 || ((left.major)() == (right.major)() && (left.minor)() == (right.minor)() && left.patch() < right.patch())
118 );
119}
120
123inline bool operator>(const Version& left, const Version& right)
124{
125 return (right < left);
126}
127
131bool fromStr(const Char*, size_t, Version&);
132
135void toStr(std::string&, const Version&);
136
138inline std::string toStr(const Version& version)
139{
140 std::string str;
141
142 toStr(str, version);
143
144 return str;
145}
146
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_LTWT_EXPORTED
Definition Bootstrap.h:47
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
Identifies version of the product.
Definition Version.h:39
Version & operator=(const Version &other)
Re-initializes the instance as a copy of the other one.
Definition Version.h:80
Component major() const
'major' component of the version.
Definition Version.h:61
Version(const Version &other)
Initializes as a copy of the other instance.
Definition Version.h:53
VersionComponent Component
Alias for the numeric component.
Definition Version.h:42
static Version current()
Identifies the current version of the product.
Component patch() const
'patch' component of the version.
Definition Version.h:73
Version(Component major, Component minor, Component patch)
Initializes the instance from the given components.
Definition Version.h:45
Component minor() const
'minor' component of the version.
Definition Version.h:67
bool operator>(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition Decimal.h:110
bool operator!=(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition Decimal.h:96
bool fromStr(Decimal &, const Char *, size_t)
Deserializes a decimal number from the given text presentation.
char Char
Character type alias.
Definition String.h:36
bool operator==(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition Decimal.h:89
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
UInt16 VersionComponent
Alias for the version numeric component.
Definition Version.h:31
bool operator<(const FixedPointDecimal< Mantissa, Exponent > &left, const FixedPointDecimal< Mantissa, Exponent > &right)
Compares two fixed-point decimals.
Definition Decimal.h:103
UInt16 UInt16
uInt16.
Definition Fields.h:199