 |
Flexiv AIDK APIs
1.2
|
Go to the documentation of this file.
18 #include <unordered_map>
27 extern std::unordered_map<std::string, std::string>
MAPPING;
31 extern std::unordered_map<std::string, int>
AI_CMD;
33 extern std::unordered_map<std::string, std::string>
ALIAS;
137 const std::string &key);
153 std::vector<std::vector<double>>
vect;
175 template <
size_t arg1,
size_t... others>
178 template <
size_t arg>
181 static const size_t value = arg;
184 template <
size_t arg1,
size_t arg2,
size_t... others>
187 static const size_t value = arg1 >= arg2
192 template <
typename... Ts>
195 template <
typename F,
typename... Ts>
198 inline static void destroy(
size_t id,
void *data)
200 if (
id ==
typeid(F).hash_code())
201 reinterpret_cast<F *
>(data)->~F();
206 inline static void move(
size_t old_t,
void *old_v,
void *new_v)
208 if (old_t ==
typeid(F).hash_code())
209 new (new_v) F(std::move(*
reinterpret_cast<F *
>(old_v)));
214 inline static void copy(
size_t old_t,
const void *old_v,
void *new_v)
216 if (old_t ==
typeid(F).hash_code())
217 new (new_v) F(*
reinterpret_cast<const F *
>(old_v));
226 inline static void destroy(
size_t id,
void *data)
232 inline static void move(
size_t old_t,
void *old_v,
void *new_v)
239 inline static void copy(
size_t old_t,
const void *old_v,
void *new_v)
247 template <
typename... Ts>
251 static const size_t data_size =
static_max<
sizeof(Ts)...>::value;
252 static const size_t data_align =
static_max<
alignof(Ts)...>::value;
254 using data_t =
typename std::aligned_storage<data_size, data_align>::type;
258 static inline size_t invalid_type() {
return typeid(void).hash_code(); }
265 : type_id(invalid_type())
269 : type_id(old.type_id)
271 helper_t::copy(old.type_id, &old.data, &data);
275 : type_id(old.type_id)
277 helper_t::move(old.type_id, &old.data, &data);
283 std::swap(type_id, old.type_id);
284 std::swap(data, old.data);
289 template <
typename T>
292 return (type_id ==
typeid(T).hash_code());
295 bool valid() {
return (type_id != invalid_type()); }
297 template <
typename T,
typename... Args>
301 helper_t::destroy(type_id, &data);
302 new (&data) T(std::forward<Args>(args)...);
303 type_id =
typeid(T).hash_code();
306 template <
typename T>
310 if (type_id ==
typeid(T).hash_code())
311 return *
reinterpret_cast<T *
>(&data);
313 throw std::bad_cast();
std::string calculate_string_md5(const std::string &input)
uint32_t ai_index
Definition: defs.hpp:126
@ POSE6D
Definition: defs.hpp:42
T & get()
Definition: defs.hpp:307
@ NUM
Definition: defs.hpp:56
std::vector< std::string > SINGLE_DATA
variant< Ts... > & operator=(variant< Ts... > old)
Definition: defs.hpp:281
void set(Args &&... args)
Definition: defs.hpp:298
std::unordered_map< std::string, std::string > ALIAS
static void copy(size_t old_t, const void *old_v, void *new_v)
Definition: defs.hpp:214
@ LAST
Definition: defs.hpp:55
bool is()
Definition: defs.hpp:290
@ BBOX
Definition: defs.hpp:45
~variant()
Definition: defs.hpp:316
std::vector< ObjMetaData > obj_meta_data
Definition: defs.hpp:132
std::string status_name
Definition: defs.hpp:161
@ GET_INT_VALUE
Definition: defs.hpp:49
std::vector< std::string > PROTO_DATA
@ ERROR
Definition: defs.hpp:39
@ CLASSIFY
Definition: defs.hpp:47
variant(variant< Ts... > &&old)
Definition: defs.hpp:274
static void destroy(size_t id, void *data)
Definition: defs.hpp:226
int error_code
Definition: defs.hpp:169
@ GET_DOUBLE_VALUE
Definition: defs.hpp:50
std::string name
Definition: defs.hpp:151
@ MULTIVIEW
Definition: defs.hpp:46
variant(const variant< Ts... > &old)
Definition: defs.hpp:268
@ UNKNOWN
Definition: defs.hpp:38
static void destroy(size_t id, void *data)
Definition: defs.hpp:198
@ KEYPOINT3D
Definition: defs.hpp:51
@ CUSTOM
Definition: defs.hpp:52
@ IDLE
Definition: defs.hpp:40
variant()
Definition: defs.hpp:264
@ SCENE
Definition: defs.hpp:48
std::vector< std::vector< double > > vect
Definition: defs.hpp:153
double double_value
Definition: defs.hpp:149
@ KEYPOINT
Definition: defs.hpp:44
std::vector< std::vector< double > > meta_to_vector(const ObjMetaData &obj, const std::string &key)
double synced_timestamp
Definition: defs.hpp:129
@ POS3D
Definition: defs.hpp:41
AIState
Definition: defs.hpp:36
static void copy(size_t old_t, const void *old_v, void *new_v)
Definition: defs.hpp:239
static void move(size_t old_t, void *old_v, void *new_v)
Definition: defs.hpp:232
std::unordered_map< std::string, std::string > MAPPING
static void move(size_t old_t, void *old_v, void *new_v)
Definition: defs.hpp:206
@ GRASP_POSE
Definition: defs.hpp:43
std::string error_msg
Definition: defs.hpp:171
@ FIRST
Definition: defs.hpp:54
int status_code
Definition: defs.hpp:159
bool valid
Definition: defs.hpp:145
bool valid()
Definition: defs.hpp:295
std::string obj_name
Definition: defs.hpp:123
std::vector< std::string > SUPPORTED_KEYS
std::string status_message
Definition: defs.hpp:163
std::unordered_map< std::string, int > AI_CMD
ObjState()
Definition: defs.hpp:116
int int_value
Definition: defs.hpp:147