BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
40 void reset( uint8_t s, uint8_t t, uint64_t i )
51 explicit operator uint64_t()
const {
return number; }
65 template<
typename T >
72 template<
typename T >
78 explicit operator std::string()
const
90 template<
typename ObjectID>
93 #define MAP_OBJECT_ID_TO_TYPE(OBJECT) \
94 namespace graphene { namespace db { \
96 struct object_downcast<const graphene::db::object_id<OBJECT::space_id, \
97 OBJECT::type_id>&> { using type = OBJECT; }; \
99 template<
typename ObjectID>
102 template<u
int8_t SpaceID, u
int8_t TypeID>
131 FC_ASSERT(
id.is<std::remove_reference_t<decltype(*
this)>>(),
"space or type mismatch" );
151 template<
typename DB>
152 auto operator()(
const DB& db)
const ->
const decltype(db.get(*
this))& {
return db.get(*
this); }
172 explicit operator std::string()
const
186 template<u
int8_t SpaceID, u
int8_t TypeID>
191 static std::string _str = string(
"graphene::db::object_id<") +
fc::to_string(SpaceID) +
":"
197 template<u
int8_t SpaceID, u
int8_t TypeID>
207 local_member_count = 1,
208 total_member_count = 1
210 template<
typename Visitor>
211 static inline void visit(
const Visitor& visitor )
213 using member_type = decltype(((
type*)
nullptr)->instance);
214 visitor.TEMPLATE operator()<member_type,
type,&type::instance>(
"instance" );
217 namespace member_names {
218 template<u
int8_t S, u
int8_t T>
225 vo = std::string( var );
231 auto first_dot = s.find(
'.');
232 FC_ASSERT( first_dot != std::string::npos,
"Missing the first dot" );
233 FC_ASSERT( first_dot != 0,
"Missing the space part" );
234 auto second_dot = s.find(
'.',first_dot+1);
235 FC_ASSERT( second_dot != std::string::npos,
"Missing the second dot" );
236 FC_ASSERT( second_dot != first_dot+1,
"Missing the type part" );
239 auto type_id =
fc::to_uint64( s.substr( first_dot+1, (second_dot-first_dot)-1 ) );
242 vo.
reset(
static_cast<uint8_t
>(space_id),
static_cast<uint8_t
>(type_id), instance );
245 template<u
int8_t SpaceID, u
int8_t TypeID>
248 vo = std::string( var );
251 template<u
int8_t SpaceID, u
int8_t TypeID>
255 auto first_dot = s.find(
'.');
256 FC_ASSERT( first_dot != std::string::npos,
"Missing the first dot" );
257 FC_ASSERT( first_dot != 0,
"Missing the space part" );
258 auto second_dot = s.find(
'.',first_dot+1);
259 FC_ASSERT( second_dot != std::string::npos,
"Missing the second dot" );
260 FC_ASSERT( second_dot != first_dot+1,
"Missing the type part" );
262 fc::to_uint64( s.substr( first_dot+1, (second_dot-first_dot)-1 ) ) == TypeID,
263 "Space.Type.0 (${SpaceID}.${TypeID}.0) doesn't match expected value ${var}",
264 (
"TypeID",TypeID)(
"SpaceID",SpaceID)(
"var",var) );
272 template <>
struct hash<
graphene::db::object_id_type>
276 return std::hash<uint64_t>()(x.
number);
friend bool operator>(const object_id &a, const object_id &b)
friend bool operator!=(const object_id_type &a, const object_id_type &b)
#define FC_CAPTURE_AND_RETHROW(...)
friend bool operator!=(const object_id &a, const object_id &b)
friend object_id_type operator+(const object_id_type &a, int64_t delta)
static constexpr uint8_t type_id
friend object_id operator+(const object_id &a, int64_t delta)
typename object_downcast< ObjectID >::type object_downcast_t
std::string to_string(double)
object_id & operator=(const object_id_type &o)
object_id_type & operator++()
static constexpr uint16_t space_type
auto operator()(const DB &db) const -> const decltype(db.get(*this))&
This template is used to downcast a generic object type to a specific xyz_object type.
static const char * name()
friend bool operator>(const object_id_type &a, const object_id_type &b)
const std::string & get_string() const
friend bool operator<(const object_id &a, const object_id &b)
fc::unsigned_int instance
void from_variant(const variant &var, flat_set< T, A... > &vo, uint32_t _max_depth)
static constexpr uint8_t type_bits
static constexpr uint64_t max_instance
void reset(uint8_t s, uint8_t t, uint64_t i)
static constexpr uint8_t space_id
uint64_t instance() const
static constexpr uint64_t max_instance
object_id(const fc::unsigned_int &i)
friend size_t hash_value(const object_id &v)
friend bool operator==(const object_id_type &a, const object_id_type &b)
static void visit(const Visitor &visitor)
A template which stores the name of the native member at a given index in a given class.
uint16_t space_type() const
void to_variant(const flat_set< T, A... > &var, variant &vo, uint32_t _max_depth)
uint64_t to_uint64(const std::string &)
constexpr static const char * value
maintains a set of indexed objects that can be modified with multi-level rollback support
std::true_type is_defined
object_id_type(uint8_t s, uint8_t t, uint64_t i)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
static constexpr uint64_t one_byte_mask
typelist::list<> native_members
A typelist with a field_reflection for each native member (non-inherited) of the struct.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Defines exception's used by fc.
friend bool operator<(const object_id_type &a, const object_id_type &b)
friend size_t hash_value(const object_id_type &v)
friend bool operator==(const object_id &a, const object_id &b)
static constexpr uint8_t instance_bits
defines visit functions for T Unless this is specialized, visit() will not be defined for T.
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
static constexpr uint8_t type_and_instance_bits
static constexpr uint8_t instance_bits
size_t operator()(const graphene::db::object_id_type &x) const
object_id(const object_id_type &id)
static constexpr object_id max()
base for all database objects