dxd - dynax driver framework 3.0.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx_serialize.h File Reference
This graph shows which files directly or indirectly include this file:

Macros

#define DX_TREE_GET_array(id, ids)
#define DX_TREE_GET_cstr(id)
#define DX_TREE_GET_direction(id)
#define DX_TREE_GET_fourchar(id)
#define DX_TREE_GET_level(id)
#define DX_TREE_GET_matrix(id)
#define DX_TREE_GET_nested(id)
#define DX_TREE_GET_value(id)
#define DX_TREE_GET_vector(id)
#define DX_TREE_SERIALIZE(members)
 the tree serialization pair a struct's member list expands into
#define DX_TREE_SET_array(id, ids)
#define DX_TREE_SET_cstr(id)
#define DX_TREE_SET_direction(id)
#define DX_TREE_SET_fourchar(id)
#define DX_TREE_SET_level(id)
#define DX_TREE_SET_matrix(id)
#define DX_TREE_SET_nested(id)
#define DX_TREE_SET_value(id)
 member lists and their serialization sinks
#define DX_TREE_SET_vector(id)

Macro Definition Documentation

◆ DX_TREE_GET_array

#define DX_TREE_GET_array ( id,
ids )
Value:
{const uint32_t count= static_cast<uint32_t>(tree[#id].size());\
for(ids= 0; ids< count&& ids< sizeof_array(id); ids++)\
id[ids].read(tree[#id][std::to_string(ids)]);}
#define sizeof_array(array)
Definition dx_macros.h:113
unsigned int uint32_t
Definition wdk/dxd_platform.h:117

◆ DX_TREE_GET_cstr

#define DX_TREE_GET_cstr ( id)
Value:
{::strncpy(id, static_cast<std::string>(tree[#id](std::string{id})).c_str(), sizeof(id)- 1); id[sizeof(id)- 1]= {};}

◆ DX_TREE_GET_direction

#define DX_TREE_GET_direction ( id)
Value:
id= dx::stream::direction::from::string[static_cast<std::string>(tree[#id](dx::stream::direction::to::string[id]))];

◆ DX_TREE_GET_fourchar

#define DX_TREE_GET_fourchar ( id)
Value:
reinterpret_cast<uint32_t&>(id)= dx::fourchar::from::string(\
static_cast<std::string>(tree[#id](dx::fourchar::to::string(reinterpret_cast<const uint32_t&>(id)))).c_str());
uint32_t string(const char *fourchar)
Definition dx_common.h:570
std::string string(uint32_t fourchar)
Definition dx_common.h:554

◆ DX_TREE_GET_level

#define DX_TREE_GET_level ( id)
Value:
id= dx::log::from::string(static_cast<std::string>(tree[#id](std::string{dx::log::to::string(id)})).c_str());
static level string(const char *level)
Definition dx_log.h:70
static constexpr const char * string(level level)
Definition dx_log.h:59

◆ DX_TREE_GET_matrix

#define DX_TREE_GET_matrix ( id)
Value:
for(uint32_t row= 0; row< sizeof_array(id); row++)\
for(uint32_t col= 0; col< sizeof_array(id[row]); col++)\
id[row][col]= static_cast<std::remove_reference_t<decltype(id[row][col])>>(\
tree[#id][std::to_string(row)][std::to_string(col)](static_cast<uint32_t>(id[row][col])));

◆ DX_TREE_GET_nested

#define DX_TREE_GET_nested ( id)
Value:
id.read(tree[#id]);

◆ DX_TREE_GET_value

#define DX_TREE_GET_value ( id)
Value:
id= static_cast<decltype(id)>(tree[#id](static_cast<uint32_t>(id)));

◆ DX_TREE_GET_vector

#define DX_TREE_GET_vector ( id)
Value:
for(uint32_t idx= 0; idx< sizeof_array(id); idx++)\
id[idx]= static_cast<std::remove_reference_t<decltype(id[idx])>>(tree[#id][std::to_string(idx)](static_cast<uint32_t>(id[idx])));

◆ DX_TREE_SERIALIZE

#define DX_TREE_SERIALIZE ( members)
Value:
template<typename tree_t> void write(const tree_t& tree) const {members(DX_TREE_SET)}\
template<typename tree_t> void read(const tree_t& tree) {members(DX_TREE_GET)}

the tree serialization pair a struct's member list expands into

◆ DX_TREE_SET_array

#define DX_TREE_SET_array ( id,
ids )
Value:
for(uint32_t idx= 0; idx< ids&& idx< sizeof_array(id); idx++)\
id[idx].write(tree[#id][std::to_string(idx)]);

◆ DX_TREE_SET_cstr

#define DX_TREE_SET_cstr ( id)
Value:
tree[#id]= std::string{id};

◆ DX_TREE_SET_direction

#define DX_TREE_SET_direction ( id)
Value:
tree[#id]= dx::stream::direction::to::string[id];

◆ DX_TREE_SET_fourchar

#define DX_TREE_SET_fourchar ( id)
Value:
tree[#id]= dx::fourchar::to::string(reinterpret_cast<const uint32_t&>(id));

◆ DX_TREE_SET_level

#define DX_TREE_SET_level ( id)
Value:
tree[#id]= std::string{dx::log::to::string(id)};

◆ DX_TREE_SET_matrix

#define DX_TREE_SET_matrix ( id)
Value:
for(uint32_t row= 0; row< sizeof_array(id); row++)\
for(uint32_t col= 0; col< sizeof_array(id[row]); col++)\
tree[#id][std::to_string(row)][std::to_string(col)]= static_cast<uint32_t>(id[row][col]);

◆ DX_TREE_SET_nested

#define DX_TREE_SET_nested ( id)
Value:
id.write(tree[#id]);

◆ DX_TREE_SET_value

#define DX_TREE_SET_value ( id)
Value:
tree[#id]= static_cast<uint32_t>(id);

member lists and their serialization sinks

Each struct names its members once, as a DX_MEMBERS_<struct> list of X##_<kind>(member[, count]) entries, and hands that list to a sink macro. Two sinks consume it: the CF dictionary one (macOS, where the desc is also the device tree's wire format - see dx::coreaudio::pod::device's desc property) and the dx::key_value_tree one below, which recurses through named child nodes instead of flattening the struct into one opaque value.

A scalar rides as uint32_t so it lands in the store's own integer type (REG_DWORD) rather than a sizeof-wide byte copy - bitfields and bool included. An array's elements are the decimal index, read back by the node's own child count, so their order is numeric by construction and never depends on how the store sorts key names.

◆ DX_TREE_SET_vector

#define DX_TREE_SET_vector ( id)
Value:
for(uint32_t idx= 0; idx< sizeof_array(id); idx++)\
tree[#id][std::to_string(idx)]= static_cast<uint32_t>(id[idx]);

(c) copyright 2009 dynamic acoustics e.U. generated on

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.