BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet 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

using object_type = typename DerivedIndex::object_type
 

Public Member Functions

 primary_index (object_database &db)
 
uint8_t object_space_id () const override
 
uint8_t object_type_id () const override
 
object_id_type get_next_id () const override
 
void use_next_id () override
 
void set_next_id (object_id_type id) override
 
const objectfind (object_id_type id) const override
 
fc::sha256 get_object_version () const
 
void open (const fc::path &db) override
 
void save (const fc::path &db) override
 
const objectload (const std::vector< char > &data) override
 
const objectcreate (const std::function< void(object &)> &constructor) override
 
const objectinsert (object &&obj) override
 
void remove (const object &obj) override
 
void modify (const object &obj, const std::function< void(object &)> &m) override
 
void add_observer (const std::shared_ptr< index_observer > &o) override
 
void object_from_variant (const fc::variant &var, object &obj, uint32_t max_depth) const override
 
void object_default (object &obj) const override
 
- Public Member Functions inherited from graphene::db::base_primary_index
 base_primary_index (object_database &db)
 
virtual ~base_primary_index ()=default
 
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
std::vector< std::shared_ptr< index_observer > > _observers
 
std::vector< std::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 312 of file index.hpp.

Member Typedef Documentation

◆ object_type

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

Definition at line 315 of file index.hpp.

Constructor & Destructor Documentation

◆ primary_index()

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

Definition at line 317 of file index.hpp.

Member Function Documentation

◆ add_observer()

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

Definition at line 429 of file index.hpp.

◆ create()

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

Definition at line 392 of file index.hpp.

◆ find()

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

Definition at line 335 of file index.hpp.

◆ get_next_id()

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

Definition at line 330 of file index.hpp.

◆ get_object_version()

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

Definition at line 342 of file index.hpp.

◆ insert()

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

Definition at line 401 of file index.hpp.

◆ load()

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

Definition at line 383 of file index.hpp.

◆ modify()

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

Definition at line 418 of file index.hpp.

◆ object_default()

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

Definition at line 443 of file index.hpp.

◆ object_from_variant()

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

Definition at line 434 of file index.hpp.

◆ object_space_id()

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

Definition at line 324 of file index.hpp.

◆ object_type_id()

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

Definition at line 327 of file index.hpp.

◆ open()

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

Definition at line 348 of file index.hpp.

◆ remove()

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

Definition at line 410 of file index.hpp.

◆ save()

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

Definition at line 368 of file index.hpp.

◆ set_next_id()

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

Definition at line 332 of file index.hpp.

◆ use_next_id()

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

Definition at line 331 of file index.hpp.


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