25 #include <boost/multiprecision/integer.hpp> 30 #define MAX_NESTING (200) 65 object( uint8_t space_id, uint8_t type_id ) :
id( space_id, type_id, 0 ) {}
73 virtual std::unique_ptr<object>
clone()
const = 0;
74 virtual void move_from(
object& obj ) = 0;
76 virtual std::vector<char>
pack()
const = 0;
87 template<
typename DerivedClass>
92 std::unique_ptr<object>
clone()
const override 94 return std::make_unique<DerivedClass>( *
static_cast<const DerivedClass*
>(
this) );
99 static_cast<DerivedClass&
>(*this) = std::move( static_cast<DerivedClass&>(obj) );
103 std::vector<char>
pack()
const override {
return fc::raw::pack( static_cast<const DerivedClass&>(*
this) ); }
106 template<
typename DerivedClass, u
int8_t SpaceID, u
int8_t TypeID>
110 static constexpr uint8_t space_id = SpaceID;
111 static constexpr uint8_t type_id = TypeID;
122 template<
typename DerivedClass>
129 auto itr = annotations.find(annotation_id_space);
130 if( itr != annotations.end() )
return itr->second;
135 annotations[
id.space()] =
id;
149 namespace boost {
namespace multiprecision {
namespace detail {
150 template<
typename To>
151 struct is_restricted_conversion<graphene::
db::object,To> :
public mpl::true_ {};
std::vector< char > pack() const override
void pack(Stream &s, const flat_set< T, A... > &value, uint32_t _max_depth)
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
fc::flat_map< uint8_t, object_id_type > annotation_map
std::unique_ptr< object > clone() const override
annotation_map annotations
virtual fc::variant to_variant() const =0
FC_REFLECT_TYPENAME(fc::log_message)
virtual ~object()=default
object_id< SpaceID, TypeID > get_id() const
void set_annotation(object_id_type id)
fc::variant to_variant() const override
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
object(uint8_t space_id, uint8_t type_id)
Use the Curiously Recurring Template Pattern to automatically add the ability to clone, serialize, and move objects polymorphically.
An object that is easily extended by providing pointers to other objects, one for each space...
virtual std::vector< char > pack() const =0
virtual void move_from(object &obj)=0
#define FC_REFLECT_DERIVED_TEMPLATE(TEMPLATE_ARGS, TYPE, INHERITS, MEMBERS)
object_id_type get_annotation(uint8_t annotation_id_space) const
virtual std::unique_ptr< object > clone() const =0
base for all database objects
void move_from(object &obj) override