00001 #ifndef SIO_RunEventMap_H
00002 #define SIO_RunEventMap_H 1
00003
00004 #include <map>
00005
00006 #include "LCIORandomAccess.h"
00007
00008 namespace SIO {
00009
00010 class RunEventMap ;
00011
00012 std::ostream & operator<<(std::ostream& os, const RunEventMap& rm ) ;
00013
00014
00020 class RunEventMap {
00021
00022
00023 friend std::ostream & operator<<(std::ostream& os, const RunEventMap& rm ) ;
00024
00025 public:
00026
00027 typedef std::map< RunEvent, long64> MapType ;
00028 typedef MapType::iterator Map_IT ;
00029 typedef MapType::const_iterator Map_cIT ;
00030
00031 static const int NPos = -1 ;
00032
00033 RunEventMap() ;
00034 ~RunEventMap() ;
00035
00038 void add(const RunEvent& re, long64 pos ) ;
00039
00043 long64 getPosition(const RunEvent& re ) {
00044 return getPosition( long64( re ) ) ;
00045 }
00046
00049 long64 getPosition( long64 re ) ;
00050
00051
00052
00053
00054 RunEvent minRunEvent() ;
00055
00056
00057
00058 RunEvent maxRunEvent() ;
00059
00060
00061 int getNumberOfEventRecords() const { return _nEvt ; }
00062
00063 int getNumberOfRunRecords() const { return _nRun ; }
00064
00065
00066 size_t size() { return _map.size() ; }
00067
00068 Map_IT begin() { return _map.begin() ; }
00069 Map_IT end() { return _map.end() ; }
00070 Map_cIT begin() const { return _map.begin() ; }
00071 Map_cIT end() const { return _map.end() ; }
00072 bool empty() const { return _map.empty() ; }
00073
00074 template <class InputIterator>
00075 void insert(InputIterator b, InputIterator e) { _map.insert( b , e ) ; }
00076
00077 void clear() { _map.clear() ; _nRun=0 ; _nEvt =0 ; }
00078
00079 protected:
00080
00081 MapType _map{} ;
00082
00083 int _nRun{0} ;
00084 int _nEvt{0} ;
00085
00086 };
00087 }
00088
00089 #endif