cgv
Loading...
Searching...
No Matches
variant.cxx
1#include "variant.h"
2
4using namespace cgv::type::info;
5
6namespace cgv {
7 namespace type {
8
9void assign_variant(const std::string& dst_value_type, void* dst_value_ptr,
10 const std::string& src_value_type, const void* src_value_ptr)
11{
12 if (dst_value_type == get_type_name(TI_BOOL))
13 get_variant(*static_cast<bool*>(dst_value_ptr), src_value_type, src_value_ptr);
14 else if (dst_value_type == get_type_name(TI_INT8))
15 get_variant(*static_cast<int8_type*>(dst_value_ptr), src_value_type, src_value_ptr);
16 else if (dst_value_type == get_type_name(TI_INT16))
17 get_variant(*static_cast<int16_type*>(dst_value_ptr), src_value_type, src_value_ptr);
18 else if (dst_value_type == get_type_name(TI_INT32))
19 get_variant(*static_cast<int32_type*>(dst_value_ptr), src_value_type, src_value_ptr);
20 else if (dst_value_type == get_type_name(TI_INT64))
21 get_variant(*static_cast<int64_type*>(dst_value_ptr), src_value_type, src_value_ptr);
22 else if (dst_value_type == get_type_name(TI_UINT8))
23 get_variant(*static_cast<uint8_type*>(dst_value_ptr), src_value_type, src_value_ptr);
24 else if (dst_value_type == get_type_name(TI_UINT16))
25 get_variant(*static_cast<uint16_type*>(dst_value_ptr), src_value_type, src_value_ptr);
26 else if (dst_value_type == get_type_name(TI_UINT32))
27 get_variant(*static_cast<uint32_type*>(dst_value_ptr), src_value_type, src_value_ptr);
28 else if (dst_value_type == get_type_name(TI_UINT64))
29 get_variant(*static_cast<uint64_type*>(dst_value_ptr), src_value_type, src_value_ptr);
30 else if (dst_value_type == get_type_name(TI_FLT32))
31 get_variant(*static_cast<flt32_type*>(dst_value_ptr), src_value_type, src_value_ptr);
32 else if (dst_value_type == get_type_name(TI_FLT64))
33 get_variant(*static_cast<flt64_type*>(dst_value_ptr), src_value_type, src_value_ptr);
34 else if (dst_value_type == get_type_name(TI_WCHAR))
35 get_variant(*static_cast<wchar_type*>(dst_value_ptr), src_value_type, src_value_ptr);
36 else if (dst_value_type == get_type_name(TI_STRING))
37 get_variant(*static_cast<std::string*>(dst_value_ptr), src_value_type, src_value_ptr);
38 else if (dst_value_type == get_type_name(TI_WSTRING))
39 get_variant(*static_cast<std::wstring*>(dst_value_ptr), src_value_type, src_value_ptr);
40}
41
42 }
43}
complete implementation of method actions that only call one method when entering a node
Definition action.h:113
namespace for templates that provide type information
Definition type_access.h:9
const char * get_type_name(TypeId tid)
function that returns the name of a type specified through TypeId
Definition type_id.cxx:117
@ TI_INT16
signed integer stored in 8 bits
Definition type_id.h:20
@ TI_INT8
boolean
Definition type_id.h:19
@ TI_INT32
signed integer stored in 16 bits
Definition type_id.h:21
@ TI_STRING
wide character type
Definition type_id.h:31
@ TI_WCHAR
floating point type stored in 64 bits
Definition type_id.h:30
@ TI_FLT32
floating point type stored in 16 bits
Definition type_id.h:28
@ TI_WSTRING
string type
Definition type_id.h:32
@ TI_UINT32
unsigned integer stored in 16 bits
Definition type_id.h:25
@ TI_UINT8
signed integer stored in 64 bits
Definition type_id.h:23
@ TI_INT64
signed integer stored in 32 bits
Definition type_id.h:22
@ TI_BOOL
void
Definition type_id.h:18
@ TI_UINT16
unsigned integer stored in 8 bits
Definition type_id.h:24
@ TI_FLT64
floating point type stored in 32 bits
Definition type_id.h:29
@ TI_UINT64
unsigned integer stored in 32 bits
Definition type_id.h:26
wchar_t wchar_type
wide character type
std::string to_string(const std::string &v, unsigned int w, unsigned int p, bool)
specialization of conversion from string to strings
the cgv namespace
Definition print.h:11