BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
Public Types | Public Member Functions | List of all members
graphene::db::generic_index< ObjectType, MultiIndexType > Class Template Reference

#include <generic_index.hpp>

Inheritance diagram for graphene::db::generic_index< ObjectType, MultiIndexType >:
graphene::db::index graphene::db::primary_index< graphene::db::generic_index >

Public Types

typedef MultiIndexType index_type
 
typedef ObjectType object_type
 

Public Member Functions

virtual const objectinsert (object &&obj) override
 
virtual const objectcreate (const std::function< void(object &)> &constructor) override
 
virtual void modify (const object &obj, const std::function< void(object &)> &m) override
 
virtual void remove (const object &obj) override
 
virtual const objectfind (object_id_type id) const override
 
virtual void inspect_all_objects (std::function< void(const object &)> inspector) const override
 
const index_typeindices () const
 
- Public Member Functions inherited from graphene::db::index
virtual ~index ()
 
virtual uint8_t object_space_id () const =0
 
virtual uint8_t object_type_id () const =0
 
virtual object_id_type get_next_id () const =0
 
virtual void use_next_id ()=0
 
virtual void set_next_id (object_id_type id)=0
 
virtual const objectload (const std::vector< char > &data)=0
 
virtual void open (const fc::path &db)=0
 
virtual void save (const fc::path &db)=0
 
const objectget (object_id_type id) const
 
template<typename Object , typename Lambda >
void modify (const Object &obj, const Lambda &l)
 
virtual void add_observer (const shared_ptr< index_observer > &)=0
 
virtual void object_from_variant (const fc::variant &var, object &obj, uint32_t max_depth) const =0
 
virtual void object_default (object &obj) const =0
 

Detailed Description

template<typename ObjectType, typename MultiIndexType>
class graphene::db::generic_index< ObjectType, MultiIndexType >

Almost all objects can be tracked and managed via a boost::multi_index container that uses an unordered_unique key on the object ID. This template class adapts the generic index interface to work with arbitrary boost multi_index containers on the same type.

Definition at line 43 of file generic_index.hpp.

Member Typedef Documentation

template<typename ObjectType, typename MultiIndexType>
typedef MultiIndexType graphene::db::generic_index< ObjectType, MultiIndexType >::index_type

Definition at line 46 of file generic_index.hpp.

template<typename ObjectType, typename MultiIndexType>
typedef ObjectType graphene::db::generic_index< ObjectType, MultiIndexType >::object_type

Definition at line 47 of file generic_index.hpp.

Member Function Documentation

template<typename ObjectType, typename MultiIndexType>
virtual const object& graphene::db::generic_index< ObjectType, MultiIndexType >::create ( const std::function< void(object &)> &  constructor)
inlineoverridevirtual

Builds a new object and assigns it the next available ID and then initializes it with constructor and lastly inserts it into the index.

Implements graphene::db::index.

Reimplemented in graphene::db::primary_index< graphene::db::generic_index >.

Definition at line 57 of file generic_index.hpp.

template<typename ObjectType, typename MultiIndexType>
virtual const object* graphene::db::generic_index< ObjectType, MultiIndexType >::find ( object_id_type  id) const
inlineoverridevirtual
Returns
the object with id or nullptr if not found

Implements graphene::db::index.

Reimplemented in graphene::db::primary_index< graphene::db::generic_index >.

Definition at line 96 of file generic_index.hpp.

template<typename ObjectType, typename MultiIndexType>
const index_type& graphene::db::generic_index< ObjectType, MultiIndexType >::indices ( ) const
inline

Definition at line 113 of file generic_index.hpp.

template<typename ObjectType, typename MultiIndexType>
virtual const object& graphene::db::generic_index< ObjectType, MultiIndexType >::insert ( object &&  obj)
inlineoverridevirtual

Polymorphically insert by moving an object into the index. this should throw if the object is already in the database.

Implements graphene::db::index.

Reimplemented in graphene::db::primary_index< graphene::db::generic_index >.

Definition at line 49 of file generic_index.hpp.

template<typename ObjectType, typename MultiIndexType>
virtual void graphene::db::generic_index< ObjectType, MultiIndexType >::inspect_all_objects ( std::function< void(const object &)>  inspector) const
inlineoverridevirtual

Implements graphene::db::index.

Definition at line 105 of file generic_index.hpp.

template<typename ObjectType, typename MultiIndexType>
virtual void graphene::db::generic_index< ObjectType, MultiIndexType >::modify ( const object obj,
const std::function< void(object &)> &  m 
)
inlineoverridevirtual
template<typename ObjectType, typename MultiIndexType>
virtual void graphene::db::generic_index< ObjectType, MultiIndexType >::remove ( const object obj)
inlineoverridevirtual

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