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 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 void ConfigureAsStringList( const TString& name );
83 void ConfigureAsBoolList( const TString& name );
84 void ConfigureAsIntList( const TString& name );
85 void ConfigureAsUintList( const TString& name );
86 void ConfigureAsRealList( const TString& name );
87 void ConfigureAsIndexList( const TString& name );
88 void ConfigureAsPointList( const TString& name );
89 void ConfigureAsChoices(
90 const TString& name, const std::vector< TString >& choices
94 void GetNames( std::vector< TString >& container ) const;
95 Type GetType( const TString& name ) const;
97 bool HasString( const TString& name ) const;
98 bool HasBool( const TString& name ) const;
99 bool HasInt( const TString& name ) const;
100 bool HasUint( const TString& name ) const;
101 bool HasReal( const TString& name ) const;
102 bool HasIndex( const TString& name ) const;
103 bool HasPoint( const TString& name ) const;
104 bool HasStringList( const TString& name ) const;
105 bool HasBoolList( const TString& name ) const;
106 bool HasIntList( const TString& name ) const;
107 bool HasUintList( const TString& name ) const;
108 bool HasRealList( const TString& name ) const;
109 bool HasIndexList( const TString& name ) const;
110 bool HasPointList( const TString& name ) const;
111 bool HasChoices( const TString& name ) const;
113 TString GetString( const TString& name ) const;
114 TBool GetBool( const TString& name ) const;
115 TInt GetInt( const TString& name ) const;
116 TUint GetUint( const TString& name ) const;
117 TReal GetReal( const TString& name ) const;
120 std::vector< TString >& lst, const TString& name
123 std::vector< TBool >& lst, const TString& name
126 std::vector< TInt >& lst, const TString& name
129 std::vector< TUint >& lst, const TString& name
132 std::vector< TReal >& lst, const TString& name
136 std::vector< TString >& choices, const TString& name
138 TString GetSelectedChoice( const TString& name ) const;
141 inline I GetIndex( const TString& name, const TUint& dim ) const;
143 inline P GetPoint( const TString& name, const TUint& dim ) const;
146 inline void GetIndexList(
147 std::vector< I >& lst, const TString& name, const TUint& dim
150 inline void GetPointList(
151 std::vector< P >& lst, const TString& name, const TUint& dim
155 void SetString( const TString& name, const TString& v );
156 void SetBool( const TString& name, const TBool& v );
157 void SetInt( const TString& name, const TInt& v );
158 void SetUint( const TString& name, const TUint& v );
159 void SetReal( const TString& name, const TReal& v );
162 inline void SetIndex(
163 const TString& name, const TUint& dim, const I& v
166 inline void SetPoint(
167 const TString& name, const TUint& dim, const P& v
170 void AddToStringList( const TString& name, const TString& v );
171 void AddToBoolList( const TString& name, const TBool& v );
172 void AddToIntList( const TString& name, const TInt& v );
173 void AddToUintList( const TString& name, const TUint& v );
174 void AddToRealList( const TString& name, const TReal& v );
177 inline void AddToIndexList(
178 const TString& name, const TUint& dim, const I& v
181 inline void AddToPointList(
182 const TString& name, const TUint& dim, const P& v
185 void ClearStringList( const TString& name );
186 void ClearBoolList( const TString& name );
187 void ClearIntList( const TString& name );
188 void ClearUintList( const TString& name );
189 void ClearRealList( const TString& name );
190 void ClearIndexList( const TString& name );
191 void ClearPointList( const TString& name );
193 bool SetSelectedChoice( const TString& name, const TString& choice );
197 virtual ~Parameters( );
198 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
201 // Purposely not implemented
202 Parameters( const Self& other );
203 Self& operator=( const Self& other );
206 TParameters m_Parameters;
207 ProcessObject* m_Process;
214 #include <cpPlugins/Interface/Parameters.hxx>
216 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__