48 static void parseName(
const char *cname,
const int baseflags,
unsigned &flags, std::string &name_)
55 std::string name(cname);
56 size_t ppos = name.find(
'.');
57 if (ppos == std::string::npos)
60 "etiss::VirtualStruct::allocateFromC encountered an invalid field name. flags cannot be parsed and "
61 "will be set to private. check the documentation of VirtualStruct_names for the propper syntax",
82 return std::shared_ptr<VirtualStruct>();
85 bool handle_deleted =
false;
86 std::shared_ptr<VirtualStruct> ret =
allocate(handle, [handle_deleted, handle, cleanup](
Field *f)
mutable {
89 handle_deleted =
true;
96 const char *
const *name_array = names(handle);
99 while (name_array[apos] != 0)
103 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
const char *const *(* VirtualStruct_prettyNames)(void *handle)
similar to above array but with human readable/alternative field names (see etiss::VirtualStruct)
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.
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_)
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
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.