1 #ifndef __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
2 #define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
8 // -------------------------------------------------------------------------
9 #define cpPlugins_Interface_Parameters_SetListMacro( TYPE ) \
11 void cpPlugins::Interface::Parameters:: \
12 SetValueAs##TYPE##List( const TString& name, const I& b, const I& e ) \
14 TParameters::iterator pIt = this->m_Parameters.find( name ); \
15 if( pIt == this->m_Parameters.end( ) ) \
17 if( pIt->second.first != Self::TYPE##List ) \
19 std::stringstream ss; \
20 for( I i = b; i != e; ++i ) \
22 pIt->second.second = ss.str( ); \
25 cpPlugins_Interface_Parameters_SetListMacro( String );
26 cpPlugins_Interface_Parameters_SetListMacro( Bool );
27 cpPlugins_Interface_Parameters_SetListMacro( Int );
28 cpPlugins_Interface_Parameters_SetListMacro( Uint );
29 cpPlugins_Interface_Parameters_SetListMacro( Real );
30 cpPlugins_Interface_Parameters_SetListMacro( Index );
31 cpPlugins_Interface_Parameters_SetListMacro( Point );
33 // -------------------------------------------------------------------------
34 #define cpPlugins_Interface_Parameters_SetIndexOrPointMacro( NAME, TYPE ) \
36 T cpPlugins::Interface::Parameters:: \
37 GetValueAs##NAME( const TString& name ) const \
40 TParameters::iterator pIt = this->m_Parameters.find( name ); \
41 if( pIt != this->m_Parameters.end( ) ) \
43 if( pIt->second.first == Self::NAME ) \
45 std::istringstream ss( pIt->second.second ); \
48 while( std::getline( ss, token, ',' ) ) \
51 val[ i++ ] = TYPE( std::atof( token.c_str( ) ) ); \
59 cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Index, long );
60 cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Point, double );
62 // -------------------------------------------------------------------------
64 void cpPlugins::Interface::Parameters::
65 GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const
68 TParameters::iterator pIt = this->m_Parameters.find( name );
69 if( pIt == this->m_Parameters.end( ) )
71 if( pIt->second.first != Self::IndexList )
75 std::cerr << "TODO GetValueAsIndexList" << std::endl;
78 // -------------------------------------------------------------------------
80 void cpPlugins::Interface::Parameters::
81 GetValueAsPointList( std::vector< P >& lst, const TString& name ) const
84 TParameters::iterator pIt = this->m_Parameters.find( name );
85 if( pIt == this->m_Parameters.end( ) )
87 if( pIt->second.first != Self::PointList )
91 std::cerr << "TODO GetValueAsPointList" << std::endl;
94 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__HXX__