35 #ifndef _Wolframe_SERIALIZE_STRUCT_DESCRIPTION_HPP_INCLUDED
36 #define _Wolframe_SERIALIZE_STRUCT_DESCRIPTION_HPP_INCLUDED
52 template <
class Structure>
63 template <
typename Element>
69 std::size_t pp = (std::size_t)&(((Structure*)0)->*eptr);
74 std::ostringstream err;
75 err <<
"duplicate definition of " << tag <<
" in structure";
76 throw std::runtime_error( err.str().c_str());
85 if (
last().
optional())
throw std::logic_error(
"ambiguous mandatory/optional declaration");
93 if (
last().
mandatory())
throw std::logic_error(
"ambiguous mandatory/optional declaration");
109 struct StructureShell :
public Structure
111 void*
operator new( std::size_t num_bytes,
void* obj)
throw (std::bad_alloc)
113 if (
sizeof(StructureShell) != num_bytes)
throw std::bad_alloc();
119 new (obj) StructureShell();
122 catch (
const std::exception&)
131 ((Structure*)obj)->~Structure();
135 template <
class Element>
141 typ =
typeid(Element).name();
143 catch (std::bad_typeid)
Fetch fetch() const
Non intrusive serializer call (fetch the next element) function of this sructure. ...
Definition: structDescriptionBase.hpp:72
static StructDescriptionBase::ElementType type()
Definition: intrusiveProperty.hpp:54
Defines the intrusive implementation of the serialization of structures.
ElementType type() const
Get the element kind (type of access) of this structure or atomic element.
Definition: structDescriptionBase.hpp:123
ElementType
Type of a structure element.
Definition: structDescriptionBase.hpp:56
no explicit condition
Definition: structDescriptionBase.hpp:78
static const char * getTypename()
Get the name of the type 'Element' if available.
Definition: structDescription.hpp:136
StructDescriptionBase & last()
Definition: structDescriptionBase.hpp:186
defines the type traits for the intrusive part of serialization/deserialization
Base class for structure description used for introspection in serialization/deserialization.
Definition: structDescriptionBase.hpp:51
forward declaration
Definition: intrusiveParser.hpp:55
Map::const_iterator end() const
Get the end iterator on the elements of this structure.
Definition: structDescriptionBase.hpp:138
Maps the traits based on structure element type properties to an enumeration value.
Definition: intrusiveProperty.hpp:44
StructDescription & operator()(const char *tag, Element Structure::*eptr)
Operator to build the structure description element by element.
Definition: structDescription.hpp:64
static void destructor(void *obj)
Destroy an object of this kind allocated with 'constructor(void*)' at the location 'obj'...
Definition: structDescription.hpp:129
StructDescription & optional()
Define the last structure element defined to be optional always (independent of validation mode) ...
Definition: structDescription.hpp:91
Defines the intrusive implementation of the deserialization of objects interfaced as TypedInputFilter...
void requirement(ElementRequirement requirement_)
Set element occurrence requirement.
Definition: structDescriptionBase.hpp:183
forward declaration
Definition: intrusiveSerializer.hpp:52
bool(* Parse)(langbind::TypedInputFilter &flt, Context &ctx, ParseStateStack &stk)
Definition: structDescriptionBase.hpp:64
static bool constructor(void *obj)
Construct an object of this kind at an allocated location (with base pointer 'obj') ...
Definition: structDescription.hpp:106
Parse parse() const
Non intrusive parser call function of this sructure.
Definition: structDescriptionBase.hpp:70
Map::const_iterator find(const std::string &name) const
Find an element in this structure by name.
void defineEndOfAttributes()
Define the number of attributes of a struct.
Definition: structDescriptionBase.hpp:158
Intrusive description of a filter/form map.
Definition: structDescription.hpp:53
StructDescription & mandatory()
Define the last structure element defined to be mandatory always (independent of validation mode) ...
Definition: structDescription.hpp:83
Defines the intrusive implementation of some parsing element properties.
element is always mandatory, even if structure is filled and validated in "relaxed" mode ...
Definition: structDescriptionBase.hpp:79
StructDescription()
Constructor.
Definition: structDescription.hpp:56
void define(const std::string &name, const StructDescriptionBase &dd)
Define an element of this structure.
Definition: structDescriptionBase.hpp:142
StructDescription & operator--(int)
Define the elements defined until now to be attributes and the subsequent elements defined to be cont...
Definition: structDescription.hpp:99
Defines the non intrusive base class of serialization/deserialization of objects interfaced as TypedI...
element is always optional, even if structure is filled and validated in "strict" mode ...
Definition: structDescriptionBase.hpp:80
bool(* Fetch)(Context &ctx, SerializeStateStack &stk)
Definition: structDescriptionBase.hpp:65