12 #ifndef SPROCKIT_COMMON_MESSAGES_SERIALIZABLE_H_INCLUDED 13 #define SPROCKIT_COMMON_MESSAGES_SERIALIZABLE_H_INCLUDED 22 #define ImplementVirtualSerializable(obj) \ 24 obj(cxn_flag_t flag){} 26 #define NotSerializable(obj) \ 30 spkt_throw_printf(sprockit::illformed_error, \ 31 "type %s should not be serialized", \ 35 serialize_order(sprockit::serializer& sst){ \ 44 construct_deserialize_stub() { \ 54 you_forgot_to_add_ImplementSerializable_to_this_class() { \ 58 #define ImplementSerializableDefaultConstructor(obj) \ 66 return ::sprockit::serializable_builder_impl< obj >::static_cls_id(); \ 69 construct_deserialize_stub() { \ 73 you_forgot_to_add_ImplementSerializable_to_this_class() { \ 77 #define ImplementSerializable(obj) \ 79 ImplementSerializableDefaultConstructor(obj) 110 return T::construct_deserialize_stub();
135 return (
typeid(T) ==
typeid(*ser));
143 typedef spkt_unordered_map<long, serializable_builder*>
builder_map;
148 get_serializable(uint32_t
cls_id);
158 return (*builders_)[
cls_id]->sanity(ser);
175 #define DeclareSerializable(...) static const char * static_cls_name()
static uint32_t add_builder(serializable_builder *builder, const char *name)
virtual uint32_t cls_id() const =0
static bool sanity(serializable *ser, uint32_t cls_id)
static const char * name_
virtual ~serializable_builder()
virtual bool sanity(serializable *ser)=0
static builder_map * builders_
static const uint32_t cls_id_
spkt_unordered_map< long, serializable_builder * > builder_map
const char * name() const
static uint32_t static_cls_id()
virtual const char * name() const =0
bool sanity(serializable *ser)
virtual serializable * build() const =0
serializable * build() const