diff options
Diffstat (limited to 'src/vpp-api/vom/l2_binding.cpp')
-rw-r--r-- | src/vpp-api/vom/l2_binding.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/vpp-api/vom/l2_binding.cpp b/src/vpp-api/vom/l2_binding.cpp index e380760805c..dd49e570a8e 100644 --- a/src/vpp-api/vom/l2_binding.cpp +++ b/src/vpp-api/vom/l2_binding.cpp @@ -20,7 +20,7 @@ namespace VOM { /** * A DB of all the L2 Configs */ -singular_db<const handle_t, l2_binding> l2_binding::m_db; +singular_db<l2_binding::key_t, l2_binding> l2_binding::m_db; l2_binding::event_handler l2_binding::m_evh; @@ -75,6 +75,24 @@ l2_binding::l2_binding(const l2_binding& o) { } +const l2_binding::key_t& +l2_binding::key() const +{ + return (m_itf->key()); +} + +bool +l2_binding::operator==(const l2_binding& l) const +{ + return ((*m_itf == *l.m_itf) && (*m_bd == *l.m_bd)); +} + +std::shared_ptr<l2_binding> +l2_binding::find(const key_t& key) +{ + return (m_db.find(key)); +} + void l2_binding::sweep() { @@ -108,14 +126,14 @@ l2_binding::~l2_binding() sweep(); // not in the DB anymore. - m_db.release(m_itf->handle(), this); + m_db.release(m_itf->key(), this); } std::string l2_binding::to_string() const { std::ostringstream s; - s << "L2-config:[" << m_itf->to_string() << " " << m_bd->to_string() << " " + s << "L2-binding:[" << m_itf->to_string() << " " << m_bd->to_string() << " " << m_binding.to_string() << "]"; return (s.str()); @@ -154,7 +172,7 @@ l2_binding::update(const l2_binding& desired) std::shared_ptr<l2_binding> l2_binding::find_or_add(const l2_binding& temp) { - return (m_db.find_or_add(temp.m_itf->handle(), temp)); + return (m_db.find_or_add(temp.m_itf->key(), temp)); } std::shared_ptr<l2_binding> |