Fork me on GitHub

source: svn/trunk/Utilities/HepMC/interface/StreamHelpers.h@ 1037

Last change on this file since 1037 was 572, checked in by cp3-support, 13 years ago

upgrade HepMC to version 2.06.05

File size: 2.5 KB
Line 
1//--------------------------------------------------------------------------
2#ifndef HEPMC_STREAM_HELPERS_H
3#define HEPMC_STREAM_HELPERS_H
4
5//////////////////////////////////////////////////////////////////////////
6// garren@fnal.gov, March 2009
7//
8// This header contains helper functions used by streaming IO
9//////////////////////////////////////////////////////////////////////////
10
11#include <ostream>
12#include <istream>
13
14#include "GenEvent.h"
15#include "TempParticleMap.h"
16
17namespace HepMC {
18
19namespace detail {
20
21/// used by IO_GenEvent constructor
22std::ostream & establish_output_stream_info( std::ostream & );
23/// used by IO_GenEvent constructor
24std::istream & establish_input_stream_info( std::istream & );
25
26/// get a GenVertex from ASCII input
27/// TempParticleMap is used to track the associations of particles with vertices
28std::istream & read_vertex( std::istream &, TempParticleMap &, GenVertex * );
29
30/// get a GenParticle from ASCII input
31/// TempParticleMap is used to track the associations of particles with vertices
32std::istream & read_particle( std::istream&, TempParticleMap &, GenParticle * );
33
34/// write a double - for internal use by streaming IO
35inline std::ostream & output( std::ostream & os, const double& d ) {
36 if( os ) {
37 if ( d == 0. ) {
38 os << ' ' << (int)0;
39 } else {
40 os << ' ' << d;
41 }
42 }
43 return os;
44}
45
46/// write a float - for internal use by streaming IO
47inline std::ostream & output( std::ostream & os, const float& d ) {
48 if( os ) {
49 if ( d == 0. ) {
50 os << ' ' << (int)0;
51 } else {
52 os << ' ' << d;
53 }
54 }
55 return os;
56}
57
58/// write an int - for internal use by streaming IO
59inline std::ostream & output( std::ostream & os, const int& i ) {
60 if( os ) {
61 if ( i == 0. ) {
62 os << ' ' << (int)0;
63 } else {
64 os << ' ' << i;
65 }
66 }
67 return os;
68}
69
70/// write a long - for internal use by streaming IO
71inline std::ostream & output( std::ostream & os, const long& i ) {
72 if( os ) {
73 if ( i == 0. ) {
74 os << ' ' << (int)0;
75 } else {
76 os << ' ' << i;
77 }
78 }
79 return os;
80}
81
82/// write a single char - for internal use by streaming IO
83inline std::ostream & output( std::ostream & os, const char& c ) {
84 if( os ) {
85 if ( c ) {
86 os << c;
87 } else {
88 os << ' ' ;
89 }
90 }
91 return os;
92}
93
94/// used to read to the end of a bad event
95std::istream & find_event_end( std::istream & );
96
97} // detail
98
99} // HepMC
100
101#endif // HEPMC_STREAM_HELPERS_H
102//--------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.