stromx  0.8.0
Version.h
1 /*
2  * Copyright 2011 Matthias Fuchs
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef STROMX_RUNTIME_VERSION_H
18 #define STROMX_RUNTIME_VERSION_H
19 
20 #include "stromx/runtime/Config.h"
21 
22 #include <iostream>
23 
24 #undef major
25 #undef minor
26 
27 namespace stromx
28 {
29  namespace runtime
30  {
31  class Version;
32  }
33 }
34 
35 namespace boost
36 {
37  namespace serialization
38  {
39  template<class Archive>
40  void serialize(Archive & ar, stromx::runtime::Version & v, const unsigned int classVersion);
41  }
42 }
43 
44 namespace stromx
45 {
46  namespace runtime
47  {
49  class Version
50  {
51  friend STROMX_RUNTIME_API bool operator== (const Version & lhs, const Version & rhs);
52  friend STROMX_RUNTIME_API bool operator< (const Version & lhs, const Version & rhs);
53  friend STROMX_RUNTIME_API std::ostream& operator<< (std::ostream& out, const Version & version);
54  friend STROMX_RUNTIME_API std::istream& operator>> (std::istream& in, Version & version);
55 
56  template<class Archive>
57  friend void boost::serialization::serialize(Archive & ar, stromx::runtime::Version & v, const unsigned int classVersion);
58 
59  public:
62  : m_major(0),
63  m_minor(0),
64  m_revision(0)
65  {}
66 
68  Version(const unsigned int major, const unsigned int minor, const unsigned int revision)
69  : m_major(major),
70  m_minor(minor),
71  m_revision(revision)
72  {}
73 
75  unsigned int major() const { return m_major; }
76 
78  unsigned int minor() const { return m_minor; }
79 
81  unsigned int revision() const { return m_revision; }
82 
83  private:
84  unsigned int m_major;
85  unsigned int m_minor;
86  unsigned int m_revision;
87  };
88 
89  STROMX_RUNTIME_API bool operator== (const Version & lhs, const Version & rhs);
90  STROMX_RUNTIME_API bool operator!= (const Version & lhs, const Version & rhs);
91  STROMX_RUNTIME_API std::ostream& operator<< (std::ostream& out, const Version & version);
92  STROMX_RUNTIME_API std::istream& operator>> (std::istream& in, Version & version);
93  STROMX_RUNTIME_API bool operator< (const Version & lhs, const Version & rhs);
94  STROMX_RUNTIME_API bool operator> (const Version & lhs, const Version & rhs);
95  STROMX_RUNTIME_API bool operator>= (const Version & lhs, const Version & rhs);
96  STROMX_RUNTIME_API bool operator<= (const Version & lhs, const Version & rhs);
97  }
98 }
99 
100 
101 
102 #endif // STROMX_RUNTIME_VERSION_H
A version of an operator or data type.
Definition: Version.h:49
Definition: Factory.h:23
unsigned int revision() const
Definition: Version.h:81
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
Version(const unsigned int major, const unsigned int minor, const unsigned int revision)
Definition: Version.h:68
unsigned int minor() const
Definition: Version.h:78
bool operator!=(const runtime::DataContainer &lhs, const runtime::DataContainer &rhs)
Definition: DataContainer.cpp:46
Version()
Definition: Version.h:61
unsigned int major() const
Definition: Version.h:75
const Version & version()
Returns the version of the stromx runtime library.
Definition: Runtime.cpp:54