// EdoTypeKey.cxx #include "EdoTypeKey.h" #include using std::ostream; using hes::EdoType; using hes::EdoKey; using hes::EdoTypeKey; int ff(int i) { return i; } //********************************************************************** // Member functions. //********************************************************************** // Default constructor. EdoTypeKey::EdoTypeKey() { } //********************************************************************** // Constructor from a type and key. EdoTypeKey::EdoTypeKey(EdoType type, EdoKey key) { if ( type.is_valid() && key.is_valid() ) { m_type = type; m_key = key; } } //********************************************************************** // Return if this type-key is valid. bool EdoTypeKey::is_valid() const { return m_type.is_valid() && m_key.is_valid(); } //********************************************************************** // Return the type. EdoType EdoTypeKey::type() const { return m_type; } //********************************************************************** // Return the key. EdoKey EdoTypeKey::key() const { return m_key; } //********************************************************************** // Free functions. //********************************************************************** // Ordering. bool operator<(const EdoTypeKey& lhs, const EdoTypeKey& rhs) { if ( lhs.type() < rhs.type() ) { return true; } else if ( rhs.type() < lhs.type() ) { return false; } else { return lhs.key() < rhs.key(); } } //********************************************************************** // Equality. bool operator==(const EdoTypeKey& lhs, const EdoTypeKey& rhs) { return lhs.type()==rhs.type() && lhs.key()==rhs.key(); } //********************************************************************** // Inequality. bool operator!=(const EdoTypeKey& lhs, const EdoTypeKey& rhs) { return ! (lhs==rhs); } //********************************************************************** // Output stream. ostream& operator<<(ostream& lhs, const EdoTypeKey& rhs) { lhs << rhs.type() << " " << rhs.key(); return lhs; } //**********************************************************************