diff options
author | Neale Ranns <neale.ranns@cisco.com> | 2017-11-23 12:15:00 -0800 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2017-11-24 14:04:48 +0000 |
commit | fd920609819a5b10d3d7c8d34fe4fa4214c7da22 (patch) | |
tree | fb0b5c3b5a9ba56308ef704ef922e959aafad17f /src/vpp-api/vom/interface.hpp | |
parent | 227bf211ab65e7aed6862fc881cc949c342200fd (diff) |
VOM: Additions to allow uses to UT applications that use VOM
- find object by key
- compare objects
Change-Id: I36ec8612be9482bcef7ceced2a59f7403f77b3e8
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vpp-api/vom/interface.hpp')
-rw-r--r-- | src/vpp-api/vom/interface.hpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/vpp-api/vom/interface.hpp b/src/vpp-api/vom/interface.hpp index 76ecf8af0a0..8cba2fa2c2c 100644 --- a/src/vpp-api/vom/interface.hpp +++ b/src/vpp-api/vom/interface.hpp @@ -44,7 +44,7 @@ public: /** * The key for interface's key */ - typedef std::string key_type; + typedef std::string key_t; /** * The iterator type @@ -207,7 +207,7 @@ public: /** * Return the interface type */ - const key_type& key() const; + const key_t& key() const; /** * Return the L2 Address @@ -225,6 +225,11 @@ public: void set(const oper_state_t& state); /** + * Comparison operator - only used for UT + */ + virtual bool operator==(const interface& i) const; + + /** * A base class for interface Create commands */ template <typename MSG> @@ -400,21 +405,14 @@ public: }; /** - * The the singular instance of the interface in the object_base-Model - */ - static std::shared_ptr<interface> find(const interface& temp); - - /** - * The the singular instance of the interface in the object_base-Model - * by handle + * The the singular instance of the interface in the DB by handle */ static std::shared_ptr<interface> find(const handle_t& h); /** - * The the singular instance of the interface in the object_base-Model - * by name + * The the singular instance of the interface in the DB by key */ - static std::shared_ptr<interface> find(const std::string& s); + static std::shared_ptr<interface> find(const key_t& k); /** * Dump all interfaces into the stream provided @@ -472,12 +470,12 @@ protected: /** * A map of all interfaces key against the interface's name */ - static singular_db<const std::string, interface> m_db; + static singular_db<key_t, interface> m_db; /** * Add an interface to the DB keyed on handle */ - static void add(const std::string& name, const HW::item<handle_t>& item); + static void add(const key_t& name, const HW::item<handle_t>& item); /** * remove an interface from the DB keyed on handle @@ -540,7 +538,7 @@ private: /** * It's the singular_db class that calls replay() */ - friend class singular_db<const std::string, interface>; + friend class singular_db<key_t, interface>; /** * The interfaces name |