1 #ifndef __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
2 #define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
8 // -------------------------------------------------------------------------
9 #define cpPlugins_Interface_Parameters_SetIndexOrPointMacro( NAME, TYPE ) \
11 T cpPlugins::Interface::Parameters:: \
12 GetValueAs##NAME( const TString& name ) const \
15 TParameters::const_iterator pIt = this->m_Parameters.find( name ); \
16 if( pIt != this->m_Parameters.end( ) ) \
18 if( pIt->second.first == Self::NAME ) \
20 std::istringstream ss( pIt->second.second ); \
23 while( std::getline( ss, token, ',' ) ) \
26 val[ i++ ] = TYPE( std::atof( token.c_str( ) ) ); \
33 cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Index, long );
34 cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Point, double );
36 // -------------------------------------------------------------------------
38 void cpPlugins::Interface::Parameters::
39 GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const
42 TParameters::const_iterator pIt = this->m_Parameters.find( name );
43 if( pIt == this->m_Parameters.end( ) )
45 if( pIt->second.first != Self::IndexList )
48 std::istringstream ss( pIt->second.second );
50 while( std::getline( ss, token, ':' ) )
54 std::istringstream ts( token );
58 while( std::getline( ts, text, ',' ) )
60 idx[ i++ ] = std::atoi( text.c_str( ) );
68 // -------------------------------------------------------------------------
70 void cpPlugins::Interface::Parameters::
71 GetValueAsPointList( std::vector< P >& lst, const TString& name ) const
74 TParameters::const_iterator pIt = this->m_Parameters.find( name );
75 if( pIt == this->m_Parameters.end( ) )
77 if( pIt->second.first != Self::PointList )
80 std::istringstream ss( pIt->second.second );
82 while( std::getline( ss, token, ':' ) )
86 std::istringstream ts( token );
90 while( std::getline( ts, text, ',' ) )
92 pnt[ i++ ] = std::atof( text.c_str( ) );
100 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__HXX__