#ifndef __CPPLUGINS__INTERFACE__PARAMETERS__H__ #define __CPPLUGINS__INTERFACE__PARAMETERS__H__ #include #include #include #include #include namespace cpPlugins { namespace Interface { /** */ class cpPlugins_Interface_EXPORT Parameters { // ------------------------------------------------------------------- friend std::ostream& operator<<( std::ostream& os, const Parameters& p ) { Parameters::TParameters::const_iterator pIt = p.m_Parameters.begin( ); for( ; pIt != p.m_Parameters.end( ); ++pIt ) { os << pIt->first << ": (" << pIt->second.first << ", " << pIt->second.second << ")" << std::endl; } // rof return( os ); } public: typedef Parameters Self; enum Type { String , Bool , Int , Uint , Real , Index , Point , StringList , BoolList , IntList , UintList , RealList , IndexList , PointList , NoType }; typedef bool TBool; typedef long TInt; typedef unsigned long TUint; typedef double TReal; typedef std::string TString; typedef std::pair< Self::Type, TString > TParameter; typedef std::map< TString, TParameter > TParameters; public: Parameters( ); Parameters( const Self& other ); virtual ~Parameters( ); Self& operator=( const Self& other ); void Clear( ); void Configure( const Self::Type& type, const TString& name ); void SetValueAsString( const TString& name, const TString& v ); void SetValueAsBool( const TString& name, const TBool& v ); void SetValueAsInt( const TString& name, const TInt& v ); void SetValueAsUint( const TString& name, const TUint& v ); void SetValueAsReal( const TString& name, const TReal& v ); void SetValueAsIndex( const TString& name, const TUint& n, ... ); void SetValueAsPoint( const TString& name, const TUint& n, ... ); void AddValueToStringList( const TString& name, const TString& v ); void AddValueToBoolList( const TString& name, const TBool& v ); void AddValueToIntList( const TString& name, const TInt& v ); void AddValueToUintList( const TString& name, const TUint& v ); void AddValueToRealList( const TString& name, const TReal& v ); void AddValueToIndexList( const TString& name, const TUint& n, ... ); void AddValueToPointList( const TString& name, const TUint& n, ... ); void ClearStringList( const TString& name ); void ClearBoolList( const TString& name ); void ClearIntList( const TString& name ); void ClearUintList( const TString& name ); void ClearRealList( const TString& name ); void ClearIndexList( const TString& name ); void ClearPointList( const TString& name ); std::vector< TString > GetParameters( ) const; Self::Type GetParameterType( const TString& name ) const; const TString& GetRawValue( const TString& name ) const; const TString& GetValueAsString( const TString& name ) const; TBool GetValueAsBool( const TString& name ) const; TInt GetValueAsInt( const TString& name ) const; TUint GetValueAsUint( const TString& name ) const; TReal GetValueAsReal( const TString& name ) const; template< class I > I GetValueAsIndex( const TString& name ) const; template< class P > P GetValueAsPoint( const TString& name ) const; void GetValueAsStringList( std::vector< TString >& lst, const TString& name ) const; void GetValueAsBoolList( std::vector< TBool >& lst, const TString& name ) const; void GetValueAsIntList( std::vector< TInt >& lst, const TString& name ) const; void GetValueAsUintList( std::vector< TUint >& lst, const TString& name ) const; void GetValueAsRealList( std::vector< TReal >& lst, const TString& name ) const; template< class I > void GetValueAsIndexList( std::vector< I >& lst, const TString& name ) const; template< class P > void GetValueAsPointList( std::vector< P >& lst, const TString& name ) const; bool HasStringValue( const TString& name ) const; bool HasBoolValue( const TString& name ) const; bool HasIntValue( const TString& name ) const; bool HasUintValue( const TString& name ) const; bool HasRealValue( const TString& name ) const; bool HasIndexValue( const TString& name ) const; bool HasPointValue( const TString& name ) const; bool HasStringListValue( const TString& name ) const; bool HasBoolListValue( const TString& name ) const; bool HasIntListValue( const TString& name ) const; bool HasUintListValue( const TString& name ) const; bool HasRealListValue( const TString& name ) const; bool HasIndexListValue( const TString& name ) const; bool HasPointListValue( const TString& name ) const; protected: TParameters m_Parameters; }; } // ecapseman } // ecapseman #include #endif // __CPPLUGINS__INTERFACE__PARAMETERS__H__ // eof - $RCSfile$