Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/HepMC/StreamHelpers.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //--------------------------------------------------------------------------
0002 #ifndef HEPMC_STREAM_HELPERS_H
0003 #define HEPMC_STREAM_HELPERS_H
0004 
0005 //////////////////////////////////////////////////////////////////////////
0006 // garren@fnal.gov, March 2009
0007 //
0008 // This header contains helper functions used by streaming IO
0009 //////////////////////////////////////////////////////////////////////////
0010 
0011 #include <ostream>
0012 #include <istream>
0013 
0014 #include "HepMC/GenEvent.h"
0015 #include "HepMC/TempParticleMap.h"
0016 
0017 namespace HepMC {
0018 
0019 namespace detail {
0020 
0021 /// used by IO_GenEvent constructor
0022 std::ostream & establish_output_stream_info( std::ostream & );
0023 /// used by IO_GenEvent constructor
0024 std::istream & establish_input_stream_info( std::istream & );
0025 
0026 /// get a GenVertex from ASCII input
0027 /// TempParticleMap is used to track the associations of particles with vertices
0028 std::istream & read_vertex( std::istream &, TempParticleMap &, GenVertex * );
0029 
0030 /// get a GenParticle from ASCII input
0031 /// TempParticleMap is used to track the associations of particles with vertices
0032 std::istream & read_particle( std::istream&, TempParticleMap &, GenParticle * );
0033 
0034 /// write a double - for internal use by streaming IO
0035 inline std::ostream & output( std::ostream & os, const double& d ) {
0036     if( os  ) {
0037     if ( d == 0. ) {
0038         os << ' ' << (int)0;
0039     } else {
0040         os << ' ' << d;
0041     }
0042     }
0043     return os;
0044 }
0045 
0046 /// write a float - for internal use by streaming IO
0047 inline std::ostream & output( std::ostream & os, const float& d ) {
0048     if( os  ) {
0049     if ( d == 0. ) {
0050         os << ' ' << (int)0;
0051     } else {
0052         os << ' ' << d;
0053     }
0054     }
0055     return os;
0056 }
0057 
0058 /// write an int - for internal use by streaming IO
0059 inline std::ostream & output( std::ostream & os, const int& i ) { 
0060     if( os  ) {
0061     if ( i == 0. ) {
0062         os << ' ' << (int)0;
0063     } else {
0064             os << ' ' << i; 
0065     }
0066     }
0067     return os;
0068 }
0069 
0070 /// write a long - for internal use by streaming IO
0071 inline std::ostream & output( std::ostream & os, const long& i ) {
0072     if( os  ) {
0073     if ( i == 0. ) {
0074         os << ' ' << (int)0;
0075     } else {
0076             os << ' ' << i; 
0077     }
0078     }
0079     return os;
0080 }
0081 
0082 /// write a single char - for internal use by streaming IO
0083 inline std::ostream & output( std::ostream & os, const char& c ) {
0084     if( os  ) {
0085     if ( c ) {
0086             os << c; 
0087     } else {
0088         os << ' ' ;
0089     }
0090     }
0091     return os;
0092 }
0093 
0094 /// used to read to the end of a bad event
0095 std::istream & find_event_end( std::istream & );
0096 
0097 } // detail
0098 
0099 } // HepMC
0100 
0101 #endif  // HEPMC_STREAM_HELPERS_H
0102 //--------------------------------------------------------------------------