FlatStore Class Reference
[pydtn]

A simple storage class for DTN::Bundles. More...

#include <pydtn/FlatStore.h>

Inheritance diagram for FlatStore:

Inheritance graph
[legend]
Collaboration diagram for FlatStore:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::set< DTN::Bundle * > BundleList
 The internal storage type.
typedef BundleList::key_type key_type
 Convenient shorter version of the index type.

Public Member Functions

 FlatStore (DTN::Node *owner)
 Constructor.
virtual ~FlatStore ()
 Virtual destructor.
BundleList::iterator begin ()
 
Returns:
the first item in the store

BundleList::iterator lower_bound (const key_type &x)
 
Parameters:
x An index into the store

BundleList::iterator upper_bound (const key_type &x)
 
Parameters:
x An index into the store

BundleList::iterator end ()
 
Returns:
the end of the store

BundleList::const_iterator begin () const
 
Returns:
the first item in the store

BundleList::const_iterator lower_bound (const key_type &x) const
 
Parameters:
x An index into the store

BundleList::const_iterator upper_bound (const key_type &x) const
 
Parameters:
x An index into the store

BundleList::const_iterator end () const
 
Returns:
the end of the store


Protected Member Functions

virtual DTN::BundlePointer p_addBundle (DTN::Bundle *b)
 Add a DTN::Bundle to the store.
virtual void p_deleteBundle (DTN::Bundle *b)
 Remove a DTN::Bundle from the store.
virtual DTN::BundlePointer p_getPointer (const DTN::BundlePointer &p)
 Update a DTN::BundlePointer from the store.
virtual DTN::BundlePointer p_getPointer (const DTN::ByteString &sender, uint32_t seqNum)
 Find a DTN::BundlePointer for a particular DTN::Bundle.
virtual bool p_validatePointer (const DTN::BundlePointer &p)
 Test the validity of a DTN::BundlePointer.
virtual size_t p_bytesUsed ()
 The size of the data store.
virtual size_t p_bundles ()
 The number of bundles stored.
virtual void p_shrinkStore (size_t s)
 Change the size of the data store.


Detailed Description

A simple storage class for DTN::Bundles.

Definition at line 43 of file FlatStore.h.


Member Function Documentation

FlatStore::BundleList::iterator FlatStore::lower_bound ( const key_type x  ) 

Parameters:
x An index into the store

Returns:
the item with index x, the item with the smallest index greater than x if x is not present, or the end of the store if no such item exists

Definition at line 165 of file FlatStore.cc.

FlatStore::BundleList::iterator FlatStore::upper_bound ( const key_type x  ) 

Parameters:
x An index into the store

Returns:
the item with the smallest index greater than x, or the end of the store if no such item exists

Definition at line 171 of file FlatStore.cc.

Referenced by FlatStoreItr::next().

FlatStore::BundleList::const_iterator FlatStore::lower_bound ( const key_type x  )  const

Parameters:
x An index into the store

Returns:
the item with index x, the item with the smallest index greater than x if x is not present, or the end of the store if no such item exists

Definition at line 189 of file FlatStore.cc.

FlatStore::BundleList::const_iterator FlatStore::upper_bound ( const key_type x  )  const

Parameters:
x An index into the store

Returns:
the item with the smallest index greater than x, or the end of the store if no such item exists

Definition at line 195 of file FlatStore.cc.

DTN::BundlePointer FlatStore::p_addBundle ( DTN::Bundle b  )  [protected, virtual]

Add a DTN::Bundle to the store.

Parameters:
b The bundle to add; ownership of the memory is taken by the store
Returns:
a reference to the stored DTN::Bundle

Implements DTN::VolatileBundleStore.

Definition at line 60 of file FlatStore.cc.

References DTN::Bundle::size().

void FlatStore::p_deleteBundle ( DTN::Bundle b  )  [protected, virtual]

Remove a DTN::Bundle from the store.

Parameters:
b The bundle to delete

Implements DTN::VolatileBundleStore.

Definition at line 73 of file FlatStore.cc.

References DTN::Bundle::size().

Referenced by p_shrinkStore().

DTN::BundlePointer FlatStore::p_getPointer ( const DTN::BundlePointer p  )  [protected, virtual]

Update a DTN::BundlePointer from the store.

Parameters:
p A cached DTN::BundlePointer
Returns:
A DTN::BundlePointer either equal to p or following it in the store. If p.isNull(), a DTN::BundlePointer to the beginning of the store is returned. If there is no valid DTN::BundlePointer to return, a NULL pointer will be returned.

Implements DTN::VolatileBundleStore.

Definition at line 83 of file FlatStore.cc.

References DTN::BundlePointer::isNull(), and DTN::BundlePointer::repr().

DTN::BundlePointer FlatStore::p_getPointer ( const DTN::ByteString &  sender,
uint32_t  seqNum 
) [protected, virtual]

Find a DTN::BundlePointer for a particular DTN::Bundle.

This uses the unique identifying information for a DTN::Bundle, rather than a pointer, so that we can match acknowledgements.

Parameters:
sender The originator of a DTN::Bundle
seqNum The originator's unique ID for a DTN::Bundle
Returns:
A DTN::BundlePointer for the identified DTN::Bundle, if it is in the store, or a NULL DTN::BundlePointer if it isn't

Implements DTN::VolatileBundleStore.

Definition at line 102 of file FlatStore.cc.

References end().

bool FlatStore::p_validatePointer ( const DTN::BundlePointer p  )  [protected, virtual]

Test the validity of a DTN::BundlePointer.

Parameters:
p A cached DTN::BundlePointer
Return values:
true The referenced DTN::Bundle is in the store
false The referenced DTN::Bundle is not in the store

Implements DTN::VolatileBundleStore.

Definition at line 125 of file FlatStore.cc.

References DTN::BundlePointer::isNull(), and DTN::BundlePointer::repr().

virtual size_t FlatStore::p_bytesUsed (  )  [inline, protected, virtual]

The size of the data store.

Returns:
the total size used by the store, in bytes

Implements DTN::VolatileBundleStore.

Definition at line 126 of file FlatStore.h.

virtual size_t FlatStore::p_bundles (  )  [inline, protected, virtual]

The number of bundles stored.

Returns:
the total number of bundles in the store

Implements DTN::VolatileBundleStore.

Definition at line 131 of file FlatStore.h.

void FlatStore::p_shrinkStore ( size_t  s  )  [protected, virtual]

Change the size of the data store.

Parameters:
s The new size of the data store
See also:
DTN::BundleStore::shrinkStore()

Implements DTN::VolatileBundleStore.

Definition at line 132 of file FlatStore.cc.

References end(), DTN::ExpiryDrop::inst, DTN::BundleStore::m_owner, and p_deleteBundle().


The documentation for this class was generated from the following files:
Generated on Mon Mar 24 11:15:47 2008 for Pydtn Simulator by  doxygen 1.5.4