config_struct_details.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "../trace.h"
4
5
#include "
common.h
"
6
7
//fwd
8
namespace
armarx::meta::cfg
9
{
10
template
<
class
CL,
class
MT, MT CL::* ptr>
11
struct
element_default
;
12
}
13
14
//possible details
15
namespace
armarx::meta::cfg
16
{
17
template
<
class
CL,
class
MT, MT CL::* ptr>
18
using
element_widget
=
undefined_t
;
19
20
template
<
class
T>
21
using
config_layout
=
undefined_t
;
22
23
template
<
class
CL,
class
=
void
>
24
struct
struct_default
: std::false_type
25
{
26
static
const
CL&
get
()
27
{
28
static
const
CL cl;
29
return
cl;
30
}
31
static
void
set
(CL& cl)
32
{
33
cl =
get
();
34
}
35
};
36
37
template
<
class
CL>
38
struct
struct_default
<
39
CL,
40
std
::enable_if_t<simox::meta::has_hana_accessor_v<CL> >
41
> : std::false_type
42
{
43
private
:
44
template
<
class
VarName,
class
MT, MT CL::* ptr>
45
static
void
DoSetElement(
46
const
boost::hana::pair<VarName, boost::hana::struct_detail::member_ptr<MT CL::*, ptr>>&,
47
CL& val
48
)
49
{
50
if
constexpr(
element_default<CL, MT, ptr>::value
)
51
{
52
element_default<CL, MT, ptr>::set
(val);
53
}
54
}
55
public
:
56
static
void
set
(CL& cl)
57
{
58
static
constexpr
auto
accessors = boost::hana::accessors<CL>();
59
boost::hana::for_each(accessors, [&](
auto
& e)
60
{
61
ARMARX_TRACE_LITE
;
62
DoSetElement(e, cl);
63
});
64
}
65
static
const
CL&
get
()
66
{
67
static
const
CL cl;
68
set
(cl);
69
return
cl;
70
}
71
};
72
}
armarx::meta::cfg::element_default::set
static void set(CL &cl)
Definition:
element_details.h:45
armarx::meta::cfg::element_default
Definition:
config_struct_details.h:11
armarx::meta::cfg::struct_default< CL, std::enable_if_t< simox::meta::has_hana_accessor_v< CL > > >::set
static void set(CL &cl)
Definition:
config_struct_details.h:56
armarx::meta::cfg::struct_default::set
static void set(CL &cl)
Definition:
config_struct_details.h:31
armarx::meta::cfg::struct_default< CL, std::enable_if_t< simox::meta::has_hana_accessor_v< CL > > >::get
static const CL & get()
Definition:
config_struct_details.h:65
ARMARX_TRACE_LITE
#define ARMARX_TRACE_LITE
Definition:
trace.h:85
armarx::meta::cfg
Definition:
PluginCfgStruct.h:31
armarx::meta::cfg::struct_default::get
static const CL & get()
Definition:
config_struct_details.h:26
armarx::meta::cfg::struct_default
Definition:
config_struct_details.h:24
armarx::meta::cfg::element_widget
undefined_t element_widget
Definition:
config_struct_details.h:18
std
Definition:
Application.h:66
common.h
armarx::meta::cfg::undefined_t
::simox::meta::undefined_t undefined_t
Definition:
common.h:17
armarx::meta::cfg::config_layout
undefined_t config_layout
Definition:
config_struct_details.h:21
ArmarXCore
util
CPPUtility
ConfigIntrospection
config_struct_details.h
Generated on Sat Oct 12 2024 09:14:02 for armarx_documentation by
1.8.17