SET(
EXAMPLES_PROGRAMS
+ example_TestParameters
example_LoadPlugins
example_ReadWriteImage
example_ReadImageSeriesWriteImage
--- /dev/null
+#error ACA VOY
+
+// eof - $RCSfile$
}
cpPlugins_Interface_Parameters_SetMacro( String );
+cpPlugins_Interface_Parameters_SetMacro( Bool );
cpPlugins_Interface_Parameters_SetMacro( Int );
cpPlugins_Interface_Parameters_SetMacro( Uint );
cpPlugins_Interface_Parameters_SetMacro( Real );
return( pIt->second.second );
}
+// -------------------------------------------------------------------------
+cpPlugins::Interface::Parameters::
+TBool cpPlugins::Interface::Parameters::
+GetValueAsBool( const TString& name ) const
+{
+ TParameters::const_iterator pIt = this->m_Parameters.find( name );
+ if( pIt == this->m_Parameters.end( ) )
+ return( TBool( false ) );
+ if( pIt->second.first != Self::Int )
+ return( TBool( false ) );
+ return( TBool( std::atoi( pIt->second.second.c_str( ) ) == 1 ) );
+}
+
// -------------------------------------------------------------------------
cpPlugins::Interface::Parameters::
TInt cpPlugins::Interface::Parameters::
{
}
+// -------------------------------------------------------------------------
+void cpPlugins::Interface::Parameters::
+GetValueAsBoolList( std::vector< TBool >& lst, const TString& name ) const
+{
+}
+
// -------------------------------------------------------------------------
void cpPlugins::Interface::Parameters::
GetValueAsIntList( std::vector< TInt >& lst, const TString& name ) const
enum Type
{
String = 0,
+ Bool,
Int,
Uint,
Real,
Index,
Point,
StringList,
+ BoolList,
IntList,
UintList,
RealList,
NoType
};
+ typedef bool TBool;
typedef long TInt;
typedef unsigned long TUint;
typedef double TReal;
void Clear( );
void Configure( const Self::Type& type, const TString& name );
void SetValueAsString( const TString& name, const TString& v );
+ void SetValueAsBool( const TString& name, const TBool& v );
void SetValueAsInt( const TString& name, const TInt& v );
void SetValueAsUint( const TString& name, const TUint& v );
void SetValueAsReal( const TString& name, const TReal& v );
const TString& name, const I& b, const I& e
);
+ template< class I >
+ void SetValueAsBoolList(
+ const TString& name, const I& b, const I& e
+ );
+
template< class I >
void SetValueAsIntList(
const TString& name, const I& b, const I& e
std::vector< TString > GetParameters( ) const;
Self::Type GetParameterType( const TString& name ) const;
const TString& GetValueAsString( const TString& name ) const;
+ TBool GetValueAsBool( const TString& name ) const;
TInt GetValueAsInt( const TString& name ) const;
TUint GetValueAsUint( const TString& name ) const;
TReal GetValueAsReal( const TString& name ) const;
void GetValueAsStringList(
std::vector< TString >& lst, const TString& name
) const;
+ void GetValueAsBoolList(
+ std::vector< TBool >& lst, const TString& name
+ ) const;
void GetValueAsIntList(
std::vector< TInt >& lst, const TString& name
) const;
}
cpPlugins_Interface_Parameters_SetListMacro( String );
+cpPlugins_Interface_Parameters_SetListMacro( Bool );
cpPlugins_Interface_Parameters_SetListMacro( Int );
cpPlugins_Interface_Parameters_SetListMacro( Uint );
cpPlugins_Interface_Parameters_SetListMacro( Real );
cpPlugins_Interface_Parameters_SetListMacro( Point );
// -------------------------------------------------------------------------
-template< class I >
-I cpPlugins::Interface::Parameters::
-GetValueAsIndex( const TString& name ) const
-{
- I idx;
- TParameters::iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- {
- if( pIt->second.first == Self::Index )
- {
- std::istringstream ss( pIt->second.second );
- std::string token;
- unsigned int i = 0;
- while( std::getline( ss, token, ',' ) )
- {
- if( token != "" )
- idx[ i++ ] = std::atoi( token.c_str( ) );
-
- } // elihw
-
- } // fi
-
- } // fi
- return( idx );
-}
-
-// -------------------------------------------------------------------------
-template< class P >
-P cpPlugins::Interface::Parameters::
-GetValueAsPoint( const TString& name ) const
-{
- P pnt;
- TParameters::iterator pIt = this->m_Parameters.find( name );
- if( pIt != this->m_Parameters.end( ) )
- {
- if( pIt->second.first == Self::Point )
- {
- std::istringstream ss( pIt->second.second );
- std::string token;
- unsigned int i = 0;
- while( std::getline( ss, token, ',' ) )
- {
- if( token != "" )
- pnt[ i++ ] = std::atof( token.c_str( ) );
-
- } // elihw
-
- } // fi
+#define cpPlugins_Interface_Parameters_SetIndexOrPointMacro( NAME, TYPE ) \
+ template< class T > \
+ T cpPlugins::Interface::Parameters:: \
+ GetValueAs##NAME( const TString& name ) const \
+ { \
+ T val; \
+ TParameters::iterator pIt = this->m_Parameters.find( name ); \
+ if( pIt != this->m_Parameters.end( ) ) \
+ { \
+ if( pIt->second.first == Self::NAME ) \
+ { \
+ std::istringstream ss( pIt->second.second ); \
+ std::string token; \
+ unsigned int i = 0; \
+ while( std::getline( ss, token, ',' ) ) \
+ { \
+ if( token != "" ) \
+ val[ i++ ] = TYPE( std::atof( token.c_str( ) ) ); \
+ \
+ } \
+ } \
+ } \
+ return( val ); \
+ }
- } // fi
- return( pnt );
-}
+cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Index, long );
+cpPlugins_Interface_Parameters_SetIndexOrPointMacro( Point, double );
// -------------------------------------------------------------------------
template< class I >