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( Int );
27 cpPlugins_Interface_Parameters_SetListMacro( Uint );
28 cpPlugins_Interface_Parameters_SetListMacro( Real );
29 cpPlugins_Interface_Parameters_SetListMacro( Index );
30 cpPlugins_Interface_Parameters_SetListMacro( Point );
32 // -------------------------------------------------------------------------
34 I cpPlugins::Interface::Parameters::
35 GetValueAsIndex( const TString& name ) const
38 TParameters::iterator pIt = this->m_Parameters.find( name );
39 if( pIt != this->m_Parameters.end( ) )
41 if( pIt->second.first == Self::Index )
43 std::istringstream ss( pIt->second.second );
46 while( std::getline( ss, token, ',' ) )
49 idx[ i++ ] = std::atoi( token.c_str( ) );
59 // -------------------------------------------------------------------------
61 P cpPlugins::Interface::Parameters::
62 GetValueAsPoint( const TString& name ) const
65 TParameters::iterator pIt = this->m_Parameters.find( name );
66 if( pIt != this->m_Parameters.end( ) )
68 if( pIt->second.first == Self::Point )
70 std::istringstream ss( pIt->second.second );
73 while( std::getline( ss, token, ',' ) )
76 pnt[ i++ ] = std::atof( token.c_str( ) );
86 // -------------------------------------------------------------------------
88 void cpPlugins::Interface::Parameters::
89 GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const
92 TParameters::iterator pIt = this->m_Parameters.find( name );
93 if( pIt == this->m_Parameters.end( ) )
95 if( pIt->second.first != Self::IndexList )
99 std::cerr << "TODO GetValueAsIndexList" << std::endl;
102 // -------------------------------------------------------------------------
104 void cpPlugins::Interface::Parameters::
105 GetValueAsPointList( std::vector< P >& lst, const TString& name ) const
108 TParameters::iterator pIt = this->m_Parameters.find( name );
109 if( pIt == this->m_Parameters.end( ) )
111 if( pIt->second.first != Self::PointList )
115 std::cerr << "TODO GetValueAsPointList" << std::endl;
118 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__HXX__