X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FParameters.h;h=3bf5d0140b8d068e36765a26208599dd0e284e6f;hb=6ffc11d77924d6ab7e94db95d41105982ac73e00;hp=765f82f851d7b9bbb3f0ef2b3bec0c8ce70f5e1a;hpb=de874ea850042e77a99a456188f423c8df2e374f;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Parameters.h b/lib/cpPlugins/Interface/Parameters.h index 765f82f..3bf5d01 100644 --- a/lib/cpPlugins/Interface/Parameters.h +++ b/lib/cpPlugins/Interface/Parameters.h @@ -70,12 +70,22 @@ class TiXmlElement; { \ std::stringstream str; \ str << v; \ - i->second.second = str.str( ); \ + if( i->second.second != str.str( ) ) \ + { \ + i->second.second = str.str( ); \ + this->Modified( ); \ + } \ } \ else \ - i->second.second = \ - *( reinterpret_cast< const std::string* >( &v ) ); \ - this->Modified( ); \ + { \ + const std::string* str = \ + reinterpret_cast< const std::string* >( &v ); \ + if( i->second.second != *str ) \ + { \ + i->second.second = *str; \ + this->Modified( ); \ + } \ + } \ } \ } \ } @@ -118,8 +128,11 @@ class TiXmlElement; if( i->second.first == Self::Y##List ) \ { \ std::stringstream str; \ - str << i->second.second << "#" << v; \ + if( i->second.second != "" ) \ + str << i->second.second << "#"; \ + str << v; \ i->second.second = str.str( ); \ + this->Modified( ); \ } \ } \ } \ @@ -129,7 +142,13 @@ class TiXmlElement; if( i != this->m_Parameters.end( ) ) \ { \ if( i->second.first == Self::Y##List ) \ - i->second.second = ""; \ + { \ + if( i->second.second != "" ) \ + { \ + i->second.second = ""; \ + this->Modified( ); \ + } \ + } \ } \ } @@ -157,12 +176,10 @@ namespace cpPlugins enum Type { String , Bool , Int , - Uint , Real , Index , - Point , Vector , OpenFileName , + Uint , Real , OpenFileName , SaveFileName , PathName , StringList , BoolList , IntList , UintList , - RealList , IndexList , PointList , - VectorList , OpenFileNameList , SaveFileNameList , + RealList , OpenFileNameList , SaveFileNameList , PathNameList , Choices , NoType }; @@ -187,9 +204,6 @@ namespace cpPlugins cpPlugins_Parameters_Configure( Int ); cpPlugins_Parameters_Configure( Uint ); cpPlugins_Parameters_Configure( Real ); - cpPlugins_Parameters_Configure( Index ); - cpPlugins_Parameters_Configure( Point ); - cpPlugins_Parameters_Configure( Vector ); cpPlugins_Parameters_Configure( OpenFileName ); cpPlugins_Parameters_Configure( SaveFileName ); cpPlugins_Parameters_Configure( PathName ); @@ -198,9 +212,6 @@ namespace cpPlugins cpPlugins_Parameters_Configure( IntList ); cpPlugins_Parameters_Configure( UintList ); cpPlugins_Parameters_Configure( RealList ); - cpPlugins_Parameters_Configure( IndexList ); - cpPlugins_Parameters_Configure( PointList ); - cpPlugins_Parameters_Configure( VectorList ); cpPlugins_Parameters_Configure( OpenFileNameList ); cpPlugins_Parameters_Configure( SaveFileNameList ); cpPlugins_Parameters_Configure( PathNameList ); @@ -256,62 +267,10 @@ namespace cpPlugins const std::string& name, const std::string& choice ); - // Some templated methods - template< class I > - I GetIndex( - const std::string& name, const unsigned int& dim - ) const; - template< class P > - P GetPoint( - const std::string& name, const unsigned int& dim - ) const; - template< class V > - V GetVector( - const std::string& name, const unsigned int& dim - ) const; - - template< class I > - void SetIndex( - const std::string& name, const unsigned int& dim, const I& v - ); - template< class P > - void SetPoint( - const std::string& name, const unsigned int& dim, const P& v - ); - template< class V > - void SetVector( - const std::string& name, const unsigned int& dim, const V& v - ); - - template< class I > - std::vector< I > GetIndexList( - const std::string& name, const unsigned int& dim - ) const; - template< class P > - std::vector< P > GetPointList( - const std::string& name, const unsigned int& dim - ) const; - template< class V > - std::vector< V > GetVectorList( - const std::string& name, const unsigned int& dim - ) const; - - template< class I > - void AddToIndexList( - const std::string& name, const unsigned int& dim, const I& v - ); - template< class P > - void AddToPointList( - const std::string& name, const unsigned int& dim, const P& v - ); - template< class P > - void AddToVectorList( - const std::string& name, const unsigned int& dim, const P& v - ); - - void ClearIndexList( const std::string& name ); - void ClearPointList( const std::string& name ); - void ClearVectorList( const std::string& name ); + std::string GetAcceptedFileExtensions( const std::string& name ) const; + void SetAcceptedFileExtensions( + const std::string& name, const std::string& extensions + ); // XML "streaming" bool ToXML( TiXmlElement* parent_elem ) const; @@ -331,16 +290,15 @@ namespace cpPlugins Self& operator=( const Self& other ); protected: - TParameters m_Parameters; - ProcessObject* m_Process; + TParameters m_Parameters; + std::map< std::string, std::string > m_AcceptedFileExtensions; + ProcessObject* m_Process; }; } // ecapseman } // ecapseman -#include - #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__ // eof - $RCSfile$