FD.io VPP
v18.01-8-g0eacf49
Vector Packet Processing
|
A Database to store the unique 'singular' instances of a single object type. More...
Public Types | |
typedef std::map< KEY, std::weak_ptr< OBJ > >::const_iterator | const_iterator |
Iterator. More... | |
Public Member Functions | |
singular_db () | |
Constructor. More... | |
const_iterator | cbegin () |
Get iterator to the beginning of the DB. More... | |
const_iterator | cend () |
Get iterator to the beginning of the DB. More... | |
template<typename DERIVED > | |
std::shared_ptr< OBJ > | find_or_add (const KEY &key, const DERIVED &obj) |
Find or add the object to the store. More... | |
std::shared_ptr< OBJ > | find (const KEY &key) |
Find the object to the store. More... | |
void | release (const KEY &key, const OBJ *obj) |
Release the object from the DB store, if it's the one we have stored. More... | |
void | add (const KEY &key, std::shared_ptr< OBJ > sp) |
Find the object to the store. More... | |
void | dump (std::ostream &os) |
Print each of the object in the DB into the stream provided. More... | |
void | replay () |
Populate VPP from current state, on VPP restart. More... | |
A Database to store the unique 'singular' instances of a single object type.
The instances are stored as weak pointers. So the DB does not own these objects, they are owned by object in the client_db.
Definition at line 32 of file singular_db.hpp.
typedef std::map<KEY, std::weak_ptr<OBJ> >::const_iterator VOM::singular_db< KEY, OBJ >::const_iterator |
Iterator.
Definition at line 44 of file singular_db.hpp.
|
inline |
Constructor.
Definition at line 38 of file singular_db.hpp.
|
inline |
Find the object to the store.
Definition at line 119 of file singular_db.hpp.
|
inline |
Get iterator to the beginning of the DB.
Definition at line 49 of file singular_db.hpp.
|
inline |
Get iterator to the beginning of the DB.
Definition at line 54 of file singular_db.hpp.
|
inline |
Print each of the object in the DB into the stream provided.
Definition at line 124 of file singular_db.hpp.
|
inline |
Find the object to the store.
Definition at line 83 of file singular_db.hpp.
|
inline |
Find or add the object to the store.
The object passed is deisred state. A new instance will be copy constructed from it. This function is templatised on the object type passed, which may be drrived from, the object type stored. this prevents slicing during the make_shared construction.
Definition at line 64 of file singular_db.hpp.
|
inline |
Release the object from the DB store, if it's the one we have stored.
Definition at line 99 of file singular_db.hpp.
|
inline |
Populate VPP from current state, on VPP restart.
Definition at line 135 of file singular_db.hpp.