diff --git a/libraries/db/include/graphene/db/object_id.hpp b/libraries/db/include/graphene/db/object_id.hpp index eb784f90..00a616e6 100644 --- a/libraries/db/include/graphene/db/object_id.hpp +++ b/libraries/db/include/graphene/db/object_id.hpp @@ -67,6 +67,19 @@ namespace graphene { namespace db { return a.number < b.number; } + template< typename T > + bool is() const + { + return (number >> 48) == ((T::space_id << 8) | (T::type_id)); + } + + template< typename T > + T as() const + { + FC_ASSERT( is() ); + return T( *this ); + } + uint64_t number; };