12static void parseName(
const char *cname,
const int baseflags,
unsigned &flags, std::string &name_)
19 std::string name(cname);
20 size_t ppos = name.find(
'.');
21 if (ppos == std::string::npos)
24 "etiss::VirtualStruct::allocateFromC encountered an invalid field name. flags cannot be parsed and "
25 "will be set to private. check the documentation of VirtualStruct_names for the propper syntax",
46 return std::shared_ptr<VirtualStruct>();
49 bool handle_deleted =
false;
50 std::shared_ptr<VirtualStruct> ret =
allocate(handle,
51 [handle_deleted, handle, cleanup](
Field *f)
mutable
55 handle_deleted =
true;
62 const char *
const *name_array = names(handle);
65 while (name_array[apos] != 0)
69 parseName(name_array[apos], baseflags, flags, name);
uint64_t(* VirtualStruct_read)(void *handle, uint32_t index)
read the value of the field at the given index
void(* VirtualStruct_setListenerCallback)(void *handle, void *callbackHandle, void(*callback)(void *handle, void *callbackHandle, uint32_t index))
setter function to register the callback handle for listener supported fields.
void(* VirtualStruct_write)(void *handle, uint32_t index)
write the value of the field at the given index
const char *const *(* VirtualStruct_names)(void *handle)
must return an array of zero terminated strings.
const char *const *(* VirtualStruct_prettyNames)(void *handle)
similar to above array but with human readable/alternative field names (see etiss::VirtualStruct)
a Field instance represents e.g.
static const int W
write flag
static const int L
supports listener plugins; used for etiss::RegisterDevicePlugins to determine access to a variable/fi...
static const int P
private field: this flag indicates that this field is an implementation specific field that e....
static const int R
read flag
static std::shared_ptr< VirtualStruct > allocateFromC(void *handle, VirtualStruct_names names, VirtualStruct_prettyNames prettyNames_optional, VirtualStruct_read read_recommended, VirtualStruct_write write_optional, VirtualStruct_setListenerCallback setListenerCallback_optional, std::function< void(void *handle)> cleanup)
implemented in CVirtualStruct.cpp
static std::shared_ptr< VirtualStruct > allocate(void *structure, std::function< void(Field *)> delete_)
static void parseName(const char *cname, const int baseflags, unsigned &flags, std::string &name_)
void log(Verbosity level, std::string msg)
write log message at the given level.