FD.io VPP
v21.06-3-gbb25fbf28
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 | begin () const |
Get iterator to the beginning of the DB. More... | |
const_iterator | end () const |
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 | 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 33 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 45 of file singular_db.hpp.
|
inline |
Constructor.
Definition at line 39 of file singular_db.hpp.
|
inline |
Find the object to the store.
Definition at line 120 of file singular_db.hpp.
|
inline |
Get iterator to the beginning of the DB.
Definition at line 50 of file singular_db.hpp.
|
inline |
Get iterator to the beginning of the DB.
Definition at line 55 of file singular_db.hpp.
|
inline |
Find the object to the store.
Definition at line 84 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 65 of file singular_db.hpp.
|
inline |
Release the object from the DB store, if it's the one we have stored.
Definition at line 100 of file singular_db.hpp.
|
inline |
Populate VPP from current state, on VPP restart.
Definition at line 125 of file singular_db.hpp.