object_id.hpp: Add is<T>() and as<T>() template functions to object_id_type

This commit is contained in:
theoreticalbts 2015-09-24 12:55:10 -04:00
parent 83b4edf870
commit 1fb327f6a0

View file

@ -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<T>() );
return T( *this );
}
uint64_t number;
};