#ifndef __FPA__BASE__UNIQUEVALUESCONTAINER__H__ #define __FPA__BASE__UNIQUEVALUESCONTAINER__H__ #include #include #include namespace fpa { namespace Base { /** */ template< class V, class VC > class UniqueValuesContainer : public itk::SimpleDataObjectDecorator< std::set< V, VC > > { public: typedef std::set< V, VC > TDecorated; typedef UniqueValuesContainer Self; typedef itk::SimpleDataObjectDecorator< TDecorated > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef V TValue; typedef VC TValueCompare; typedef typename TDecorated::iterator Iterator; typedef typename TDecorated::const_iterator ConstIterator; public: itkNewMacro( Self ); itkTypeMacro( UniqueValuesContainer, itkSimpleDataObjectDecorator ); public: void Insert( const V& v ) { this->Get( ).insert( v ); this->Modified( ); } void Erase( const V& v ) { this->Get( ).erase( v ); this->Modified( ); } void Clear( ) { this->Get( ).clear( ); this->Modified( ); } bool Find( const V& v ) const { return( this->Get( ).find( v ) != this->Get( ).end( ) ); } Iterator Begin( ) { return( this->Get( ).begin( ) ); } Iterator End( ) { return( this->Get( ).end( ) ); } ConstIterator Begin( ) const { return( this->Get( ).begin( ) ); } ConstIterator End( ) const { return( this->Get( ).end( ) ); } unsigned long Size( ) const { return( this->Get( ).size( ) ); } protected: UniqueValuesContainer( ) : Superclass( ) { } virtual ~UniqueValuesContainer( ) { } private: // Purposely not implemented UniqueValuesContainer( const Self& other ); Self& operator=( const Self& other ); }; } // ecapseman } // ecapseman #endif // __FPA__BASE__UNIQUEVALUESCONTAINER__H__ // eof - $RCSfile$