Rumba C++ SDK
Value.h
Go to the documentation of this file.
1 /*
2 
3  *
4  ***
5  *****
6  ********************* Mercenaries Engineering SARL
7  ***************** Copyright (C) 2018
8  *************
9  ********* http://www.mercenaries-engineering.com
10  ***********
11  **** ****
12  ** **
13 
14 */
15 #pragma once
16 
17 #include "Impl.h"
18 #include "StringView.h"
19 #include "Macros.h"
20 
21 MAQUINA_IGNORE_WARNINGS_BEGIN
22 #include <ImathBox.h>
23 #include <ImathColor.h>
24 #include <ImathMatrix.h>
25 #include <ImathQuat.h>
26 MAQUINA_IGNORE_WARNINGS_END
27 
28  namespace maquina
29  {
30  class UserData;
31  class NodeDelegate;
32 
35  {
36  public:
37  Value();
38  Value( Value&& other ) = default;
39  Value( const Value& other ) = default;
40  Value& operator=( Value&& other) = default;
41  Value& operator=( const Value& other) = default;
42  virtual ~Value() = default;
43 
46 
49  Value(bool);
51  Value(int);
53  Value(float);
55  Value(double);
57  Value(const char *string);
59  Value(const wchar_t *string);
61  Value(const std::string &string);
63  Value(const std::wstring &string);
65  Value(const Imath::V2f &);
67  Value(const Imath::V3f &);
69  Value(const Imath::V4f &);
71  Value(const Imath::V2d &);
73  Value(const Imath::V3d &);
75  Value(const Imath::V4d &);
77  Value(const Imath::V2i &);
79  Value(const Imath::V3i &);
81  Value(const Imath::V4i &);
83  Value(const Imath::Color4f &);
85  Value(const Imath::M44f &);
87  Value(const Imath::M44d &);
89  Value(const Imath::Box3f &);
91  Value(const Imath::Quatf &);
93  Value(const Imath::Quatd &);
95  Value(const std::shared_ptr<const UserData>& user_data);
96 
98 
100 
101  Value duplicate() const;
102 
104 
105  bool as_bool() const;
106 
108 
109  int as_int() const;
110 
112 
113  float as_float() const;
114 
116 
117  double as_double() const;
118 
120 
121  const std::string& as_string() const;
122 
124 
125  std::wstring as_wstring() const;
126 
128 
129  Imath::V2f as_V2f() const;
130 
132 
133  Imath::V3f as_V3f() const;
134 
136 
137  Imath::V4f as_V4f() const;
138 
140 
141  const Imath::V2d& as_V2d() const;
142 
144 
145  const Imath::V3d& as_V3d() const;
146 
148 
149  const Imath::V4d& as_V4d() const;
150 
152 
153  const Imath::V2i& as_V2i() const;
154 
156 
157  const Imath::V3i& as_V3i() const;
158 
160 
161  const Imath::V4i& as_V4i() const;
162 
164 
165  Imath::M44f as_M44f() const;
166 
168 
169  const Imath::M44d &as_M44d() const;
170 
172 
173  const Imath::Box3f& as_Box3f() const;
174 
176 
177  const Imath::Color4f& as_Color4f() const;
178 
180 
181  Imath::Quatf as_Quatf() const;
182 
184 
185  const Imath::Quatd& as_Quatd() const;
186 
188 
189  std::shared_ptr<const UserData> as_user_data() const;
190 
191 
193 
195  StringView type_name() const;
196 
198  virtual bool has_node_delegate() const;
199 
205  virtual std::shared_ptr< NodeDelegate> node_delegate(
206  const std::shared_ptr<NodeDelegate>& parent,
207  const StringView& name) const;
208 
210  bool operator==(const Value& o) const;
211  bool operator!=(const Value& o) const;
212 
214  bool is_instance( const char* value_type_name ) const;
215 
216  operator bool() const {
217  return _impl.operator bool();
218  }
219 
221  static bool validate_type_name(const char* type_name);
222 
224  static Value get_default_value(const char* type_name);
225 
227  static const Value default_value;
228 
230  std::shared_ptr<Impl> _impl;
231 
233  Value(const std::shared_ptr<Impl> &impl) { _impl=impl; }
234  };
235  }
236 
Definition: ImathBox.h:71
Definition: ImathFrame.h:42
Definition: ImathColor.h:120
Definition: ImathFrame.h:43
Buffer< T > duplicate(const BufferConst< T > &a)
Definition: Buffer.h:161
Definition: ImathVec.h:63
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
static const Value default_value
The default value.
Definition: Value.h:227
Definition: ImathQuat.h:71
#define MAQUINA_EXPORT
Definition: Export.h:31
bool operator!=(const C *str, const StringViewBase< C, STDS > &sv) noexcept
Definition: StringView.h:305
Definition: ImathVec.h:61
bool operator==(const C *str, const StringViewBase< C, STDS > &sv) noexcept
Definition: StringView.h:273
Base class of all Rumba values.
Definition: Value.h:34