#ifndef __FPA__BASE__MATRIXVALUESCONTAINER__H__ #define __FPA__BASE__MATRIXVALUESCONTAINER__H__ #include #include #include namespace fpa { namespace Base { /** */ template< class I, class V, class VI > class MatrixValuesContainer : public itk::SimpleDataObjectDecorator< std::map< I, std::map< I, V, VI >, VI > > { public: typedef std::map< I, V, VI > TDecoratedRow; typedef std::map< I, TDecoratedRow, VI > TDecorated; typedef MatrixValuesContainer Self; typedef itk::SimpleDataObjectDecorator< TDecorated > Superclass; typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; typedef I TIndex; typedef V TValue; typedef VI TIndexCompare; typedef typename TDecoratedRow::iterator RowIterator; typedef typename TDecoratedRow::const_iterator ConstRowIterator; typedef typename TDecorated::iterator Iterator; typedef typename TDecorated::const_iterator ConstIterator; public: itkNewMacro( Self ); itkTypeMacro( MatrixValuesContainer, itkSimpleDataObjectDecorator ); public: void SetValue( const I& a, const I& b, const V& v ) { this->Get( )[ a ][ b ] = v; this->Modified( ); } void Clear( ) { this->Get( ).clear( ); this->Modified( ); } 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( ) ); } RowIterator Begin( const Iterator& i ) { return( i->second.begin( ) ); } RowIterator End( const Iterator& i ) { return( i->second.end( ) ); } ConstRowIterator Begin( const ConstIterator& i ) const { return( i->second.begin( ) ); } ConstRowIterator End( const ConstIterator& i ) const { return( i->second.end( ) ); } protected: MatrixValuesContainer( ) : Superclass( ) { } virtual ~MatrixValuesContainer( ) { } private: // Purposely not implemented MatrixValuesContainer( const Self& other ); Self& operator=( const Self& other ); }; } // ecapseman } // ecapseman #endif // __FPA__BASE__MATRIXVALUESCONTAINER__H__ // eof - $RCSfile$