201 template <
typename OBJ>
220 template <
typename OBJ>
229 std::shared_ptr<OBJ> inst = obj.singular();
246 auto match_ptr = [inst](
const object_ref& oref) {
247 return (inst == oref.obj());
249 auto it = std::find_if(objs.begin(), objs.end(), match_ptr);
251 if (it != objs.end()) {
279 static void dump(std::ostream& os);
298 virtual void handle_replay() = 0;
310 return (order() < listener.
order());
328 struct listener_comparator_t
330 bool operator()(
const listener* l1,
const listener* l2)
const 339 typedef std::multiset<listener*, listener_comparator_t> listener_list;
344 static std::unique_ptr<listener_list> m_listeners;
std::set< object_ref > object_ref_list
A convenitent typedef for set of objects owned.
const std::string key_t
In the opflex world each entity is known by a URI which can be converted into a string.
static rc_t write()
Write/Execute all commands hitherto enqueued.
Error codes that VPP will return during a HW write.
virtual dependency_t order() const =0
Get the sortable Id of the listener.
A DB storing the objects that each owner/key owns.
A represenation of a reference to a VPP object.
static void mark(const client_db::key_t &key)
Mark all state owned by this key as stale.
bool operator<(const listener &listener) const
less than operator for set sorting
Class definition for listeners to OM events.
static void sweep(const client_db::key_t &key)
Sweep all the key's objects that are stale.
mark_n_sweep(const client_db::key_t &key)
Constructor - will call mark on the key.
static rc_t commit(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
dependency_t
There needs to be a strict order in which object types are read from VPP (at boot time) and replayed ...
~mark_n_sweep()
Destructor - will call sweep on the key.
static const rc_t OK
The HW write was successfull.
The interface to writing objects into VPP OM.
static rc_t write(const client_db::key_t &key, const OBJ &obj)
Make the State in VPP reflect the expressed desired state.
The VPP Object Model (VOM) library.
static void replay(void)
Replay all of the objects to HW.
A class providing the RAII pattern for mark and sweep.
static void dump(const client_db::key_t &key, std::ostream &os)
Print each of the object in the DB into the stream provided.
static void populate(const client_db::key_t &key)
populate the OM with state read from HW.
static bool register_listener(listener *listener)
Register a listener of events.