![]() |
HepMC Reference DocumentationHepMC |
00001 //-------------------------------------------------------------------------- 00002 #ifndef HEPMC_STREAM_HELPERS_H 00003 #define HEPMC_STREAM_HELPERS_H 00004 00006 // garren@fnal.gov, March 2009 00007 // 00008 // This header contains helper functions used by streaming IO 00010 00011 #include <ostream> 00012 #include <istream> 00013 00014 #include "HepMC/GenEvent.h" 00015 #include "HepMC/TempParticleMap.h" 00016 00017 namespace HepMC { 00018 00019 namespace detail { 00020 00022 std::ostream & establish_output_stream_info( std::ostream & ); 00024 std::istream & establish_input_stream_info( std::istream & ); 00025 00028 std::istream & read_vertex( std::istream &, TempParticleMap &, GenVertex * ); 00029 00032 std::istream & read_particle( std::istream&, TempParticleMap &, GenParticle * ); 00033 00035 inline std::ostream & output( std::ostream & os, const double& d ) { 00036 if( os ) { 00037 if ( d == 0. ) { 00038 os << ' ' << (int)0; 00039 } else { 00040 os << ' ' << d; 00041 } 00042 } 00043 return os; 00044 } 00045 00047 inline std::ostream & output( std::ostream & os, const float& d ) { 00048 if( os ) { 00049 if ( d == 0. ) { 00050 os << ' ' << (int)0; 00051 } else { 00052 os << ' ' << d; 00053 } 00054 } 00055 return os; 00056 } 00057 00059 inline std::ostream & output( std::ostream & os, const int& i ) { 00060 if( os ) { 00061 if ( i == 0. ) { 00062 os << ' ' << (int)0; 00063 } else { 00064 os << ' ' << i; 00065 } 00066 } 00067 return os; 00068 } 00069 00071 inline std::ostream & output( std::ostream & os, const long& i ) { 00072 if( os ) { 00073 if ( i == 0. ) { 00074 os << ' ' << (int)0; 00075 } else { 00076 os << ' ' << i; 00077 } 00078 } 00079 return os; 00080 } 00081 00083 inline std::ostream & output( std::ostream & os, const char& c ) { 00084 if( os ) { 00085 if ( c ) { 00086 os << c; 00087 } else { 00088 os << ' ' ; 00089 } 00090 } 00091 return os; 00092 } 00093 00095 std::istream & find_event_end( std::istream & ); 00096 00097 } // detail 00098 00099 } // HepMC 00100 00101 #endif // HEPMC_STREAM_HELPERS_H 00102 //--------------------------------------------------------------------------