1#include "reflection_handler.h"
4#include <cgv/type/info/type_name.h>
5#include <cgv/utils/convert.h>
7#include <cgv/type/traits/method_pointer.h>
8#include <cgv/type/info/type_id.h>
28 return gk == GK_VECTOR || gk == GK_ARRAY;
32 const std::string& group_name,
48 case GT_TERMINATE :
return "terminate";
49 case GT_SKIP :
return "skip";
50 case GT_COMPLETE :
return "complete";
57 static const char* names[] = {
"no group",
"base class",
"struct",
"vector",
"array",
"pointer" };
85 if (grp_tra == GT_TERMINATE || grp_tra == GT_SKIP)
88 if (grp_tra == GT_COMPLETE)
91 if (grp_tra >= 0 && grp_tra < (
int)grp_size)
94 std::cerr <<
"invalid access to " <<
group_kind_name(group_kind) <<
" " << group_name <<
": index "
95 << grp_tra <<
" out of range [0," << grp_size <<
"[" << std::endl;
int reflect_array_begin(GroupKind group_kind, const std::string &group_name, void *group_ptr, abst_reflection_traits *rt, unsigned grp_size)
type independent functionality of array reflection
virtual bool is_creative() const
give information on whether reflection_handler creates object (defaults to false)
virtual void reflect_group_end(GroupKind group_kind)
abstract interface to terminate reflection of a group of members
static std::string group_traversal_name(GroupTraversal gt)
return the group traversals as a string
GroupTraversal process_structural_group_begin(GroupKind gk, const std::string &member_name, GroupTraversal gt)
type independent part of the reflect_group method that starts the group traversal
virtual ~reflection_handler()
declare virtual destructor
virtual int reflect_group_begin(GroupKind group_kind, const std::string &group_name, void *group_ptr, abst_reflection_traits *rt, unsigned grp_size=-1)
abstract interface to start reflection of a group of members.
std::vector< nesting_info > nesting_info_stack
stack of nesting_info used during the reflection process
GroupKind
different support group types
static bool is_array_kind(GroupKind gk)
check whether a group kind is of array or vector kind
static const char * group_kind_name(GroupKind gk)
return the group kind as a string
GroupTraversal
@ basic types with helper functions
bool group_end(GroupKind gk)
updates the nesting info at the end of group and always returns true
std::string to_string(const std::string &v, unsigned int w, unsigned int p, bool)
specialization of conversion from string to strings
Helper functions to process enum declarations from strings.
abstract interface for type reflection with basic type management and optional string conversion
for each nesting during traversal a nesting info is pushed back to the end of the nesting info stack