+
+#include <itkObject.h>
+#include <itkObjectFactory.h>
+
+// Some forward declarations
+class TiXmlElement;
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Parameters_Configure( Y ) \
+ void ConfigureAs##Y( const std::string& name ) \
+ { \
+ this->m_Parameters[ name ] = TParameter( Self::Y, "" ); \
+ this->Modified( ); \
+ } \
+ bool Has##Y( const std::string& name ) const \
+ { \
+ auto i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ return( i->second.first == Self::Y ); \
+ else \
+ return( false ); \
+ }
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Parameters_GetSet( Y ) \
+ T##Y Get##Y( const std::string& name ) const \
+ { \
+ auto i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ { \
+ if( i->second.first == Self::Y ) \
+ { \
+ if( typeid( T##Y ) != typeid( std::string ) ) \
+ { \
+ std::istringstream tok_str( i->second.second ); \
+ T##Y v; \
+ tok_str >> v; \
+ return( v ); \
+ } \
+ else \
+ { \
+ const T##Y* ptr = \
+ reinterpret_cast< const T##Y* >( \
+ &( i->second.second ) \
+ ); \
+ return( *ptr ); \
+ } \
+ } \
+ } \
+ return( T##Y( 0 ) ); \
+ } \
+ void Set##Y( const std::string& name, const T##Y& v ) \
+ { \
+ auto i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ { \
+ if( i->second.first == Self::Y ) \
+ { \
+ if( typeid( T##Y ) != typeid( std::string ) ) \
+ { \
+ std::stringstream str; \
+ str << v; \
+ i->second.second = str.str( ); \
+ } \
+ else \
+ i->second.second = \
+ *( reinterpret_cast< const std::string* >( &v ) ); \
+ this->Modified( ); \
+ } \
+ } \
+ }
+
+// -------------------------------------------------------------------------
+#define cpPlugins_Parameters_GetSetList( Y ) \
+ std::vector< T##Y > Get##Y##List( const std::string& name ) const \
+ { \
+ std::vector< T##Y > lst; \
+ std::vector< std::string >* slst = \
+ reinterpret_cast< std::vector< std::string >* >( &lst ); \
+ auto i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ { \
+ if( i->second.first == Self::Y##List ) \
+ { \
+ std::istringstream str( i->second.second ); \
+ std::string token; \
+ while( std::getline( str, token, '#' ) ) \
+ { \
+ if( typeid( T##Y ) != typeid( std::string ) ) \
+ { \
+ std::istringstream tok_str( token ); \
+ T##Y v; \
+ tok_str >> v; \
+ lst.push_back( v ); \
+ } \
+ else \
+ slst->push_back( token ); \
+ } \
+ } \
+ } \
+ return( lst ); \
+ } \
+ void AddTo##Y##List( const std::string& name, const T##Y& v ) \
+ { \
+ auto i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ { \
+ if( i->second.first == Self::Y##List ) \
+ { \
+ std::stringstream str; \
+ if( i->second.second != "" ) \
+ str << i->second.second << "#"; \
+ str << v; \
+ i->second.second = str.str( ); \
+ } \
+ } \
+ } \
+ void Clear##Y##List( const std::string& name ) \
+ { \
+ auto i = this->m_Parameters.find( name ); \
+ if( i != this->m_Parameters.end( ) ) \
+ { \
+ if( i->second.first == Self::Y##List ) \
+ i->second.second = ""; \
+ } \
+ }