1 #ifndef __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
2 #define __CPPLUGINS__INTERFACE__PARAMETERS__HXX__
7 // -------------------------------------------------------------------------
8 #define cpPlugins_Interface_Parameters_SetListMacro( TYPE ) \
10 void cpPlugins::Interface::Parameters:: \
11 SetValueAs##TYPE##List( const TString& name, const I& b, const I& e ) \
13 TParameters::iterator pIt = this->m_Parameters.find( name ); \
14 if( pIt == this->m_Parameters.end( ) ) \
16 if( pIt->second.first != Self::TYPE##List ) \
18 std::stringstream ss; \
19 for( I i = b; i != e; ++i ) \
21 pIt->second = ss.str( ); \
24 cpPlugins_Interface_Parameters_SetListMacro( String );
25 cpPlugins_Interface_Parameters_SetListMacro( Int );
26 cpPlugins_Interface_Parameters_SetListMacro( Uint );
27 cpPlugins_Interface_Parameters_SetListMacro( Real );
28 cpPlugins_Interface_Parameters_SetListMacro( Index );
29 cpPlugins_Interface_Parameters_SetListMacro( Point );
31 // -------------------------------------------------------------------------
33 I cpPlugins::Interface::Parameters::
34 GetValueAsIndex( const TString& name ) const
37 TParameters::iterator pIt = this->m_Parameters.find( name );
38 if( pIt != this->m_Parameters.end( ) )
40 if( pIt->second.first == Self::Index )
42 std::istringstream ss( pIt->second.second );
45 while( std::getline( ss, token, ',' ) )
48 idx[ i++ ] = std::atoi( token.c_str( ) );
58 // -------------------------------------------------------------------------
60 P cpPlugins::Interface::Parameters::
61 GetValueAsPoint( const TString& name ) const
64 TParameters::iterator pIt = this->m_Parameters.find( name );
65 if( pIt != this->m_Parameters.end( ) )
67 if( pIt->second.first == Self::Point )
69 std::istringstream ss( pIt->second.second );
72 while( std::getline( ss, token, ',' ) )
75 pnt[ i++ ] = std::atof( token.c_str( ) );
85 // -------------------------------------------------------------------------
87 void cpPlugins::Interface::Parameters::
88 GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const
91 TParameters::iterator pIt = this->m_Parameters.find( name );
92 if( pIt == this->m_Parameters.end( ) )
94 if( pIt->second.first != Self::IndexList )
100 // -------------------------------------------------------------------------
102 void cpPlugins::Interface::Parameters::
103 GetValueAsPointList( std::vector< P >& lst, const TString& name ) const
106 TParameters::iterator pIt = this->m_Parameters.find( name );
107 if( pIt == this->m_Parameters.end( ) )
109 if( pIt->second.first != Self::PointList )
115 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__HXX__