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 namespace stromx
25 {
26  namespace runtime
27  {
28  class Version;
29  }
30 }
31 
32 namespace boost
33 {
34  namespace serialization
35  {
36  template<class Archive>
37  void serialize(Archive & ar, stromx::runtime::Version & v, const unsigned int classVersion);
38  }
39 }
40 
41 namespace stromx
42 {
43  namespace runtime
44  {
46  class Version
47  {
48  friend STROMX_RUNTIME_API bool operator== (const Version & lhs, const Version & rhs);
49  friend STROMX_RUNTIME_API bool operator< (const Version & lhs, const Version & rhs);
50  friend STROMX_RUNTIME_API std::ostream& operator<< (std::ostream& out, const Version & version);
51  friend STROMX_RUNTIME_API std::istream& operator>> (std::istream& in, Version & version);
52 
53  template<class Archive>
54  friend void boost::serialization::serialize(Archive & ar, stromx::runtime::Version & v, const unsigned int classVersion);
55 
56  public:
59  : m_major(0),
60  m_minor(0),
61  m_revision(0)
62  {}
63 
65  Version(const unsigned int major, const unsigned int minor, const unsigned int revision)
66  : m_major(major),
67  m_minor(minor),
68  m_revision(revision)
69  {}
70 
72  unsigned int major() const { return m_major; }
73 
75  unsigned int minor() const { return m_minor; }
76 
78  unsigned int revision() const { return m_revision; }
79 
80  private:
81  unsigned int m_major;
82  unsigned int m_minor;
83  unsigned int m_revision;
84  };
85 
86  STROMX_RUNTIME_API bool operator== (const Version & lhs, const Version & rhs);
87  STROMX_RUNTIME_API bool operator!= (const Version & lhs, const Version & rhs);
88  STROMX_RUNTIME_API std::ostream& operator<< (std::ostream& out, const Version & version);
89  STROMX_RUNTIME_API std::istream& operator>> (std::istream& in, Version & version);
90  STROMX_RUNTIME_API bool operator< (const Version & lhs, const Version & rhs);
91  STROMX_RUNTIME_API bool operator> (const Version & lhs, const Version & rhs);
92  STROMX_RUNTIME_API bool operator>= (const Version & lhs, const Version & rhs);
93  STROMX_RUNTIME_API bool operator<= (const Version & lhs, const Version & rhs);
94  }
95 }
96 
97 
98 
99 #endif // STROMX_RUNTIME_VERSION_H
A version of an operator or data type.
Definition: Version.h:46
Definition: Factory.h:23
unsigned int revision() const
Definition: Version.h:78
Version version()
Returns the version of the stromx runtime library.
Definition: Runtime.cpp:54
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
Version(const unsigned int major, const unsigned int minor, const unsigned int revision)
Definition: Version.h:65
unsigned int minor() const
Definition: Version.h:75
bool operator!=(const runtime::DataContainer &lhs, const runtime::DataContainer &rhs)
Definition: DataContainer.cpp:46
Version()
Definition: Version.h:58
unsigned int major() const
Definition: Version.h:72