BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Public Types | Public Member Functions | List of all members
graphene::db::primary_index< DerivedIndex, DirectBits > Class Template Reference

Wraps a derived index to intercept calls to create, modify, and remove so that callbacks may be fired and undo state saved. More...

#include <index.hpp>

Inheritance diagram for graphene::db::primary_index< DerivedIndex, DirectBits >:
graphene::db::base_primary_index

Public Types

typedef DerivedIndex::object_type object_type
 

Public Member Functions

 primary_index (object_database &db)
 
virtual uint8_t object_space_id () const override
 
virtual uint8_t object_type_id () const override
 
virtual object_id_type get_next_id () const override
 
virtual void use_next_id () override
 
virtual void set_next_id (object_id_type id) override
 
virtual const objectfind (object_id_type id) const override
 
fc::sha256 get_object_version () const
 
virtual void open (const path &db) override
 
virtual void save (const path &db) override
 
virtual const objectload (const std::vector< char > &data) override
 
virtual const objectcreate (const std::function< void(object &)> &constructor) override
 
virtual const objectinsert (object &&obj) override
 
virtual void remove (const object &obj) override
 
virtual void modify (const object &obj, const std::function< void(object &)> &m) override
 
virtual void add_observer (const shared_ptr< index_observer > &o) override
 
virtual void object_from_variant (const fc::variant &var, object &obj, uint32_t max_depth) const override
 
virtual void object_default (object &obj) const override
 
- Public Member Functions inherited from graphene::db::base_primary_index
 base_primary_index (object_database &db)
 
void save_undo (const object &obj)
 
void on_add (const object &obj)
 
void on_remove (const object &obj)
 
void on_modify (const object &obj)
 
template<typename T , typename... Args>
T * add_secondary_index (Args...args)
 
template<typename T >
const T & get_secondary_index () const
 

Additional Inherited Members

- Protected Attributes inherited from graphene::db::base_primary_index
vector< shared_ptr< index_observer > > _observers
 
vector< unique_ptr< secondary_index > > _sindex
 

Detailed Description

template<typename DerivedIndex, uint8_t DirectBits = 0>
class graphene::db::primary_index< DerivedIndex, DirectBits >

Wraps a derived index to intercept calls to create, modify, and remove so that callbacks may be fired and undo state saved.

See also
http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern

Definition at line 309 of file index.hpp.

Member Typedef Documentation

template<typename DerivedIndex, uint8_t DirectBits = 0>
typedef DerivedIndex::object_type graphene::db::primary_index< DerivedIndex, DirectBits >::object_type

Definition at line 312 of file index.hpp.

Constructor & Destructor Documentation

template<typename DerivedIndex, uint8_t DirectBits = 0>
graphene::db::primary_index< DerivedIndex, DirectBits >::primary_index ( object_database db)
inline

Definition at line 314 of file index.hpp.

Member Function Documentation

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::add_observer ( const shared_ptr< index_observer > &  o)
inlineoverridevirtual

Definition at line 425 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual const object& graphene::db::primary_index< DerivedIndex, DirectBits >::create ( const std::function< void(object &)> &  constructor)
inlineoverridevirtual

Definition at line 388 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual const object* graphene::db::primary_index< DerivedIndex, DirectBits >::find ( object_id_type  id) const
inlineoverridevirtual
Returns
the object with id or nullptr if not found

Definition at line 332 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual object_id_type graphene::db::primary_index< DerivedIndex, DirectBits >::get_next_id ( ) const
inlineoverridevirtual

Definition at line 327 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
fc::sha256 graphene::db::primary_index< DerivedIndex, DirectBits >::get_object_version ( ) const
inline

Definition at line 339 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual const object& graphene::db::primary_index< DerivedIndex, DirectBits >::insert ( object &&  obj)
inlineoverridevirtual

Definition at line 397 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual const object& graphene::db::primary_index< DerivedIndex, DirectBits >::load ( const std::vector< char > &  data)
inlineoverridevirtual

Definition at line 379 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::modify ( const object obj,
const std::function< void(object &)> &  m 
)
inlineoverridevirtual

Definition at line 414 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::object_default ( object obj) const
inlineoverridevirtual

Definition at line 439 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::object_from_variant ( const fc::variant var,
object obj,
uint32_t  max_depth 
) const
inlineoverridevirtual

Definition at line 430 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual uint8_t graphene::db::primary_index< DerivedIndex, DirectBits >::object_space_id ( ) const
inlineoverridevirtual

Definition at line 321 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual uint8_t graphene::db::primary_index< DerivedIndex, DirectBits >::object_type_id ( ) const
inlineoverridevirtual

Definition at line 324 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::open ( const path db)
inlineoverridevirtual

Definition at line 345 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::remove ( const object obj)
inlineoverridevirtual

Definition at line 406 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::save ( const path db)
inlineoverridevirtual

Definition at line 364 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::set_next_id ( object_id_type  id)
inlineoverridevirtual

Definition at line 329 of file index.hpp.

template<typename DerivedIndex, uint8_t DirectBits = 0>
virtual void graphene::db::primary_index< DerivedIndex, DirectBits >::use_next_id ( )
inlineoverridevirtual

Definition at line 328 of file index.hpp.


The documentation for this class was generated from the following file: