![Logo](tetiere_ht.jpg) |
DATAKIT API
V2025.1
|
|
Go to the documentation of this file. 1 #ifndef __DTK_VAL_HPP__
2 #define __DTK_VAL_HPP__
15 #include <type_traits>
34 template <Dtk_val_type v,
bool trivial = false>
struct Value : std::integral_constant<Dtk_val_type, v> {
static bool const is_trivial = trivial; };
52 return GetPointer( u, std::integral_constant<bool, Binder::is_trivial>() );
56 return GetPointer( u, std::integral_constant<bool, Binder::is_trivial>() );
59 static T *
GetPointer(
void * u, std::integral_constant<bool, true> ) {
return static_cast< T *
>( u ); }
60 static T *
GetPointer(
void * u, std::integral_constant<bool, false> ) {
return *
static_cast< T **
>( u ); }
61 static T
const *
GetPointer(
void const * u, std::integral_constant<bool, true> ) {
return static_cast< T
const *
>( u ); }
62 static T
const *
GetPointer(
void const * u, std::integral_constant<bool, false> ) {
return *
static_cast< T *
const *
>( u ); }
116 template <typename T> std::pair<
bool, T>
Get()
const
119 return (
_type == Binded::value )
120 ? std::make_pair(
true, *Binded::GetPointer( &
_val ) )
121 : std::make_pair(
false, T() );
126 return (
_type == Binded::value ) ? Binded::GetPointer( &
_val ) :
nullptr;
128 template <
typename T> T
const *
GetIf()
const
131 return (
_type == Binded::value ) ? Binded::GetPointer( &
_val ) :
nullptr;
144 #endif //#ifndef __DTK_VAL_HPP__
@ DTK_VAL_TYPE_RGB
Definition: dtk_val.hpp:24
Dtk_ErrorStatus _Store(void *)
Dtk_dir * dir_val
Definition: dtk_val.hpp:76
void _init() DTK_NOEXCEPT
void _copy(const Dtk_Val &s)
enum Dtk_val_type _type
Definition: dtk_val.hpp:81
Definition: dtk_val.hpp:33
Dtk_Double64 double_val
Definition: dtk_val.hpp:72
@ DTK_VAL_TYPE_CHAR
Definition: dtk_val.hpp:21
This is a high level string class.
Definition: dtk_string.hpp:58
@ DTK_VAL_TYPE_PNT
Definition: dtk_val.hpp:25
Definition: dtk_uuid.hpp:8
Dtk_tab< Dtk_Int32 > GetIntArray(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
@ DTK_VAL_TYPE_UUID
Definition: dtk_val.hpp:27
Dtk_tab< Dtk_Int32 > * tab_val
Definition: dtk_val.hpp:78
Definition: dtk_status.hpp:16
static T * GetPointer(void *u)
Definition: dtk_val.hpp:50
Dtk_tab< Dtk_Char8 > * buffer_val
Definition: dtk_val.hpp:79
Dtk_UUID GetUuid(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
void _reset() DTK_NOEXCEPT
@ DTK_VAL_TYPE_INT
Definition: dtk_val.hpp:20
double Dtk_Double64
Definition: define.h:699
@ DTK_VAL_TYPE_DIR
Definition: dtk_val.hpp:26
@ DTK_VAL_TYPE_UNKNOWN
Definition: dtk_val.hpp:19
Dtk_tab< Dtk_Char8 > GetBufferData(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
Definition: dtk_val.hpp:67
int GetInt(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
static bool const is_trivial
Definition: dtk_val.hpp:34
Definition: dtk_val.hpp:34
Dtk_pnt * pnt_val
Definition: dtk_val.hpp:75
std::pair< bool, T > Get() const
Definition: dtk_val.hpp:116
Dtk_string * string_val
Definition: dtk_val.hpp:73
int32_t Dtk_Int32
Definition: define.h:687
T const * GetIf() const
Definition: dtk_val.hpp:128
char Dtk_Char8
Definition: define.h:697
Definition: dtk_val.hpp:49
@ DTK_VAL_TYPE_BUFFERDATA
Definition: dtk_val.hpp:29
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_pnt GetPnt(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
Dtk_string GetString(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
This is a mathematical point class.
Definition: dtk_pnt.hpp:22
void _move(Dtk_Val &&) DTK_NOEXCEPT
Dtk_dir GetDir(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
T * GetIf()
Definition: dtk_val.hpp:123
double GetDouble(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
Definition: dtk_val.hpp:36
This is a high level array class.
Definition: util_stl_dtk.hpp:85
Dtk_UUID * uuid_val
Definition: dtk_val.hpp:77
Dtk_Char8 char_val
Definition: dtk_val.hpp:71
@ DTK_VAL_TYPE_INTARRAY
Definition: dtk_val.hpp:28
friend std::ostream & operator<<(std::ostream &o, const Dtk_Val &d)
Dtk_Int32 int_val
Definition: dtk_val.hpp:70
Dtk_RGB GetRgb(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
@ DTK_VAL_TYPE_STRING
Definition: dtk_val.hpp:23
Dtk_val_type
Definition: dtk_val.hpp:18
static T const * GetPointer(void const *u)
Definition: dtk_val.hpp:54
Definition: dtk_rgb.hpp:7
@ DTK_VAL_TYPE_DOUBLE
Definition: dtk_val.hpp:22
This is a mathematical direction class.
Definition: dtk_dir.hpp:15
Dtk_RGB * rgb_val
Definition: dtk_val.hpp:74
Dtk_val_type GetValType() const
char GetChar(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
#define DTK_NOEXCEPT
Definition: config.hpp:26