Base class for structure description used for introspection in serialization/deserialization. More...
#include <structDescriptionBase.hpp>
Public Types | |
enum | ElementType { Atomic, Struct, Vector } |
Type of a structure element. More... | |
enum | ElementRequirement { NoRequirement, Mandatory, Optional } |
Constraints definition of a structure element. More... | |
typedef std::vector< std::pair < std::string, StructDescriptionBase > > | Map |
typedef bool(* | Parse )(langbind::TypedInputFilter &flt, Context &ctx, ParseStateStack &stk) |
typedef bool(* | Fetch )(Context &ctx, SerializeStateStack &stk) |
typedef bool(* | Constructor )(void *obj) |
typedef void(* | Destructor )(void *obj) |
Public Member Functions | |
Parse | parse () const |
Non intrusive parser call function of this sructure. More... | |
Fetch | fetch () const |
Non intrusive serializer call (fetch the next element) function of this sructure. More... | |
StructDescriptionBase (Constructor c, Destructor d, const char *tn, std::size_t os, std::size_t sz, ElementType t, Parse pa, Fetch pr, ElementRequirement req_) | |
Constructor. More... | |
StructDescriptionBase (const char *tn, std::size_t os, std::size_t sz, ElementType t, Parse pa, Fetch pr, ElementRequirement req_) | |
Constructor. More... | |
StructDescriptionBase (const StructDescriptionBase &o) | |
Copy constructor. More... | |
StructDescriptionBase () | |
Default constructor. More... | |
bool | parse (void *obj, langbind::TypedInputFilter &in, Context &ctx, ParseStateStack &stk) const |
Call of parser of the serialization passed to fill an object and validate the serialization sequence. More... | |
bool | setAtomicValue (void *obj, std::size_t idx, const std::string &value) const |
Initializes an atomic element in a structure. More... | |
bool | init (void *obj) const |
Initialize the structure referenced with 'obj'. More... | |
void | done (void *obj) const |
Destroy the structure referenced with 'obj'. More... | |
std::size_t | size () const |
Get the allocation size of this structure in bytes. More... | |
std::size_t | ofs () const |
Get the offset of this structure inside the holding parent structure. More... | |
ElementType | type () const |
Get the element kind (type of access) of this structure or atomic element. More... | |
Map::const_iterator | find (const std::string &name) const |
Find an element in this structure by name. More... | |
Map::const_iterator | find_cis (const std::string &name) const |
Case insensitive find an element in this structure by name. More... | |
std::string | names (const char *sep) const |
Return the element names of this structure as string for error messages. More... | |
Map::const_iterator | begin () const |
Get the start iterator on the elements of this structure. More... | |
Map::const_iterator | end () const |
Get the end iterator on the elements of this structure. More... | |
void | define (const std::string &name, const StructDescriptionBase &dd) |
Define an element of this structure. More... | |
std::size_t | nof_attributes () const |
Get the number of attributes of a struct. More... | |
void | defineEndOfAttributes () |
Define the number of attributes of a struct. More... | |
std::size_t | nof_elements () const |
Get the number of elements in the structure or array. More... | |
const char * | typeName () const |
Get the type name of this structure. More... | |
bool | mandatory () const |
Find out if the element in the structure is mandatory. More... | |
bool | optional () const |
Find out if the element in the structure is optional. More... | |
void | requirement (ElementRequirement requirement_) |
Set element occurrence requirement. More... | |
Protected Member Functions | |
StructDescriptionBase & | last () |
Private Attributes | |
Constructor | m_constructor |
Destructor | m_destructor |
const char * | m_typename |
std::size_t | m_ofs |
std::size_t | m_size |
std::size_t | m_nof_attributes |
Map | m_elem |
ElementType | m_type |
Parse | m_parse |
Fetch | m_fetch |
ElementRequirement | m_requirement |
Base class for structure description used for introspection in serialization/deserialization.
typedef bool(* _Wolframe::serialize::StructDescriptionBase::Constructor)(void *obj) |
typedef void(* _Wolframe::serialize::StructDescriptionBase::Destructor)(void *obj) |
typedef bool(* _Wolframe::serialize::StructDescriptionBase::Fetch)(Context &ctx, SerializeStateStack &stk) |
typedef std::vector<std::pair<std::string,StructDescriptionBase> > _Wolframe::serialize::StructDescriptionBase::Map |
typedef bool(* _Wolframe::serialize::StructDescriptionBase::Parse)(langbind::TypedInputFilter &flt, Context &ctx, ParseStateStack &stk) |
_Wolframe::serialize::StructDescriptionBase::StructDescriptionBase | ( | Constructor | c, |
Destructor | d, | ||
const char * | tn, | ||
std::size_t | os, | ||
std::size_t | sz, | ||
ElementType | t, | ||
Parse | pa, | ||
Fetch | pr, | ||
ElementRequirement | req_ | ||
) |
Constructor.
_Wolframe::serialize::StructDescriptionBase::StructDescriptionBase | ( | const char * | tn, |
std::size_t | os, | ||
std::size_t | sz, | ||
ElementType | t, | ||
Parse | pa, | ||
Fetch | pr, | ||
ElementRequirement | req_ | ||
) |
Constructor.
_Wolframe::serialize::StructDescriptionBase::StructDescriptionBase | ( | const StructDescriptionBase & | o | ) |
Copy constructor.
_Wolframe::serialize::StructDescriptionBase::StructDescriptionBase | ( | ) |
Default constructor.
|
inline |
Get the start iterator on the elements of this structure.
|
inline |
Define an element of this structure.
|
inline |
Define the number of attributes of a struct.
|
inline |
Destroy the structure referenced with 'obj'.
|
inline |
Get the end iterator on the elements of this structure.
|
inline |
Non intrusive serializer call (fetch the next element) function of this sructure.
Map::const_iterator _Wolframe::serialize::StructDescriptionBase::find | ( | const std::string & | name | ) | const |
Find an element in this structure by name.
Map::const_iterator _Wolframe::serialize::StructDescriptionBase::find_cis | ( | const std::string & | name | ) | const |
Case insensitive find an element in this structure by name.
|
inline |
Initialize the structure referenced with 'obj'.
|
inlineprotected |
|
inline |
Find out if the element in the structure is mandatory.
std::string _Wolframe::serialize::StructDescriptionBase::names | ( | const char * | sep | ) | const |
Return the element names of this structure as string for error messages.
|
inline |
Get the number of attributes of a struct.
|
inline |
Get the number of elements in the structure or array.
|
inline |
Get the offset of this structure inside the holding parent structure.
|
inline |
Find out if the element in the structure is optional.
|
inline |
Non intrusive parser call function of this sructure.
bool _Wolframe::serialize::StructDescriptionBase::parse | ( | void * | obj, |
langbind::TypedInputFilter & | in, | ||
Context & | ctx, | ||
ParseStateStack & | stk | ||
) | const |
Call of parser of the serialization passed to fill an object and validate the serialization sequence.
|
inline |
Set element occurrence requirement.
bool _Wolframe::serialize::StructDescriptionBase::setAtomicValue | ( | void * | obj, |
std::size_t | idx, | ||
const std::string & | value | ||
) | const |
Initializes an atomic element in a structure.
|
inline |
Get the allocation size of this structure in bytes.
|
inline |
Get the element kind (type of access) of this structure or atomic element.
|
inline |
Get the type name of this structure.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Copyright © 2014 - Project Wolframe - All Rights Reserved