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 , Vector , StringList ,
37 BoolList , IntList , UintList ,
38 RealList , IndexList , PointList ,
39 VectorList , Choices , NoType
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 ProcessObject* GetProcessObject( );
60 virtual const ProcessObject* GetProcessObject( ) const;
61 virtual void SetProcessObject( ProcessObject* v );
62 virtual void Modified( ) const;
64 // Parameters container configuration
67 void ConfigureAsString( const TString& name, const TString& v );
68 void ConfigureAsBool( const TString& name, const TBool& v );
69 void ConfigureAsInt( const TString& name, const TInt& v );
70 void ConfigureAsUint( const TString& name, const TUint& v );
71 void ConfigureAsReal( const TString& name, const TReal& v );
74 inline void ConfigureAsIndex(
75 const TString& name, const TUint& dim, const I& v
78 inline void ConfigureAsPoint(
79 const TString& name, const TUint& dim, const P& v
82 inline void ConfigureAsVector(
83 const TString& name, const TUint& dim, const V& v
86 void ConfigureAsStringList( const TString& name );
87 void ConfigureAsBoolList( const TString& name );
88 void ConfigureAsIntList( const TString& name );
89 void ConfigureAsUintList( const TString& name );
90 void ConfigureAsRealList( const TString& name );
91 void ConfigureAsIndexList( const TString& name );
92 void ConfigureAsPointList( const TString& name );
93 void ConfigureAsVectorList( const TString& name );
94 void ConfigureAsChoices(
95 const TString& name, const std::vector< TString >& choices
99 void GetNames( std::vector< TString >& container ) const;
100 Type GetType( const TString& name ) const;
102 bool HasString( const TString& name ) const;
103 bool HasBool( const TString& name ) const;
104 bool HasInt( const TString& name ) const;
105 bool HasUint( const TString& name ) const;
106 bool HasReal( const TString& name ) const;
107 bool HasIndex( const TString& name ) const;
108 bool HasPoint( const TString& name ) const;
109 bool HasVector( const TString& name ) const;
110 bool HasStringList( const TString& name ) const;
111 bool HasBoolList( const TString& name ) const;
112 bool HasIntList( const TString& name ) const;
113 bool HasUintList( const TString& name ) const;
114 bool HasRealList( const TString& name ) const;
115 bool HasIndexList( const TString& name ) const;
116 bool HasPointList( const TString& name ) const;
117 bool HasVectorList( const TString& name ) const;
118 bool HasChoices( const TString& name ) const;
120 TString GetString( const TString& name, bool force = true ) const;
121 TBool GetBool( const TString& name ) const;
122 TInt GetInt( const TString& name ) const;
123 TUint GetUint( const TString& name ) const;
124 TReal GetReal( const TString& name ) const;
127 std::vector< TString >& lst, const TString& name
130 std::vector< TBool >& lst, const TString& name
133 std::vector< TInt >& lst, const TString& name
136 std::vector< TUint >& lst, const TString& name
139 std::vector< TReal >& lst, const TString& name
143 std::vector< TString >& choices, const TString& name
145 TString GetSelectedChoice( const TString& name ) const;
148 inline I GetIndex( const TString& name, const TUint& dim ) const;
150 inline P GetPoint( const TString& name, const TUint& dim ) const;
152 inline V GetVector( const TString& name, const TUint& dim ) const;
155 inline void GetIndexList(
156 std::vector< I >& lst, const TString& name, const TUint& dim
159 inline void GetPointList(
160 std::vector< P >& lst, const TString& name, const TUint& dim
163 inline void GetVectorList(
164 std::vector< V >& lst, const TString& name, const TUint& dim
169 const TString& name, const TString& v, bool force = true
171 void SetBool( const TString& name, const TBool& v );
172 void SetInt( const TString& name, const TInt& v );
173 void SetUint( const TString& name, const TUint& v );
174 void SetReal( const TString& name, const TReal& v );
177 inline void SetIndex(
178 const TString& name, const TUint& dim, const I& v
181 inline void SetPoint(
182 const TString& name, const TUint& dim, const P& v
185 inline void SetVector(
186 const TString& name, const TUint& dim, const V& v
189 void AddToStringList( const TString& name, const TString& v );
190 void AddToBoolList( const TString& name, const TBool& v );
191 void AddToIntList( const TString& name, const TInt& v );
192 void AddToUintList( const TString& name, const TUint& v );
193 void AddToRealList( const TString& name, const TReal& v );
196 inline void AddToIndexList(
197 const TString& name, const TUint& dim, const I& v
200 inline void AddToPointList(
201 const TString& name, const TUint& dim, const P& v
204 inline void AddToVectorList(
205 const TString& name, const TUint& dim, const P& v
208 void ClearStringList( const TString& name );
209 void ClearBoolList( const TString& name );
210 void ClearIntList( const TString& name );
211 void ClearUintList( const TString& name );
212 void ClearRealList( const TString& name );
213 void ClearIndexList( const TString& name );
214 void ClearPointList( const TString& name );
215 void ClearVectorList( const TString& name );
217 bool SetSelectedChoice( const TString& name, const TString& choice );
221 virtual ~Parameters( );
222 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
225 // Purposely not implemented
226 Parameters( const Self& other );
227 Self& operator=( const Self& other );
230 TParameters m_Parameters;
231 ProcessObject* m_Process;
238 #include <cpPlugins/Interface/Parameters.hxx>
240 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__