#include "SUIT_DataOwner.h"
+#ifndef WNT
+#include <typeinfo>
+#define _typeinfo std::type_info
+#else
+#include <typeinfo.h>
+#define _typeinfo type_info
+#endif
+
//********************************************************************
// SUIT_DataOwner class
//********************************************************************
//********************************************************************
// SUIT_DataOwnerPtrList class: implements value list with unique
-// items (uniqueness is provided by operator==() and compareItems()
+// items (uniqueness is provided by operator==())
//********************************************************************
//====================================================================
{
SUIT_DataOwnerPtrList::iterator it = find( x );
if ( it != end() )
- return it;
- return QValueList<SUIT_DataOwnerPtr>::append( x );
-}
+ {
+ const _typeinfo& ti1 = typeid( *((*it).operator->()) );
+ const _typeinfo& ti2 = typeid( *(x.operator->()) );
-//====================================================================
-// Compares two items
-//====================================================================
-int SUIT_DataOwnerPtrList::compareItems( const SUIT_DataOwnerPtr& item1, const SUIT_DataOwnerPtr& item2 )
-{
- return item1 == item2;
+ if (ti1 == ti2)
+ return it;
+ }
+ return QValueList<SUIT_DataOwnerPtr>::append( x );
}
-
iterator append ( const SUIT_DataOwnerPtr& x );
-protected:
- virtual int compareItems( const SUIT_DataOwnerPtr& item1, const SUIT_DataOwnerPtr& item2 );
-
private:
// hide this methods: only append() should be used to add items to the list
iterator prepend( const SUIT_DataOwnerPtr& x );
SUIT_DataOwnerPtrList aList;
selected( aList, theType );
+ QMap<QString,int> entryMap;
+
for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
{
const SalomeApp_DataOwner* owner = dynamic_cast<const SalomeApp_DataOwner*>( (*itr).operator->() );
- if( owner )
+ if( !owner ) continue;
+
+ if ( !entryMap.contains(owner->entry()) )
theList.Append( owner->IO() );
+ entryMap.insert(owner->entry(), 1);
}
}