diff --git a/Control/AthLinksSA/AthLinks/ElementLink.h b/Control/AthLinksSA/AthLinks/ElementLink.h index 6793225b3379ab784b1597403f82f99ef8c25b31..e5b9d36f5f9325e7f41ed2fac2cd9a9fe4f2e57b 100644 --- a/Control/AthLinksSA/AthLinks/ElementLink.h +++ b/Control/AthLinksSA/AthLinks/ElementLink.h @@ -154,6 +154,11 @@ public: /// Get the key that we reference, as a hash sgkey_t key() const { return persKey(); } + /// Comparison operator + bool operator==( const ElementLink& rhs ) const; + /// Comparison operator + bool operator!=( const ElementLink& rhs ) const; + /// Get a reference to the object in question ElementConstReference operator*() const; diff --git a/Control/AthLinksSA/AthLinks/ElementLink.icc b/Control/AthLinksSA/AthLinks/ElementLink.icc index da4ef6b421cc4f037a65ed9705527674eeb406c2..56357d164e7aafd8ef3a0218b10a98bbd3b744a8 100644 --- a/Control/AthLinksSA/AthLinks/ElementLink.icc +++ b/Control/AthLinksSA/AthLinks/ElementLink.icc @@ -381,6 +381,18 @@ ElementLink< STORABLE >::dataID() const { return m_event->getName( persKey() ); } +template< typename STORABLE > +bool ElementLink< STORABLE >::operator==( const ElementLink& rhs ) const { + + return ( ( key() == rhs.key() ) && ( index() == rhs.index() ) ); +} + +template< typename STORABLE > +bool ElementLink< STORABLE >::operator!=( const ElementLink& rhs ) const { + + return ( ! ( *this == rhs ) ); +} + template< typename STORABLE > typename ElementLink< STORABLE >::ElementConstReference ElementLink< STORABLE >::operator*() const { diff --git a/Control/AthLinksSA/AthLinks/ElementLinkVector.h b/Control/AthLinksSA/AthLinks/ElementLinkVector.h index f3a32b0cd0c379c46fb62cdefc69bb91abd443c1..051f57a9cd2aacd3fadde4499b0b319339b7a0cc 100644 --- a/Control/AthLinksSA/AthLinks/ElementLinkVector.h +++ b/Control/AthLinksSA/AthLinks/ElementLinkVector.h @@ -79,6 +79,11 @@ public: /// Assignment operator ElemLinkVec& operator=( const ElemLinkVec& rhs ); + /// Comparison operator + bool operator==( const ElementLinkVector& rhs ) const; + /// Comparison operator + bool operator!=( const ElementLinkVector& rhs ) const; + /// @name Vector iterator functions /// @{ diff --git a/Control/AthLinksSA/AthLinks/ElementLinkVector.icc b/Control/AthLinksSA/AthLinks/ElementLinkVector.icc index 2fc137a491641b295be211a3536973f722a9b98a..9767c09ee2244f55f35447795b6d52a458bf4505 100644 --- a/Control/AthLinksSA/AthLinks/ElementLinkVector.icc +++ b/Control/AthLinksSA/AthLinks/ElementLinkVector.icc @@ -51,6 +51,28 @@ ElementLinkVector< CONTAINER >::operator=( const ElemLinkVec& rhs ) { return *this; } +template< class CONTAINER > +bool ElementLinkVector< CONTAINER >:: +operator==( const ElementLinkVector& rhs ) const { + + if( m_elVec.size() != rhs.m_elVec.size() ) { + return false; + } + for( std::size_t i = 0; i < m_elVec.size(); ++i ) { + if( m_elVec[ i ] != rhs.m_elVec[ i ] ) { + return false; + } + } + return true; +} + +template< class CONTAINER > +bool ElementLinkVector< CONTAINER >:: +operator!=( const ElementLinkVector& rhs ) const { + + return ( ! ( *this == rhs ) ); +} + //////////////////////////////////////////////////////////////////////////////// // // Implementation of the vector capacity functions