xssimpleversion.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32 
33 
34 // Copyright (c) 2003-2021 Xsens Technologies B.V. or subsidiaries worldwide.
35 // All rights reserved.
36 //
37 // Redistribution and use in source and binary forms, with or without modification,
38 // are permitted provided that the following conditions are met:
39 //
40 // 1. Redistributions of source code must retain the above copyright notice,
41 // this list of conditions, and the following disclaimer.
42 //
43 // 2. Redistributions in binary form must reproduce the above copyright notice,
44 // this list of conditions, and the following disclaimer in the documentation
45 // and/or other materials provided with the distribution.
46 //
47 // 3. Neither the names of the copyright holders nor the names of their contributors
48 // may be used to endorse or promote products derived from this software without
49 // specific prior written permission.
50 //
51 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
52 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
53 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
54 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
56 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
58 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
59 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
60 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
61 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
62 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
63 //
64 
65 #ifndef XSSIMPLEVERSION_H
66 #define XSSIMPLEVERSION_H
67 
68 #include "xstypesconfig.h"
69 
70 #undef minor
71 #undef major
72 
73 #ifdef __cplusplus
74 struct XsSimpleVersion;
75 extern "C" {
76 #endif
77 #ifndef __cplusplus
78 #define XSSIMPLEVERSION_INITIALIZER { 0, 0, 0 }
80 #endif
81 
86 
87 #ifdef __cplusplus
88 } // extern "C"
89 #endif
90 
92 {
93 #ifdef __cplusplus
94  explicit XsSimpleVersion(int vmaj = 0, int vmin = 0, int vrev = 0)
96  : m_major((uint8_t) vmaj)
97  , m_minor((uint8_t) vmin)
98  , m_revision((uint8_t) vrev)
99  {}
100 
102  XsSimpleVersion(const XsSimpleVersion& other)
103  : m_major(other.m_major)
104  , m_minor(other.m_minor)
105  , m_revision(other.m_revision)
106  {}
107 
109  XsSimpleVersion& operator = (const XsSimpleVersion& other)
110  {
111  m_major = other.m_major;
112  m_minor = other.m_minor;
113  m_revision = other.m_revision;
114  return *this;
115  }
116 
118  inline bool operator == (const XsSimpleVersion& other) const
119  {
120  return !XsSimpleVersion_compare(this, &other);
121  }
122 
124  inline bool operator != (const XsSimpleVersion& other) const
125  {
126  if (m_major != other.m_major || m_minor != other.m_minor || m_revision != other.m_revision)
127  return true;
128 
129  return false;
130  }
131 
133  inline bool operator < (const XsSimpleVersion& other) const
134  {
135  if (m_major < other.m_major)
136  return true;
137  else if (m_major > other.m_major)
138  return false;
139 
140  if (m_minor < other.m_minor)
141  return true;
142  else if (m_minor > other.m_minor)
143  return false;
144 
145  if (m_revision < other.m_revision)
146  return true;
147  else
148  return false;
149  }
150 
152  inline bool operator <= (const XsSimpleVersion& other) const
153  {
154  if (m_major < other.m_major)
155  return true;
156  else if (m_major > other.m_major)
157  return false;
158 
159  if (m_minor < other.m_minor)
160  return true;
161  else if (m_minor > other.m_minor)
162  return false;
163 
164  if (m_revision < other.m_revision)
165  return true;
166  else
167  return m_revision == other.m_revision;
168  }
169 
171  inline bool operator > (const XsSimpleVersion& other) const
172  {
173  return !(*this <= other);
174  }
175 
177  inline bool operator >= (const XsSimpleVersion& other) const
178  {
179  return !(*this < other);
180  }
181 
183  inline bool empty() const
184  {
185  return 0 != XsSimpleVersion_empty(this);
186  }
187 
189  inline int major() const
190  {
191  return (int) m_major;
192  }
194  inline int minor() const
195  {
196  return (int) m_minor;
197  }
199  inline int revision() const
200  {
201  return (int) m_revision;
202  }
203 
205  inline static XsSimpleVersion osVersion()
206  {
207  static XsSimpleVersion rv = []()
208  {
209  XsSimpleVersion rv;
211  return rv;
212  }
213  ();
214  return rv;
215  }
216 
217 private:
218 #endif
219  uint8_t m_major;
220  uint8_t m_minor;
221  uint8_t m_revision;
222 };
223 
224 #endif
XsSimpleVersion_swap
XSTYPES_DLL_API void XsSimpleVersion_swap(XsSimpleVersion *a, XsSimpleVersion *b)
Swap the contents of a with those of b.
Definition: xssimpleversion.c:98
XsSimpleVersion_compare
XSTYPES_DLL_API int XsSimpleVersion_compare(XsSimpleVersion const *a, XsSimpleVersion const *b)
Compare two XsSimpleVersion objects.
Definition: xssimpleversion.c:110
XsSimpleVersion_osVersion
XSTYPES_DLL_API void XsSimpleVersion_osVersion(XsSimpleVersion *thisPtr)
Platdorm independent request of the OS version. Results are cached and of course platform dependent.
Definition: xssimpleversion.c:120
XsSimpleVersion::m_major
uint8_t m_major
The major part of the version number.
Definition: xssimpleversion.h:219
XsSimpleVersion
A class to store version information.
Definition: xssimpleversion.h:91
XsSimpleVersion::XsSimpleVersion_empty
int XsSimpleVersion_empty(const XsSimpleVersion *thisPtr)
Test if this is a null-version.
Definition: xssimpleversion.c:87
XsSimpleVersion::m_minor
uint8_t m_minor
The minor part of the version number.
Definition: xssimpleversion.h:220
operator==
bool operator==(const XsFilterProfile &lhs, const XsFilterProfile &rhs)
Returns true if lhs has the same type as rhs.
Definition: scenariomatchpred.h:81
XsSimpleVersion::m_revision
uint8_t m_revision
The revision number of the version.
Definition: xssimpleversion.h:221
xstypesconfig.h
XSTYPES_DLL_API
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:65
XsSimpleVersion
struct XsSimpleVersion XsSimpleVersion
Definition: xssimpleversion.h:79


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:20