oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType > Class Template Reference

#include <InternalKeyDurableTable.h>

Inheritance diagram for oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >:

oasys::Logger dtn::LinkStore dtn::RegistrationStore dtn::SQLRegistrationStore

List of all members.


Detailed Description

template<typename _ShimType, typename _KeyType, typename _DataType>
class oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >

Single type durable table adapter interface used to simplify cases in which the data objects to be stored contain at least one field that is the unique identifier and is wrapped in the table by one of the TypeShims.

This interface provides simple hooks for add(), get(), del(), and update() that take only a pointer to the class, not a secondary argument that is the id. The class also implements an alternative iterator interface wherein the iterator stores the current element, rather than forcing the caller to have a local temporary.

To fulfill the contract required by the template, the stored class must implement a function called durable_key() that returns the unique key value, suitable to be passed to the _ShimType constructor.

Finally, to cover the most common (so far) use cases for this class, it implements logging and assertion handlers to cover unexpected cases in the interface, e.g. logging a warning on a call to get() for an id that's not in the table, PANIC on internal database errors, etc.

Definition at line 51 of file InternalKeyDurableTable.h.


Public Member Functions

 InternalKeyDurableTable (const char *classname, const char *logpath, const char *datatype, const char *table_name)
virtual ~InternalKeyDurableTable ()
int do_init (const StorageConfig &cfg, DurableStore *store)
 Real initialization method.
void close ()
 Close and flush the table.
bool add (_DataType *data)
_DataType * get (_KeyType id)
bool update (_DataType *data)
bool del (_KeyType id)
iteratornew_iterator ()
 Return a new iterator.

Protected Attributes

SingleTypeDurableTable
< _DataType > * 
table_
const char * datatype_
const char * table_name_

Classes

class  iterator
 STL-style iterator. More...

Constructor & Destructor Documentation

template<typename _ShimType, typename _KeyType, typename _DataType>
oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::InternalKeyDurableTable ( const char *  classname,
const char *  logpath,
const char *  datatype,
const char *  table_name 
)

template<typename _ShimType, typename _KeyType, typename _DataType>
virtual oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::~InternalKeyDurableTable (  )  [virtual]


Member Function Documentation

template<typename _ShimType, typename _KeyType, typename _DataType>
int oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::do_init ( const StorageConfig cfg,
DurableStore store 
)

Real initialization method.

Referenced by dtn::RegistrationStore::init(), and dtn::LinkStore::init().

template<typename _ShimType, typename _KeyType, typename _DataType>
void oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::close (  ) 

Close and flush the table.

Referenced by dtn::BundleStore::close(), and dtn::DTNServer::close_datastore().

template<typename _ShimType, typename _KeyType, typename _DataType>
bool oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::add ( _DataType *  data  ) 

Referenced by dtn::RegistrationTable::add(), and dtn::BundleStore::add().

template<typename _ShimType, typename _KeyType, typename _DataType>
_DataType* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::get ( _KeyType  id  ) 

Referenced by dtn::BundleStore::get(), and dtn::BundleDaemon::load_registrations().

template<typename _ShimType, typename _KeyType, typename _DataType>
bool oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::update ( _DataType *  data  ) 

Referenced by dtn::RegistrationTable::update(), and dtn::BundleStore::update().

template<typename _ShimType, typename _KeyType, typename _DataType>
bool oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::del ( _KeyType  id  ) 

Referenced by dtn::BundleStore::del().

template<typename _ShimType, typename _KeyType, typename _DataType>
iterator* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::new_iterator (  )  [inline]

Return a new iterator.

The caller has the responsibility of deleting it once done.

Definition at line 130 of file InternalKeyDurableTable.h.

References oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::table_.

Referenced by dtn::BundleDaemon::load_registrations(), and dtn::BundleStore::new_iterator().


Member Data Documentation

template<typename _ShimType, typename _KeyType, typename _DataType>
SingleTypeDurableTable<_DataType>* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::table_ [protected]

Definition at line 136 of file InternalKeyDurableTable.h.

Referenced by oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::new_iterator().

template<typename _ShimType, typename _KeyType, typename _DataType>
const char* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::datatype_ [protected]

Definition at line 137 of file InternalKeyDurableTable.h.

template<typename _ShimType, typename _KeyType, typename _DataType>
const char* oasys::InternalKeyDurableTable< _ShimType, _KeyType, _DataType >::table_name_ [protected]

Definition at line 138 of file InternalKeyDurableTable.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 8 08:36:26 2007 for DTN Reference Implementation by  doxygen 1.5.3