Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Object.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 //We need to declare lots of copy constructors so the templated version is only called explicitly.
13 //However, the constructors cause the following warning on MSVC, which we disable below:
14 #ifdef _MSC_VER
15 #pragma warning(push)
16 #pragma warning (disable:4521) // 'class' : multiple copy constructors specified
17 #endif //_MSC_VER
18 
19 #include <Pothos/Config.hpp>
20 #include <typeinfo>
21 #include <string>
22 #include <iosfwd>
23 
24 namespace Pothos {
25 
26 //messy forward declares
27 class ObjectM;
28 namespace Detail {
29 struct ObjectContainer;
30 } //namespace Detail
31 
38 {
39 public:
40  NullObject(void);
41  ~NullObject(void);
42 };
43 
56 {
57 public:
61  explicit Object(void);
62 
72  template <typename ValueType>
73  static Object make(ValueType &&value);
74 
80  Object(const Object &obj);
81 
87  Object(Object &obj);
88 
94  Object(Object &&obj);
95 
101  Object(const Object &&obj);
102 
107  template <typename ValueType>
108  explicit Object(ValueType &&value);
109 
115  virtual ~Object(void);
116 
123  Object &operator=(const Object &rhs);
124 
131  Object &operator=(Object &&rhs);
132 
137  pothos_explicit operator bool(void) const;
138 
143  bool unique(void) const;
144 
149  const std::type_info &type(void) const;
150 
157  template <typename ValueType>
158  const ValueType &extract(void) const;
159 
167  template <typename ValueType>
168  ValueType convert(void) const;
169 
176  Object convert(const std::type_info &type) const;
177 
183  bool canConvert(const std::type_info &type) const;
184 
191  static bool canConvert(const std::type_info &srcType, const std::type_info &dstType);
192 
199  std::ostream &serialize(std::ostream &os) const;
200 
208  std::istream &deserialize(std::istream &is);
209 
217  int compareTo(const Object &other) const;
218 
223  size_t hashCode(void) const;
224 
229  std::string toString(void) const;
230 
234  std::string getTypeString(void) const;
235 
241  bool equals(const Object &obj) const;
242 
248  bool operator<(const Object &obj) const;
249 
255  bool operator>(const Object &obj) const;
256 
258  Detail::ObjectContainer *_impl;
259 };
260 
268 inline bool operator==(const Object &lhs, const Object &rhs);
269 
270 } //namespace Pothos
271 
272 #ifdef _MSC_VER
273 #pragma warning(pop)
274 #endif //_MSC_VER
275 
276 inline bool Pothos::operator==(const Object &lhs, const Object &rhs)
277 {
278  return lhs._impl == rhs._impl;
279 }
#define pothos_explicit
Definition: Config.hpp:85
#define POTHOS_API
Definition: Config.hpp:41
POTHOS_API bool operator==(const Callable &lhs, const Callable &rhs)
Detail::ObjectContainer * _impl
Private implementation details.
Definition: Object.hpp:258
Definition: Object.hpp:55
void serialize(Archive &, Pothos::Detail::ObjectContainer &, const unsigned int)
Definition: Serialize.hpp:46
int compareTo(const T0 &v0, const T1 &v1)
Definition: CompareTo.hpp:27
Definition: Object.hpp:37