Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

StringParameters.h

00001 #ifndef StringParameters_h
00002 #define StringParameters_h 1
00003 
00004 #include "lcio.h"
00005 
00006 #ifdef LCIO_MAJOR_VERSION 
00007  #if LCIO_VERSION_GE( 1,2)  
00008   #include "LCIOSTLTypes.h"
00009  #endif
00010 #else
00011   #include "MarlinLCIOSTLTypes.h"
00012 #endif
00013 
00014 
00015 #include <vector>
00016 #include <string>
00017 #include <map>
00018 #include <iostream>
00019 
00020 
00021 typedef std::map< std::string ,  std::vector< std::string > >  ParametersMap ;
00022 
00023 
00024 using namespace lcio ;
00025 
00026 namespace marlin{
00027 
00034 class StringParameters {
00035   
00036   friend std::ostream& operator<< (  std::ostream& , StringParameters& ) ;
00037 
00038 public:
00039   
00040   StringParameters() ; 
00041   StringParameters( const StringParameters &sp ) ; 
00042 
00043   void add( const std::string& key , const std::vector<std::string> & values ) ;
00044   void add( const std::vector<std::string> & tokens ) ;
00045 
00046   void erase( const std::string& key ) ;
00047 
00048   bool isParameterSet(  const std::string& key ) ;
00049 
00050   int   getIntVal( const std::string& key ) ;
00051   float getFloatVal( const std::string& key ) ;
00052   const std::string& getStringVal( const std::string& key ) ;
00053 
00054   IntVec& getIntVals( const std::string& key ,  IntVec& intVec ) ;
00055   FloatVec& getFloatVals( const std::string& key ,  FloatVec& floatVec ) ;
00056   StringVec & getStringVals( const std::string& key  , StringVec & stringVec ) ;
00057 
00058   StringVec& getStringKeys( StringVec& stringVec );
00059   
00060   virtual ~StringParameters() ; 
00061   
00062 protected:
00063   ParametersMap _map ;
00064 
00065 };
00066 
00067 int intVal( const std::string& str) ;
00068 float floatVal( const std::string& str) ;
00069 std::ostream& operator<< (  std::ostream& s, StringParameters& p ) ;
00070 
00071 } // end namespace marlin 
00072 #endif

Generated on Mon Jan 12 09:48:51 2009 for Marlin by doxygen 1.3.5