Maintain a one-to-one mapping of objects in memory to objects in permanent store, much like a write-thru cache. More...
#include <ProphetNodeList.h>
Public Member Functions | |
ProphetNodeList () | |
Constructor. | |
virtual | ~ProphetNodeList () |
Destructor. | |
void | load (const prophet::Node *n) |
Deserialize from storage. | |
void | update (const prophet::Node *n) |
Update (or add new) node in permanent store. | |
void | del (const prophet::Node *n) |
Remove node from permanent store. | |
const prophet::Node * | find (const std::string &dest_id) const |
Retrieve node from permanent store; returns NULL if not found. | |
void | clone (prophet::Table *nodes, const prophet::NodeParams *params) |
Copy list of nodes from permanent store into prophet::Table. | |
void | clear () |
Clean up memory associated with this list (leaving permanent store untouched). | |
bool | empty () const |
Accessors. | |
size_t | size () const |
Accessors. | |
Protected Types | |
typedef std::list < prophet::Node * > | List |
typedef List::iterator | iterator |
typedef List::const_iterator | const_iterator |
Protected Member Functions | |
bool | find (const std::string &dest_id, iterator &i) |
Given primary key, locate node in list. | |
Protected Attributes | |
List | list_ |
collection of prophet::Node's |
Maintain a one-to-one mapping of objects in memory to objects in permanent store, much like a write-thru cache.
Definition at line 32 of file ProphetNodeList.h.
typedef List::const_iterator dtn::ProphetNodeList::const_iterator [protected] |
Definition at line 84 of file ProphetNodeList.h.
typedef List::iterator dtn::ProphetNodeList::iterator [protected] |
Definition at line 83 of file ProphetNodeList.h.
typedef std::list<prophet::Node*> dtn::ProphetNodeList::List [protected] |
Definition at line 82 of file ProphetNodeList.h.
dtn::ProphetNodeList::ProphetNodeList | ( | ) |
Constructor.
Definition at line 25 of file ProphetNodeList.cc.
dtn::ProphetNodeList::~ProphetNodeList | ( | ) | [virtual] |
void dtn::ProphetNodeList::clear | ( | ) |
Clean up memory associated with this list (leaving permanent store untouched).
Definition at line 120 of file ProphetNodeList.cc.
References list_.
Referenced by dtn::ProphetBundleCore::shutdown(), and ~ProphetNodeList().
void dtn::ProphetNodeList::clone | ( | prophet::Table * | nodes, | |
const prophet::NodeParams * | params | |||
) |
Copy list of nodes from permanent store into prophet::Table.
Definition at line 110 of file ProphetNodeList.cc.
References prophet::Table::assign(), and list_.
Referenced by dtn::ProphetBundleCore::load_prophet_nodes().
void dtn::ProphetNodeList::del | ( | const prophet::Node * | n | ) |
Remove node from permanent store.
Definition at line 84 of file ProphetNodeList.cc.
References ASSERT, prophet::Node::dest_id(), find(), and list_.
Referenced by dtn::ProphetBundleCore::delete_node().
bool dtn::ProphetNodeList::empty | ( | ) | const [inline] |
Accessors.
Definition at line 77 of file ProphetNodeList.h.
References list_.
Referenced by dtn::ProphetBundleCore::load_prophet_nodes().
Given primary key, locate node in list.
Definition at line 130 of file ProphetNodeList.cc.
References list_.
const prophet::Node * dtn::ProphetNodeList::find | ( | const std::string & | dest_id | ) | const |
void dtn::ProphetNodeList::load | ( | const prophet::Node * | n | ) |
Deserialize from storage.
Definition at line 35 of file ProphetNodeList.cc.
References prophet::Node::age(), ASSERT, prophet::Node::custody(), prophet::Node::dest_id(), find(), prophet::Node::internet_gw(), list_, prophet::Node::p_value(), and prophet::Node::relay().
Referenced by dtn::ProphetBundleCore::load_prophet_nodes().
size_t dtn::ProphetNodeList::size | ( | ) | const [inline] |
void dtn::ProphetNodeList::update | ( | const prophet::Node * | n | ) |
Update (or add new) node in permanent store.
Definition at line 57 of file ProphetNodeList.cc.
References ASSERT, prophet::Node::dest_id(), find(), list_, and prophet::Node::p_value().
Referenced by dtn::ProphetBundleCore::update_node().
List dtn::ProphetNodeList::list_ [protected] |