Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

LCParametersImpl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef EVENT_LCPARAMETERSIMPL_H
00003 #define EVENT_LCPARAMETERSIMPL_H 1
00004 
00005 #include "EVENT/LCParameters.h"
00006 #include "IMPL/AccessChecked.h"
00007 
00008 #include <map>
00009 #include <vector>
00010 
00011 namespace IMPL {
00012 
00013 
00014   class LCRunHeaderImpl ;
00015   class LCEventImpl ;
00016   class LCCollectionVec ;
00017 
00018   typedef std::map< std::string, EVENT::IntVec >    IntMap ;
00019   typedef std::map< std::string, EVENT::FloatVec >  FloatMap ;
00020   typedef std::map< std::string, EVENT::StringVec > StringMap ;
00021   
00022 
00023   /** Implementation of Simple interface to store generic named parameters of type
00024    *  int, float and string. 
00025    *  It can be used  to store (user) meta data that is 
00026    *  run, event or collection dependent. 
00027    * 
00028    * @author gaede 
00029    * @version Jun 23, 2004
00030    * @see LCRunHeader.parameters()
00031    * @see LCEvent.parameters()
00032    * @see LCCollection.parameters()
00033    */
00034   
00035   class LCParametersImpl : public EVENT::LCParameters , public AccessChecked{
00036 
00037     friend class LCRunHeaderImpl ;
00038     friend class LCEventImpl ;
00039     friend class LCCollectionVec ;
00040     
00041   public: 
00042     
00043     LCParametersImpl() ; 
00044     
00045     /// Destructor.
00046     virtual ~LCParametersImpl() { /* nop */; }
00047     
00048     /** Returns the first integer value for the given key.
00049      */
00050     virtual int getIntVal(const std::string & key) const  ;
00051     
00052     /** Returns the first float value for the given key.
00053      */
00054     virtual float getFloatVal(const std::string & key) const ;
00055     
00056     /** Returns the first string value for the given key.
00057      */
00058     virtual const std::string & getStringVal(const std::string & key) const ;
00059     
00060     /** Adds all integer values for the given key to values.
00061      *  Returns a reference to values for convenience.
00062      */
00063     virtual EVENT::IntVec & getIntVals(const std::string & key, EVENT::IntVec & values) const ;
00064     
00065     /** Adds all float values for the given key to values.
00066      *  Returns a reference to values for convenience.
00067      */
00068     virtual EVENT::FloatVec & getFloatVals(const std::string & key, EVENT::FloatVec & values) const ;
00069     
00070     /** Adds all float values for the given key to values.
00071      *  Returns a reference to values for convenience.
00072      */
00073     virtual  EVENT::StringVec & getStringVals(const std::string & key, EVENT::StringVec & values) const ;
00074     
00075     /** Returns a list of all keys of integer parameters.
00076      */
00077     virtual const EVENT::StringVec & getIntKeys( EVENT::StringVec & keys) const  ;
00078 
00079     /** Returns a list of all keys of float parameters.
00080      */
00081     virtual const EVENT::StringVec & getFloatKeys(EVENT::StringVec & keys)  const ;
00082 
00083     /** Returns a list of all keys of string parameters.
00084      */
00085     virtual const EVENT::StringVec & getStringKeys(EVENT::StringVec & keys)  const ;
00086     
00087     /** The number of integer values stored for this key.
00088      */ 
00089     virtual int getNInt(const std::string & key) const ;
00090     
00091     /** The number of float values stored for this key.
00092      */ 
00093     virtual int getNFloat(const std::string & key) const ;
00094     
00095     /** The number of string values stored for this key.
00096      */ 
00097     virtual int getNString(const std::string & key) const ;
00098     
00099     /** Set integer value for the given key.
00100      */
00101     virtual void setValue(const std::string & key, int value) ;
00102 
00103     /** Set float value for the given key.
00104      */
00105     virtual void setValue(const std::string & key, float value) ;
00106 
00107     /** Set string value for the given key.
00108      */
00109     virtual void setValue(const std::string & key, const std::string & value) ;
00110 
00111     /** Set integer values for the given key.
00112      */
00113     virtual void setValues(const std::string & key, EVENT::IntVec & values);
00114 
00115     /** Set float values for the given key.
00116      */
00117     virtual void setValues(const std::string & key, EVENT::FloatVec & values);
00118 
00119     /** Set string values for the given key.
00120      */
00121     virtual void setValues(const std::string & key, EVENT::StringVec & values);
00122 
00123 
00124   protected:
00125 
00126     mutable IntMap _intMap ;
00127     mutable FloatMap _floatMap ;
00128     mutable StringMap _stringMap ;
00129     
00130   }; // class
00131 } // namespace IMPL
00132 #endif /* ifndef EVENT_LCPARAMETERSIMPL_H */

Generated on Sun Jun 3 06:31:59 2007 for A TPC Tracking Environment by  doxygen 1.3.9.1