1 #ifndef __CPPLUGINS__INTERFACE__PARAMETERS__H__
2 #define __CPPLUGINS__INTERFACE__PARAMETERS__H__
4 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
11 #include <itkObject.h>
12 #include <itkObjectFactory.h>
18 // Some forward declarations
23 class cpPlugins_Interface_EXPORT Parameters
27 typedef Parameters Self;
28 typedef itk::Object Superclass;
29 typedef itk::SmartPointer< Self > Pointer;
30 typedef itk::SmartPointer< const Self > ConstPointer;
36 Point , StringList , BoolList ,
37 IntList , UintList , RealList ,
38 IndexList , PointList , Choices ,
44 typedef unsigned long TUint;
46 typedef std::string TString;
48 // NOTE: std::pair< default, value >
49 typedef std::pair< TString, TString > TValues;
50 typedef std::pair< Self::Type, TValues > TParameter;
51 typedef std::map< TString, TParameter > TParameters;
55 itkTypeMacro( cpPlugins::Interface::Parameters, itk::Object );
59 virtual const ProcessObject* GetProcessObject( ) const;
60 virtual void SetProcessObject( ProcessObject* v );
61 virtual void Modified( ) const;
63 // Parameters container configuration
66 void ConfigureAsString( const TString& name, const TString& v );
67 void ConfigureAsBool( const TString& name, const TBool& v );
68 void ConfigureAsInt( const TString& name, const TInt& v );
69 void ConfigureAsUint( const TString& name, const TUint& v );
70 void ConfigureAsReal( const TString& name, const TReal& v );
73 inline void ConfigureAsIndex(
74 const TString& name, const TUint& dim, const I& v
77 inline void ConfigureAsPoint(
78 const TString& name, const TUint& dim, const P& v
81 void ConfigureAsStringList( const TString& name );
82 void ConfigureAsBoolList( const TString& name );
83 void ConfigureAsIntList( const TString& name );
84 void ConfigureAsUintList( const TString& name );
85 void ConfigureAsRealList( const TString& name );
86 void ConfigureAsIndexList( const TString& name );
87 void ConfigureAsPointList( const TString& name );
88 void ConfigureAsChoices(
89 const TString& name, const std::vector< TString >& choices
93 void GetNames( std::vector< TString >& container ) const;
94 Type GetType( const TString& name ) const;
96 bool HasString( const TString& name ) const;
97 bool HasBool( const TString& name ) const;
98 bool HasInt( const TString& name ) const;
99 bool HasUint( const TString& name ) const;
100 bool HasReal( const TString& name ) const;
101 bool HasIndex( const TString& name ) const;
102 bool HasPoint( const TString& name ) const;
103 bool HasStringList( const TString& name ) const;
104 bool HasBoolList( const TString& name ) const;
105 bool HasIntList( const TString& name ) const;
106 bool HasUintList( const TString& name ) const;
107 bool HasRealList( const TString& name ) const;
108 bool HasIndexList( const TString& name ) const;
109 bool HasPointList( const TString& name ) const;
110 bool HasChoices( const TString& name ) const;
112 TString GetString( const TString& name ) const;
113 TBool GetBool( const TString& name ) const;
114 TInt GetInt( const TString& name ) const;
115 TUint GetUint( const TString& name ) const;
116 TReal GetReal( const TString& name ) const;
119 std::vector< TString >& lst, const TString& name
122 std::vector< TBool >& lst, const TString& name
125 std::vector< TInt >& lst, const TString& name
128 std::vector< TUint >& lst, const TString& name
131 std::vector< TReal >& lst, const TString& name
135 std::vector< TString >& choices, const TString& name
137 TString GetSelectedChoice( const TString& name ) const;
140 inline I GetIndex( const TString& name, const TUint& dim ) const;
142 inline P GetPoint( const TString& name, const TUint& dim ) const;
145 inline void GetIndexList(
146 std::vector< I >& lst, const TString& name, const TUint& dim
149 inline void GetPointList(
150 std::vector< P >& lst, const TString& name, const TUint& dim
154 void SetString( const TString& name, const TString& v );
155 void SetBool( const TString& name, const TBool& v );
156 void SetInt( const TString& name, const TInt& v );
157 void SetUint( const TString& name, const TUint& v );
158 void SetReal( const TString& name, const TReal& v );
161 inline void SetIndex(
162 const TString& name, const TUint& dim, const I& v
165 inline void SetPoint(
166 const TString& name, const TUint& dim, const P& v
169 void AddToStringList( const TString& name, const TString& v );
170 void AddToBoolList( const TString& name, const TBool& v );
171 void AddToIntList( const TString& name, const TInt& v );
172 void AddToUintList( const TString& name, const TUint& v );
173 void AddToRealList( const TString& name, const TReal& v );
176 inline void AddToIndexList(
177 const TString& name, const TUint& dim, const I& v
180 inline void AddToPointList(
181 const TString& name, const TUint& dim, const P& v
184 void ClearStringList( const TString& name );
185 void ClearBoolList( const TString& name );
186 void ClearIntList( const TString& name );
187 void ClearUintList( const TString& name );
188 void ClearRealList( const TString& name );
189 void ClearIndexList( const TString& name );
190 void ClearPointList( const TString& name );
192 bool SetSelectedChoice( const TString& name, const TString& choice );
196 virtual ~Parameters( );
197 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
200 // Purposely not implemented
201 Parameters( const Self& other );
202 Self& operator=( const Self& other );
205 TParameters m_Parameters;
206 const ProcessObject* m_Process;
213 #include <cpPlugins/Interface/Parameters.hxx>
215 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__