Defines C++ API to serialize and deserialize object.
Defines
Defines Documentation
define EOSLIB_REFLECT
#define EOSLIB_REFLECT(TYPE, MEMBERS) EOSLIB_REFLECT_DERIVED( TYPE, BOOST_PP_SEQ_NIL, MEMBERS )
Specializes eosio::reflector for TYPE.
Perform class reflection
Parameters:
- TYPE - the class template to be reflected
- MEMBERS - a sequence of member names. (field1)(field2)(field3)
See also: EOSLIB_REFLECT_DERIVED
define EOSLIB_REFLECT_TEMPLATE
#define EOSLIB_REFLECT_TEMPLATE(TEMPLATE_ARGS, TYPE, MEMBERS) EOSLIB_REFLECT_DERIVED_TEMPLATE( TEMPLATE_ARGS, TYPE, BOOST_PP_SEQ_NIL, MEMBERS )
Perform class template reflection.
Perform class template reflection
Parameters:
- TEMPLATE_ARGS - a sequence of template args. (args1)(args2)(args3)
- TYPE - the class template to be reflected
- MEMBERS - a sequence of member names. (field1)(field2)(field3)
define EOSLIB_REFLECT_EMPTY
#define EOSLIB_REFLECT_EMPTY(TYPE) EOSLIB_REFLECT_DERIVED( TYPE, BOOST_PP_SEQ_NIL, BOOST_PP_SEQ_NIL )
Perform class reflection on empty class.
Perform class reflection on empty class
Parameters:
- TYPE - the class to be reflected
define EOSLIB_REFLECT_FWD
#define EOSLIB_REFLECT_FWD(TYPE)\
namespace eosio { \
template<> struct reflector<TYPE> {\
typedef TYPE type; \
typedef eosio::true_type is_reflected; \
enum member_count_enum { \
local_member_count = BOOST_PP_SEQ_SIZE(MEMBERS), \
total_member_count = local_member_count BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_BASE_MEMBER_COUNT, +, INHERITS )\
}; \
template<typename Visitor> static void visit( Visitor&& v ); \
template<typename Visitor> static void visit( const type& t, Visitor&& v ); \
template<typename Visitor> static void visit( type& t, Visitor&& v ); \
}; }
Perform forward declaration of class reflection.
Perform forward declaration of class reflection
Parameters:
- TYPE - the class to be reflected
define EOSLIB_REFLECT_DERIVED
#define EOSLIB_REFLECT_DERIVED(TYPE, INHERITS, MEMBERS)\
namespace eosio { \
template<> struct reflector<TYPE> {\
typedef TYPE type; \
typedef eosio::true_type is_reflected; \
typedef eosio::false_type is_enum; \
enum member_count_enum { \
local_member_count = 0 BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_COUNT, +, MEMBERS ),\
total_member_count = local_member_count BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_BASE_MEMBER_COUNT, +, INHERITS )\
}; \
EOSLIB_REFLECT_DERIVED_IMPL_INLINE( TYPE, INHERITS, MEMBERS ) \
}; }
Specializes eosio::reflector for TYPE where type inherits other reflected classes.
Perform class reflection where TYPE inherits other reflected classes
Parameters:
- TYPE - the class to be reflected
- INHERITS - a sequence of base class names (basea)(baseb)(basec)
- MEMBERS - a sequence of member names. (field1)(field2)(field3)
define EOSLIB_REFLECT_DERIVED_TEMPLATE
#define EOSLIB_REFLECT_DERIVED_TEMPLATE(TEMPLATE_ARGS, TYPE, INHERITS, MEMBERS)\
namespace eosio { \
template<BOOST_PP_SEQ_ENUM(TEMPLATE_ARGS)> struct reflector<TYPE> {\
typedef TYPE type; \
typedef eosio::true_type is_defined; \
typedef eosio::false_type is_enum; \
enum member_count_enum { \
local_member_count = 0 BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_COUNT, +, MEMBERS ),\
total_member_count = local_member_count BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_BASE_MEMBER_COUNT, +, INHERITS )\
}; \
EOSLIB_REFLECT_DERIVED_IMPL_INLINE( TYPE, INHERITS, MEMBERS ) \
}; }
Perform class template reflection where TYPE inherits other reflected classes.
Perform class template reflection where TYPE inherits other reflected classes
Parameters:
- TEMPLATE_ARGS - a sequence of template args. (args1)(args2)(args3)
- TYPE - the class to be reflected
- INHERITS - a sequence of base class names (basea)(baseb)(basec)
- MEMBERS - a sequence of member names. (field1)(field2)(field3)
define EOSLIB_SERIALIZE
#define EOSLIB_SERIALIZE(TYPE, MEMBERS)\
template<typename DataStream> \
friend DataStream& operator << ( DataStream& ds, const TYPE& t ){ \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\
}\
template<typename DataStream> \
friend DataStream& operator >> ( DataStream& ds, TYPE& t ){ \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\
}
Defines serialization and deserialization for a class.
Defines serialization and deserialization for a class
Parameters:
- TYPE - the class to have its serialization and deserialization defined
- MEMBERS - a sequence of member names. (field1)(field2)(field3)
define EOSLIB_SERIALIZE_DERIVED
#define EOSLIB_SERIALIZE_DERIVED(TYPE, BASE, MEMBERS)\
template<typename DataStream> \
friend DataStream& operator << ( DataStream& ds, const TYPE& t ){ \
ds << static_cast<const BASE&>(t); \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, <<, MEMBERS );\
}\
template<typename DataStream> \
friend DataStream& operator >> ( DataStream& ds, TYPE& t ){ \
ds >> static_cast<BASE&>(t); \
return ds BOOST_PP_SEQ_FOR_EACH( EOSLIB_REFLECT_MEMBER_OP, >>, MEMBERS );\
}
Defines serialization and deserialization for a class which inherits from other classes that have their serialization and deserialization defined.
Defines serialization and deserialization for a class which inherits from other classes that have their serialization and deserialization defined
Parameters:
- TYPE - the class to have its serialization and deserialization defined
- BASE - a sequence of base class names (basea)(baseb)(basec)
- MEMBERS - a sequence of member names. (field1)(field2)(field3)