18#pragma warning(disable:4251)
27 _ptr =
new char[val.size() + 1] {};
28 val.copy(_ptr, val.size());
32 _ptr =
new char[val.size() + 1] {};
33 memmove_s(_ptr, val.size(), val.c_str(), val.size());
38 size_t length = strlen(other._ptr) + 1;
39 _ptr =
new char[length] {};
40 memcpy(_ptr, other._ptr, length);
44 size_t length = strlen(other._ptr) + 1;
45 _ptr =
new char[length];
46 memmove_s(_ptr, length, other._ptr, length);
56 size_t length = strlen(other._ptr) + 1;
57 _ptr =
new char[length] {};
58 memcpy(_ptr, other._ptr, length);
68 size_t length = strlen(other._ptr) + 1;
69 _ptr =
new char[length] {};
70 memmove_s(_ptr, length, other._ptr, length);
77 const int t = strcmp(_ptr, other._ptr);
82 const int t = strcmp(_ptr, other._ptr);
87 const int t = strcmp(_ptr, other._ptr);
91 operator const char* ()
const {
return _ptr; }
102 char* _ptr =
nullptr;
125 void setValue(
float value);
126 void setValue(
double value);
127 void setValue(int32_t
value);
128 void setValue(int64_t
value);
129 void setValue(
bool value);
130 void setValue(
const char*
value);
131 void setValue(
const std::string&
value);
132 void setValue(std::string&&
value);
133 void setValue(
const complex& _value);
134 void setValue(
complex&& _value);
136 bool isFloat()
const;
137 bool isDouble()
const;
138 bool isInt32()
const;
139 bool isInt64()
const;
141 bool isConstCharPtr()
const;
142 bool isComplex()
const;
144 float getFloat()
const;
145 double getDouble()
const;
146 int32_t getInt32()
const;
147 int64_t getInt64()
const;
148 bool getBool()
const;
149 const char* getConstCharPtr()
const;
150 const complex getComplex()
const;
153 bool operator>(
const Variable& other)
const;
154 bool operator<(
const Variable& other)
const;
156 std::string getTypeName()
const;
159 using variable_t = std::variant<int32_t, int64_t, bool, float, double ,StringWrapper, complex>;
160 inline bool DoubleCompare(
const double& a,
const double& b)
const
162 constexpr const double epsilon = 1.0e-12;
164 if (abs(a - b) <= epsilon)
168 return abs(a - b) <= epsilon * (std::max)(abs(a), abs(b));
171 inline const bool FloatCompare(
const float& a,
const float& b)
const
173 constexpr const float epsilon = 1.0e-6f;
175 if (abs(a - b) <= epsilon)
179 return abs(a - b) <= epsilon * (std::max)(abs(a), abs(b));
#define OT_CORE_API_EXPORT
Dll import.
Definition CoreAPIExport.h:8
bsoncxx::types::value value
Definition DocumentManager.h:16
bool operator==(const FaceSelection &left, const FaceSelection &right)
Definition Model.cpp:55
Some type names are not system independent, hence the need to create a standardised way for this proj...
StringWrapper(std::string &&val)
Definition Variable.h:30
StringWrapper(const StringWrapper &other)
Definition Variable.h:36
StringWrapper & operator=(const StringWrapper &other)
Definition Variable.h:49
StringWrapper(StringWrapper &&other) noexcept
Definition Variable.h:42
StringWrapper & operator=(StringWrapper &&other) noexcept
Definition Variable.h:61
bool operator<(const StringWrapper &other)
Definition Variable.h:80
StringWrapper(const std::string &val)
Definition Variable.h:25
bool operator>(const StringWrapper &other)
Definition Variable.h:85
bool operator==(const StringWrapper &other)
Definition Variable.h:75
~StringWrapper()
Definition Variable.h:93
Definition Variable.h:107
Variable()
Definition Variable.h:109
Variable(const Variable &other)=default
Variable(Variable &&other)=default
std::complex< double > complex
Definition ComplexNumbers.h:6