From d627802a745bd231f130758ae10530facbc0c567 Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 29 Aug 2006 11:32:05 +0000 Subject: [PATCH] Comparing mechanism for SUIT_DataOwner modified. --- src/SUIT/SUIT_DataOwner.cxx | 28 +++++++++++++++++----------- src/SUIT/SUIT_DataOwner.h | 1 + 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index 826bd89bf..beb907d7a 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -36,7 +36,7 @@ SUIT_DataOwner::~SUIT_DataOwner() { } -/*! operator== : compares two owners*/ +/*! Operator == compares two owners*/ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) { if ( !p1.isNull() && !p2.isNull() ) @@ -44,6 +44,20 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) return p1.isNull() && p2.isNull(); } + +/*! Operator < allows to order suit data owners for map */ +bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) +{ + if ( p1.isNull() && p2.isNull() ) + return false; + else if ( p1.isNull() ) + return true; + else if ( p2.isNull() ) + return false; + + return p1->isLess( *p2 ); +} + /*! \class SUIT_DataOwnerPtrList implements value list with unique items (uniqueness is @@ -126,12 +140,12 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list */ SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x ) { - if( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator== + if ( mySkipEqual && myMap.contains( x ) ) //contains uses SUIT_DataOwnerPtr::operator== return myMap[ x ]; iterator it = QValueList::append( x ); - if( mySkipEqual ) + if ( mySkipEqual ) myMap.insert( x, it ); return it; @@ -156,11 +170,3 @@ uint SUIT_DataOwnerPtrList::remove(const SUIT_DataOwnerPtr& x ) myMap.remove(x); return QValueList::remove( x ); } - -/*! - Operator < allows to order suit data owners for map -*/ -bool operator<( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) -{ - return p1.get()