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 class cpPlugins_Interface_EXPORT Parameters
24 typedef Parameters Self;
25 typedef itk::Object Superclass;
26 typedef itk::SmartPointer< Self > Pointer;
27 typedef itk::SmartPointer< const Self > ConstPointer;
33 Point , StringList , BoolList ,
34 IntList , UintList , RealList ,
35 IndexList , PointList , Choices ,
41 typedef unsigned long TUint;
43 typedef std::string TString;
45 // NOTE: std::pair< default, value >
46 typedef std::pair< TString, TString > TValues;
47 typedef std::pair< Self::Type, TValues > TParameter;
48 typedef std::map< TString, TParameter > TParameters;
52 itkTypeMacro( cpPlugins::Interface::Parameters, itk::Object );
55 // Parameters container configuration
58 void ConfigureAsString( const TString& name, const TString& v );
59 void ConfigureAsBool( const TString& name, const TBool& v );
60 void ConfigureAsInt( const TString& name, const TInt& v );
61 void ConfigureAsUint( const TString& name, const TUint& v );
62 void ConfigureAsReal( const TString& name, const TReal& v );
65 inline void ConfigureAsIndex(
66 const TString& name, const TUint& dim, const I& v
69 inline void ConfigureAsPoint(
70 const TString& name, const TUint& dim, const P& v
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 ConfigureAsChoices(
81 const TString& name, const std::vector< TString >& choices
85 void GetNames( std::vector< TString >& container ) const;
86 Type GetType( const TString& name ) const;
88 bool HasString( const TString& name ) const;
89 bool HasBool( const TString& name ) const;
90 bool HasInt( const TString& name ) const;
91 bool HasUint( const TString& name ) const;
92 bool HasReal( const TString& name ) const;
93 bool HasIndex( const TString& name ) const;
94 bool HasPoint( const TString& name ) const;
95 bool HasStringList( const TString& name ) const;
96 bool HasBoolList( const TString& name ) const;
97 bool HasIntList( const TString& name ) const;
98 bool HasUintList( const TString& name ) const;
99 bool HasRealList( const TString& name ) const;
100 bool HasIndexList( const TString& name ) const;
101 bool HasPointList( const TString& name ) const;
102 bool HasChoices( const TString& name ) const;
104 TString GetString( const TString& name ) const;
105 TBool GetBool( const TString& name ) const;
106 TInt GetInt( const TString& name ) const;
107 TUint GetUint( const TString& name ) const;
108 TReal GetReal( const TString& name ) const;
111 std::vector< TString >& lst, const TString& name
114 std::vector< TBool >& lst, const TString& name
117 std::vector< TInt >& lst, const TString& name
120 std::vector< TUint >& lst, const TString& name
123 std::vector< TReal >& lst, const TString& name
127 std::vector< TString >& choices, const TString& name
129 TString GetSelectedChoice( const TString& name ) const;
132 inline I GetIndex( const TString& name, const TUint& dim ) const;
134 inline P GetPoint( const TString& name, const TUint& dim ) const;
137 inline void GetIndexList(
138 std::vector< I >& lst, const TString& name, const TUint& dim
141 inline void GetPointList(
142 std::vector< P >& lst, const TString& name, const TUint& dim
146 void SetString( const TString& name, const TString& v );
147 void SetBool( const TString& name, const TBool& v );
148 void SetInt( const TString& name, const TInt& v );
149 void SetUint( const TString& name, const TUint& v );
150 void SetReal( const TString& name, const TReal& v );
153 inline void SetIndex(
154 const TString& name, const TUint& dim, const I& v
157 inline void SetPoint(
158 const TString& name, const TUint& dim, const P& v
161 void AddToStringList( const TString& name, const TString& v );
162 void AddToBoolList( const TString& name, const TBool& v );
163 void AddToIntList( const TString& name, const TInt& v );
164 void AddToUintList( const TString& name, const TUint& v );
165 void AddToRealList( const TString& name, const TReal& v );
168 inline void AddToIndexList(
169 const TString& name, const TUint& dim, const I& v
172 inline void AddToPointList(
173 const TString& name, const TUint& dim, const P& v
176 void ClearStringList( const TString& name );
177 void ClearBoolList( const TString& name );
178 void ClearIntList( const TString& name );
179 void ClearUintList( const TString& name );
180 void ClearRealList( const TString& name );
181 void ClearIndexList( const TString& name );
182 void ClearPointList( const TString& name );
184 bool SetSelectedChoice( const TString& name, const TString& choice );
188 virtual ~Parameters( );
189 void PrintSelf( std::ostream& os, itk::Indent indent ) const;
192 // Purposely not implemented
193 Parameters( const Self& other );
194 Self& operator=( const Self& other );
197 TParameters m_Parameters;
204 #include <cpPlugins/Interface/Parameters.hxx>
206 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__