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 typedef std::pair< Self::Type, TString > TParameter;
49 typedef std::map< TString, TParameter > TParameters;
53 itkTypeMacro( cpPlugins::Interface::Parameters, itk::Object );
57 virtual ProcessObject* GetProcessObject( );
58 virtual const ProcessObject* GetProcessObject( ) const;
59 virtual void SetProcessObject( ProcessObject* v );
60 virtual void Modified( ) const;
62 // Parameters container configuration
65 void ConfigureAsString( const TString& name );
66 void ConfigureAsBool( const TString& name );
67 void ConfigureAsInt( const TString& name );
68 void ConfigureAsUint( const TString& name );
69 void ConfigureAsReal( const TString& name );
70 void ConfigureAsIndex( const TString& name );
71 void ConfigureAsPoint( const TString& name );
72 void ConfigureAsVector( const TString& name );
73 void ConfigureAsStringList( const TString& name );
74 void ConfigureAsBoolList( const TString& name );
75 void ConfigureAsIntList( const TString& name );
76 void ConfigureAsUintList( const TString& name );
77 void ConfigureAsRealList( const TString& name );
78 void ConfigureAsIndexList( const TString& name );
79 void ConfigureAsPointList( const TString& name );
80 void ConfigureAsVectorList( const TString& name );
81 void ConfigureAsChoices( const TString& name );
82 void ConfigureAsChoices(
83 const TString& name, const std::vector< TString >& choices
87 void GetNames( std::vector< TString >& container ) const;
88 Type GetType( const TString& name ) const;
90 bool HasString( const TString& name ) const;
91 bool HasBool( const TString& name ) const;
92 bool HasInt( const TString& name ) const;
93 bool HasUint( const TString& name ) const;
94 bool HasReal( const TString& name ) const;
95 bool HasIndex( const TString& name ) const;
96 bool HasPoint( const TString& name ) const;
97 bool HasVector( const TString& name ) const;
98 bool HasStringList( const TString& name ) const;
99 bool HasBoolList( const TString& name ) const;
100 bool HasIntList( const TString& name ) const;
101 bool HasUintList( const TString& name ) const;
102 bool HasRealList( const TString& name ) const;
103 bool HasIndexList( const TString& name ) const;
104 bool HasPointList( const TString& name ) const;
105 bool HasVectorList( const TString& name ) const;
106 bool HasChoices( const TString& name ) const;
108 TString GetString( const TString& name, bool force = true ) const;
109 TBool GetBool( const TString& name ) const;
110 TInt GetInt( const TString& name ) const;
111 TUint GetUint( const TString& name ) const;
112 TReal GetReal( const TString& name ) const;
115 std::vector< TString >& lst, const TString& name
118 std::vector< TBool >& lst, const TString& name
121 std::vector< TInt >& lst, const TString& name
124 std::vector< TUint >& lst, const TString& name
127 std::vector< TReal >& lst, const TString& name
131 std::vector< TString >& choices, const TString& name
133 TString GetSelectedChoice( const TString& name ) const;
136 inline I GetIndex( const TString& name, const TUint& dim ) const;
138 inline P GetPoint( const TString& name, const TUint& dim ) const;
140 inline V GetVector( const TString& name, const TUint& dim ) const;
143 inline void GetIndexList(
144 std::vector< I >& lst, const TString& name, const TUint& dim
147 inline void GetPointList(
148 std::vector< P >& lst, const TString& name, const TUint& dim
151 inline void GetVectorList(
152 std::vector< V >& lst, const TString& name, const TUint& dim
157 const TString& name, const TString& v, bool force = true
159 void SetBool( const TString& name, const TBool& v );
160 void SetInt( const TString& name, const TInt& v );
161 void SetUint( const TString& name, const TUint& v );
162 void SetReal( const TString& name, const TReal& v );
165 inline void SetIndex(
166 const TString& name, const TUint& dim, const I& v
169 inline void SetPoint(
170 const TString& name, const TUint& dim, const P& v
173 inline void SetVector(
174 const TString& name, const TUint& dim, const V& v
177 void AddToStringList( const TString& name, const TString& v );
178 void AddToBoolList( const TString& name, const TBool& v );
179 void AddToIntList( const TString& name, const TInt& v );
180 void AddToUintList( const TString& name, const TUint& v );
181 void AddToRealList( const TString& name, const TReal& v );
184 inline void AddToIndexList(
185 const TString& name, const TUint& dim, const I& v
188 inline void AddToPointList(
189 const TString& name, const TUint& dim, const P& v
192 inline void AddToVectorList(
193 const TString& name, const TUint& dim, const P& v
196 void ClearStringList( const TString& name );
197 void ClearBoolList( const TString& name );
198 void ClearIntList( const TString& name );
199 void ClearUintList( const TString& name );
200 void ClearRealList( const TString& name );
201 void ClearIndexList( const TString& name );
202 void ClearPointList( const TString& name );
203 void ClearVectorList( const TString& name );
205 bool SetSelectedChoice( const TString& name, const TString& choice );
209 virtual ~Parameters( );
210 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
213 // Purposely not implemented
214 Parameters( const Self& other );
215 Self& operator=( const Self& other );
218 TParameters m_Parameters;
219 ProcessObject* m_Process;
226 #include <cpPlugins/Interface/Parameters.hxx>
228 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__