cgv
Loading...
Searching...
No Matches
cgv::data::io_reflection_handler Class Reference

common base for all io reflection handlers More...

#include <io_reflection_handler.h>

Inheritance diagram for cgv::data::io_reflection_handler:
cgv::reflect::reflection_handler cgv::data::ascii_reflection_handler cgv::data::binary_reflection_handler cgv::data::ascii_read_reflection_handler cgv::data::ascii_write_reflection_handler cgv::data::binary_read_reflection_handler cgv::data::binary_write_reflection_handler

Public Member Functions

 io_reflection_handler (const std::string &_content, unsigned _ver)
 
bool failed () const
 
IOReflectionError get_error_code () const
 
bool reflect_method_void (const std::string &method_name, cgv::reflect::method_interface *mi_ptr, cgv::reflect::abst_reflection_traits *return_traits, const std::vector< cgv::reflect::abst_reflection_traits * > &param_value_traits)
 abstract interface to reflect a method, where return and parameter types are specified as strings.
 
- Public Member Functions inherited from cgv::reflect::reflection_handler
virtual bool is_creative () const
 give information on whether reflection_handler creates object (defaults to false)
 
template<typename T >
bool reflect_member (const std::string &member_name, T &member_ref, bool hard_cast=false)
 call this to reflect a member by member name and reference to the member.
 
template<typename M >
bool reflect_method (const std::string &method_name, M m)
 call this to reflect a method by method name and reference to the member.
 
template<typename B >
bool reflect_base (B &base_ref)
 reflect a base class with its members
 
template<typename T , unsigned n>
bool reflect_member (const std::string &member_name, T(&member_ref)[n])
 reflect a member of constant size array type
 
template<typename T >
bool reflect_member (const std::string &member_name, std::vector< T > &member_ref)
 reflect a member of vector type
 
template<typename T >
bool reflect_member (const std::string &member_name, T *&member_ref)
 reflect a member of pointer type.
 
template<typename T , typename S >
bool reflect_array (const std::string &member_name, T *&member_ref, S &size)
 reflect a dynamic array member of vector type
 
virtual ~reflection_handler ()
 declare virtual destructor
 

Static Public Member Functions

static std::string get_error_message (IOReflectionError ae)
 
- Static Public Member Functions inherited from cgv::reflect::reflection_handler
static std::string group_traversal_name (GroupTraversal gt)
 return the group traversals as a string
 
static const char * group_kind_name (GroupKind gk)
 return the group kind as a string
 
static bool is_array_kind (GroupKind gk)
 check whether a group kind is of array or vector kind
 

Protected Attributes

unsigned version
 
std::string file_content
 
bool in_header
 
IOReflectionError last_error
 
- Protected Attributes inherited from cgv::reflect::reflection_handler
std::vector< nesting_infonesting_info_stack
 stack of nesting_info used during the reflection process
 

Additional Inherited Members

- Public Types inherited from cgv::reflect::reflection_handler
enum  GroupTraversal { GT_TERMINATE = -3 , GT_SKIP = -2 , GT_COMPLETE = -1 }
 @ basic types with helper functions More...
 
enum  GroupKind {
  GK_NO_GROUP , GK_BASE_CLASS , GK_STRUCTURE , GK_VECTOR ,
  GK_ARRAY , GK_POINTER
}
 different support group types More...
 
- Protected Member Functions inherited from cgv::reflect::reflection_handler
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
 
bool group_end (GroupKind gk)
 updates the nesting info at the end of group and always returns true
 
template<typename T , typename RT , typename D >
bool self_reflect_member (const std::string &member_name, T &member_ref, const RT &, const D &, bool hard_cast)
 implementation of reflection with internal or external self_reflect function
 
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 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.
 
virtual void reflect_group_end (GroupKind group_kind)
 abstract interface to terminate reflection of a group of members
 
virtual bool reflect_member_void (const std::string &member_name, void *member_ptr, abst_reflection_traits *rt)=0
 abstract interface to reflect a member variable, where the member type is specified as a string.
 

Detailed Description

common base for all io reflection handlers

Definition at line 18 of file io_reflection_handler.h.

Constructor & Destructor Documentation

◆ io_reflection_handler()

cgv::data::io_reflection_handler::io_reflection_handler ( const std::string &  _content,
unsigned  _ver 
)

Definition at line 13 of file io_reflection_handler.cxx.

Member Function Documentation

◆ failed()

bool cgv::data::io_reflection_handler::failed ( ) const

Definition at line 22 of file io_reflection_handler.cxx.

◆ get_error_code()

IOReflectionError cgv::data::io_reflection_handler::get_error_code ( ) const

Definition at line 27 of file io_reflection_handler.cxx.

◆ get_error_message()

std::string cgv::data::io_reflection_handler::get_error_message ( IOReflectionError  ae)
static

Definition at line 32 of file io_reflection_handler.cxx.

◆ reflect_method_void()

bool cgv::data::io_reflection_handler::reflect_method_void ( const std::string &  method_name,
cgv::reflect::method_interface mi_ptr,
cgv::reflect::abst_reflection_traits return_traits,
const std::vector< cgv::reflect::abst_reflection_traits * > &  param_value_traits 
)
virtual

abstract interface to reflect a method, where return and parameter types are specified as strings.

Returns whether to continue the reflection.

Implements cgv::reflect::reflection_handler.

Definition at line 47 of file io_reflection_handler.cxx.

Member Data Documentation

◆ file_content

std::string cgv::data::io_reflection_handler::file_content
protected

Definition at line 23 of file io_reflection_handler.h.

◆ in_header

bool cgv::data::io_reflection_handler::in_header
protected

Definition at line 25 of file io_reflection_handler.h.

◆ last_error

IOReflectionError cgv::data::io_reflection_handler::last_error
protected

Definition at line 26 of file io_reflection_handler.h.

◆ version

unsigned cgv::data::io_reflection_handler::version
protected

Definition at line 22 of file io_reflection_handler.h.


The documentation for this class was generated from the following files: