1 #ifndef __CPPLUGINS__INTERFACE__PARAMETERS__H__
2 #define __CPPLUGINS__INTERFACE__PARAMETERS__H__
8 #include <cpPlugins/Interface/cpPlugins_Interface_Export.h>
16 class cpPlugins_Interface_EXPORT Parameters
18 // -------------------------------------------------------------------
19 friend std::ostream& operator<<(
20 std::ostream& os, const Parameters& p
23 Parameters::TParameters::const_iterator pIt =
24 p.m_Parameters.begin( );
25 for( ; pIt != p.m_Parameters.end( ); ++pIt )
28 << pIt->first << ": ("
29 << pIt->second.first << ", "
30 << pIt->second.second << ")"
38 typedef Parameters Self;
44 Point , StringList , BoolList ,
45 IntList , UintList , RealList ,
46 IndexList , PointList , NoType
51 typedef unsigned long TUint;
53 typedef std::string TString;
55 typedef std::pair< Self::Type, TString > TParameter;
56 typedef std::map< TString, TParameter > TParameters;
60 Parameters( const Self& other );
61 virtual ~Parameters( );
63 Self& operator=( const Self& other );
66 void Configure( const Self::Type& type, const TString& name );
67 void SetValueAsString( const TString& name, const TString& v );
68 void SetValueAsBool( const TString& name, const TBool& v );
69 void SetValueAsInt( const TString& name, const TInt& v );
70 void SetValueAsUint( const TString& name, const TUint& v );
71 void SetValueAsReal( const TString& name, const TReal& v );
72 void SetValueAsIndex( const TString& name, const TUint& n, ... );
73 void SetValueAsPoint( const TString& name, const TUint& n, ... );
75 void AddValueToStringList( const TString& name, const TString& v );
76 void AddValueToBoolList( const TString& name, const TBool& v );
77 void AddValueToIntList( const TString& name, const TInt& v );
78 void AddValueToUintList( const TString& name, const TUint& v );
79 void AddValueToRealList( const TString& name, const TReal& v );
80 void AddValueToIndexList( const TString& name, const TUint& n, ... );
81 void AddValueToPointList( const TString& name, const TUint& n, ... );
83 void ClearStringList( const TString& name );
84 void ClearBoolList( const TString& name );
85 void ClearIntList( const TString& name );
86 void ClearUintList( const TString& name );
87 void ClearRealList( const TString& name );
88 void ClearIndexList( const TString& name );
89 void ClearPointList( const TString& name );
91 std::vector< TString > GetParameters( ) const;
92 Self::Type GetParameterType( const TString& name ) const;
93 const TString& GetRawValue( const TString& name ) const;
94 const TString& GetValueAsString( const TString& name ) const;
95 TBool GetValueAsBool( const TString& name ) const;
96 TInt GetValueAsInt( const TString& name ) const;
97 TUint GetValueAsUint( const TString& name ) const;
98 TReal GetValueAsReal( const TString& name ) const;
101 I GetValueAsIndex( const TString& name ) const;
104 P GetValueAsPoint( const TString& name ) const;
106 void GetValueAsStringList(
107 std::vector< TString >& lst, const TString& name
109 void GetValueAsBoolList(
110 std::vector< TBool >& lst, const TString& name
112 void GetValueAsIntList(
113 std::vector< TInt >& lst, const TString& name
115 void GetValueAsUintList(
116 std::vector< TUint >& lst, const TString& name
118 void GetValueAsRealList(
119 std::vector< TReal >& lst, const TString& name
123 void GetValueAsIndexList(
124 std::vector< I >& lst, const TString& name
128 void GetValueAsPointList(
129 std::vector< P >& lst, const TString& name
132 bool HasStringValue( const TString& name ) const;
133 bool HasBoolValue( const TString& name ) const;
134 bool HasIntValue( const TString& name ) const;
135 bool HasUintValue( const TString& name ) const;
136 bool HasRealValue( const TString& name ) const;
137 bool HasIndexValue( const TString& name ) const;
138 bool HasPointValue( const TString& name ) const;
139 bool HasStringListValue( const TString& name ) const;
140 bool HasBoolListValue( const TString& name ) const;
141 bool HasIntListValue( const TString& name ) const;
142 bool HasUintListValue( const TString& name ) const;
143 bool HasRealListValue( const TString& name ) const;
144 bool HasIndexListValue( const TString& name ) const;
145 bool HasPointListValue( const TString& name ) const;
148 TParameters m_Parameters;
155 #include <cpPlugins/Interface/Parameters.hxx>
157 #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__