Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

memindex Class Reference

implementation of terimber_memindex interface More...

#include <memdb.h>

Inheritance diagram for memindex:

terimber_memindex terimber_log_helper terimber_log

List of all members.

Public Member Functions

virtual terimber_memlookupadd_lookup (const terimber_db_value_vector *info)
 for navigation the user has to create index lookup first the list of values should be the same length & type as the index columns or less for example, let us assume that we got the index with two columns (id, integer) & (name, string) if the user provides values for id & name then the lookup will search for rows with specified id & name however, if only id is specified, lookup will ignore the second column values. it's impossible to set search lookup on the second column without setting the first column to do such a thing the user needs to create index with a different order of index columns, for instance name and id, and set search criteria for the name column. user is allowed to ignore search criteria completely, then lookup will move row by row in the order they came from the database, including the row with status = deleted
virtual bool remove_lookup (terimber_memlookup *obj)
 destroys lookup after using
const memtableget_table () const
 returns const memtable
memtableget_table ()
 returns memtable
const memdb_index_tget_index ()
 returns index table

Protected Member Functions

 memindex (memtable &parent, const memdb_rowset_less &pred)
 constructor
virtual ~memindex ()
 destructor users can't call destructor, memtable will take case about cleanup

Private Types

typedef list< memlookup * > list_lookups_t
 list of lookups

Private Member Functions

bool construct ()
 constructs index
void notify (memdb_rowset_citerator_t iter, bool insert_or_delete)
 notifies all lookup about changes

Private Attributes

memtable_parent
 parent memtable
memdb_index_t _index
 index table
mutex _mtx
 mutex
list_lookups_t _lookups
 list of lookups

Friends

class memtable
 memtable


Detailed Description

implementation of terimber_memindex interface

Definition at line 647 of file memdb.h.


Member Typedef Documentation

list of lookups

Definition at line 654 of file memdb.h.


Constructor & Destructor Documentation

BEGIN_TERIMBER_NAMESPACE memindex::memindex ( memtable parent,
const memdb_rowset_less pred 
) [protected]

constructor

Parameters:
parent  parent memtable
pred  predicate for row copmparision

Definition at line 38 of file memindex.cpp.

memindex::~memindex (  )  [protected, virtual]

destructor users can't call destructor, memtable will take case about cleanup

Definition at line 44 of file memindex.cpp.

References _lookups, _mtx, base_list< T >::begin(), list< T >::clear(), and base_list< T >::end().


Member Function Documentation

terimber_memlookup * memindex::add_lookup ( const terimber_db_value_vector info  )  [virtual]

for navigation the user has to create index lookup first the list of values should be the same length & type as the index columns or less for example, let us assume that we got the index with two columns (id, integer) & (name, string) if the user provides values for id & name then the lookup will search for rows with specified id & name however, if only id is specified, lookup will ignore the second column values. it's impossible to set search lookup on the second column without setting the first column to do such a thing the user needs to create index with a different order of index columns, for instance name and id, and set search criteria for the name column. user is allowed to ignore search criteria completely, then lookup will move row by row in the order they came from the database, including the row with status = deleted

Parameters:
info  value vector

Implements terimber_memindex.

Definition at line 64 of file memindex.cpp.

References _lookups, _mtx, memlookup::construct(), terimber_log_helper::log_on(), and list< T >::push_back().

bool memindex::remove_lookup ( terimber_memlookup obj  )  [virtual]

destroys lookup after using

Parameters:
obj  pointer to the lookup object

Implements terimber_memindex.

Definition at line 89 of file memindex.cpp.

References _lookups, _mtx, base_list< T >::begin(), base_list< T >::end(), and list< T >::erase().

const memtable& memindex::get_table (  )  const [inline]

memtable& memindex::get_table (  )  [inline]

returns memtable

Definition at line 699 of file memdb.h.

References _parent.

const memdb_index_t& memindex::get_index (  )  [inline]

returns index table

Definition at line 706 of file memdb.h.

References _index.

Referenced by memlookup::construct(), memlookup::memlookup(), and memlookup::notify().

bool memindex::construct (  )  [private]

void memindex::notify ( memdb_rowset_citerator_t  iter,
bool  insert_or_delete 
) [private]

notifies all lookup about changes

Parameters:
iter  affected row iterator
insert_or_delete  deleted or not

Definition at line 108 of file memindex.cpp.

References _index, _lookups, _mtx, base_list< T >::begin(), base_map< K, T, Pr, M >::end(), base_list< T >::end(), base_map< K, T, Pr, M >::equal_range(), map< K, T, Pr, M >::erase(), pair< T1, T2 >::first, map< K, T, Pr, M >::insert(), and pair< T1, T2 >::second.


Friends And Related Function Documentation

friend class memtable [friend]

memtable

Definition at line 651 of file memdb.h.


Member Data Documentation

parent memtable

Definition at line 722 of file memdb.h.

Referenced by construct(), and get_table().

index table

Definition at line 723 of file memdb.h.

Referenced by construct(), get_index(), and notify().

mutex memindex::_mtx [private]

mutex

Definition at line 724 of file memdb.h.

Referenced by add_lookup(), notify(), remove_lookup(), and ~memindex().

list of lookups

Definition at line 725 of file memdb.h.

Referenced by add_lookup(), notify(), remove_lookup(), and ~memindex().


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


© Copyright Terimber 2003-.