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>
20 // Some forward declarations
25 class cpPlugins_Interface_EXPORT Parameters
29 typedef Parameters Self;
30 typedef itk::Object Superclass;
31 typedef itk::SmartPointer< Self > Pointer;
32 typedef itk::SmartPointer< const Self > ConstPointer;
38 Point , Vector , StringList ,
39 BoolList , IntList , UintList ,
40 RealList , IndexList , PointList ,
41 VectorList , Choices , NoType
46 typedef unsigned long TUint;
48 typedef std::string TString;
50 typedef std::pair< Self::Type, TString > 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 );
68 void ConfigureAsBool( const TString& name );
69 void ConfigureAsInt( const TString& name );
70 void ConfigureAsUint( const TString& name );
71 void ConfigureAsReal( const TString& name );
72 void ConfigureAsIndex( const TString& name );
73 void ConfigureAsPoint( const TString& name );
74 void ConfigureAsVector( const TString& name );
75 void ConfigureAsStringList( const TString& name );
76 void ConfigureAsBoolList( const TString& name );
77 void ConfigureAsIntList( const TString& name );
78 void ConfigureAsUintList( const TString& name );
79 void ConfigureAsRealList( const TString& name );
80 void ConfigureAsIndexList( const TString& name );
81 void ConfigureAsPointList( const TString& name );
82 void ConfigureAsVectorList( const TString& name );
83 void ConfigureAsChoices( const TString& name );
84 void ConfigureAsChoices(
85 const TString& name, const std::vector< TString >& choices
89 void GetNames( std::vector< TString >& container ) const;
90 Type GetType( const TString& name ) const;
92 bool HasString( const TString& name ) const;
93 bool HasBool( const TString& name ) const;
94 bool HasInt( const TString& name ) const;
95 bool HasUint( const TString& name ) const;
96 bool HasReal( const TString& name ) const;
97 bool HasIndex( const TString& name ) const;
98 bool HasPoint( const TString& name ) const;
99 bool HasVector( const TString& name ) const;
100 bool HasStringList( const TString& name ) const;
101 bool HasBoolList( const TString& name ) const;
102 bool HasIntList( const TString& name ) const;
103 bool HasUintList( const TString& name ) const;
104 bool HasRealList( const TString& name ) const;
105 bool HasIndexList( const TString& name ) const;
106 bool HasPointList( const TString& name ) const;
107 bool HasVectorList( const TString& name ) const;
108 bool HasChoices( const TString& name ) const;
110 TString GetString( const TString& name, bool force = true ) const;
111 TBool GetBool( const TString& name ) const;
112 TInt GetInt( const TString& name ) const;
113 TUint GetUint( const TString& name ) const;
114 TReal GetReal( const TString& name ) const;
117 std::vector< TString >& lst, const TString& name
120 std::vector< TBool >& lst, const TString& name
123 std::vector< TInt >& lst, const TString& name
126 std::vector< TUint >& lst, const TString& name
129 std::vector< TReal >& lst, const TString& name
133 std::vector< TString >& choices, const TString& name
135 TString GetSelectedChoice( const TString& name ) const;
138 inline I GetIndex( const TString& name, const TUint& dim ) const;
140 inline P GetPoint( const TString& name, const TUint& dim ) const;
142 inline V GetVector( 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
153 inline void GetVectorList(
154 std::vector< V >& lst, const TString& name, const TUint& dim
159 const TString& name, const TString& v, bool force = true
161 void SetBool( const TString& name, const TBool& v );
162 void SetInt( const TString& name, const TInt& v );
163 void SetUint( const TString& name, const TUint& v );
164 void SetReal( const TString& name, const TReal& v );
167 inline void SetIndex(
168 const TString& name, const TUint& dim, const I& v
171 inline void SetPoint(
172 const TString& name, const TUint& dim, const P& v
175 inline void SetVector(
176 const TString& name, const TUint& dim, const V& v
179 void AddToStringList( const TString& name, const TString& v );
180 void AddToBoolList( const TString& name, const TBool& v );
181 void AddToIntList( const TString& name, const TInt& v );
182 void AddToUintList( const TString& name, const TUint& v );
183 void AddToRealList( const TString& name, const TReal& v );
186 inline void AddToIndexList(
187 const TString& name, const TUint& dim, const I& v
190 inline void AddToPointList(
191 const TString& name, const TUint& dim, const P& v
194 inline void AddToVectorList(
195 const TString& name, const TUint& dim, const P& v
198 void ClearStringList( const TString& name );
199 void ClearBoolList( const TString& name );
200 void ClearIntList( const TString& name );
201 void ClearUintList( const TString& name );
202 void ClearRealList( const TString& name );
203 void ClearIndexList( const TString& name );
204 void ClearPointList( const TString& name );
205 void ClearVectorList( const TString& name );
207 bool SetSelectedChoice( const TString& name, const TString& choice );
209 bool ToXML( TiXmlElement* parent_elem ) const;
210 bool FromXML( const TiXmlElement* filter_elem );
214 virtual ~Parameters( );
215 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
218 // Purposely not implemented
219 Parameters( const Self& other );
220 Self& operator=( const Self& other );
223 TParameters m_Parameters;
224 ProcessObject* m_Process;
231 #include <cpPlugins/Interface/Parameters.hxx>
233 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__