18#pragma warning(disable:4251)
26 size_t length = strlen(ptr) + 1;
27 _ptr =
new char[length];
32 _ptr =
new char[val.size() + 1] {};
33 val.copy(_ptr, val.size());
37 _ptr =
new char[val.size() + 1] {};
38 memmove_s(_ptr, val.size(), val.c_str(), val.size());
43 size_t length = strlen(other._ptr) + 1;
44 _ptr =
new char[length] {};
45 memcpy(_ptr, other._ptr, length);
49 size_t length = strlen(other._ptr) + 1;
50 _ptr =
new char[length];
51 memmove_s(_ptr, length, other._ptr, length);
55 if (_ptr !=
nullptr) {
60 size_t length = strlen(ptr) + 1;
61 _ptr =
new char[length];
72 size_t length = strlen(other._ptr) + 1;
73 _ptr =
new char[length] {};
74 memcpy(_ptr, other._ptr, length);
84 size_t length = strlen(other._ptr) + 1;
85 _ptr =
new char[length] {};
86 memmove_s(_ptr, length, other._ptr, length);
93 const int t = strcmp(_ptr, other._ptr);
98 const int t = strcmp(_ptr, other._ptr);
103 const int t = strcmp(_ptr, other._ptr);
107 operator const char* ()
const {
return _ptr; }
118 char* _ptr =
nullptr;
141 void setValue(
float value);
142 void setValue(
double value);
143 void setValue(int32_t
value);
144 void setValue(int64_t
value);
145 void setValue(
bool value);
146 void setValue(
const char*
value);
147 void setValue(
const std::string&
value);
148 void setValue(std::string&&
value);
149 void setValue(
const complex& _value);
150 void setValue(
complex&& _value);
152 bool isFloat()
const;
153 bool isDouble()
const;
154 bool isInt32()
const;
155 bool isInt64()
const;
157 bool isConstCharPtr()
const;
158 bool isComplex()
const;
160 float getFloat()
const;
161 double getDouble()
const;
162 int32_t getInt32()
const;
163 int64_t getInt64()
const;
164 bool getBool()
const;
165 const char* getConstCharPtr()
const;
166 const complex getComplex()
const;
169 bool operator>(
const Variable& other)
const;
170 bool operator<(
const Variable& other)
const;
172 std::string getTypeName()
const;
175 using variable_t = std::variant<int32_t, int64_t, bool, float, double ,StringWrapper, complex>;
176 inline bool DoubleCompare(
const double& a,
const double& b)
const
178 constexpr const double epsilon = 1.0e-12;
180 if (abs(a - b) <= epsilon)
184 return abs(a - b) <= epsilon * (std::max)(abs(a), abs(b));
187 inline const bool FloatCompare(
const float& a,
const float& b)
const
189 constexpr const float epsilon = 1.0e-6f;
191 if (abs(a - b) <= epsilon)
195 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:45
strcpy_s(retVal, response.length()+1, response.c_str())
Some type names are not system independent, hence the need to create a standardised way for this proj...
StringWrapper(const char *ptr)
Definition Variable.h:25
StringWrapper(std::string &&val)
Definition Variable.h:35
StringWrapper(const StringWrapper &other)
Definition Variable.h:41
StringWrapper & operator=(const StringWrapper &other)
Definition Variable.h:65
StringWrapper & operator=(const char *ptr)
Definition Variable.h:54
StringWrapper(StringWrapper &&other) noexcept
Definition Variable.h:47
StringWrapper & operator=(StringWrapper &&other) noexcept
Definition Variable.h:77
bool operator<(const StringWrapper &other)
Definition Variable.h:96
StringWrapper(const std::string &val)
Definition Variable.h:30
bool operator>(const StringWrapper &other)
Definition Variable.h:101
bool operator==(const StringWrapper &other)
Definition Variable.h:91
~StringWrapper()
Definition Variable.h:109
Definition Variable.h:123
Variable()
Definition Variable.h:125
Variable(const Variable &other)=default
Variable(Variable &&other)=default
std::complex< double > complex
Definition ComplexNumbers.h:6