hepmc - Diff between revs 2 and 65

Subversion Repositories:
Rev:
Show entire file - Ignore whitespace
Rev 2 Rev 65
Line 22... Line 22...
22 #include "HepMC/ParticleDataTable.h" 22 #include "HepMC/ParticleDataTable.h"
23 #include "HepMC/GenEvent.h" 23 #include "HepMC/GenEvent.h"
24 24
25 namespace HepMC { 25 namespace HepMC {
26 26
-   27     //! all input/output classes inherit from IO_BaseClass
-   28
-   29     ///
-   30     /// \class  IO_BaseClass
-   31     /// If you want to write a new IO class,
-   32     /// then inherit from this class and re-define read_event()
-   33     /// and write_event()
-   34     ///
27     class IO_BaseClass { 35     class IO_BaseClass {
28     public: 36     public:
29         virtual ~IO_BaseClass() {} 37         virtual ~IO_BaseClass() {}
30 38
-   39         /// write this GenEvent
31         virtual void write_event( const GenEvent* ) =0; 40         virtual void write_event( const GenEvent* ) =0;
-   41         /// fill this GenEvent
32         virtual bool fill_next_event( GenEvent* ) =0; 42         virtual bool fill_next_event( GenEvent* ) =0;
-   43         /// write this ParticleDataTable
33         virtual void write_particle_data_table( const ParticleDataTable* ) =0; 44         virtual void write_particle_data_table( const ParticleDataTable* ) =0;
-   45         /// fill this ParticleDataTable
34         virtual bool fill_particle_data_table( ParticleDataTable* ) =0; 46         virtual bool fill_particle_data_table( ParticleDataTable* ) =0;
-   47         /// write output to ostr
35         virtual void print( std::ostream& ostr = std::cout ) const; 48         virtual void print( std::ostream& ostr = std::cout ) const;
36         // 49         //
37         // the read_next_event() and read_particle_data_table() differ from 50         // the read_next_event() and read_particle_data_table() differ from
38         // the fill_***() methods in that they create a new event or pdt 51         // the fill_***() methods in that they create a new event or pdt
39         // before calling the  correspondingfill_*** method -  
-   52         // before calling the  corresponding fill_*** method
40         // (they are not intended to be over-ridden) 53         // (they are not intended to be over-ridden)
41         GenEvent*    read_next_event(); -  
42         ParticleDataTable* read_particle_data_table(); -  
-   54         GenEvent*    read_next_event();  //!< do not over-ride
-   55         ParticleDataTable* read_particle_data_table();  //!< do not over-ride
43         // 56         //
44         // The overloaded stream operators >>,<< are identical to 57         // The overloaded stream operators >>,<< are identical to
45         //   read_next_event and write_event methods respectively. 58         //   read_next_event and write_event methods respectively.
46         //   (or read_particle_data_table and write_particle_data_table) 59         //   (or read_particle_data_table and write_particle_data_table)
47         // the event argument for the overloaded stream operators is a pointer, 60         // the event argument for the overloaded stream operators is a pointer,
Line 50... Line 63...
50         //        io >> evt; 63         //        io >> evt;
51         // will give the expected result. 64         // will give the expected result.
52         // (note: I don't see any reason to have separate const and non-const 65         // (note: I don't see any reason to have separate const and non-const
53         //  versions of operator<<, but the pedantic ansi standard insists 66         //  versions of operator<<, but the pedantic ansi standard insists
54         //  on it) 67         //  on it)
-   68         /// the same as read_next_event
55         virtual       GenEvent*& operator>>( GenEvent*& ); 69         virtual       GenEvent*& operator>>( GenEvent*& );
-   70         /// the same as write_event
56         virtual const GenEvent*& operator<<( const GenEvent*& ); 71         virtual const GenEvent*& operator<<( const GenEvent*& );
-   72         /// the same as write_event
57         virtual       GenEvent*& operator<<( GenEvent*& ); 73         virtual       GenEvent*& operator<<( GenEvent*& );
-   74         /// the same as read_particle_data_table
58         virtual       ParticleDataTable*& operator>>( ParticleDataTable*& ); 75         virtual       ParticleDataTable*& operator>>( ParticleDataTable*& );
-   76         /// the same as write_particle_data_table
59         virtual const ParticleDataTable*& operator<<( const 77         virtual const ParticleDataTable*& operator<<( const
60                                                       ParticleDataTable*& ); 78                                                       ParticleDataTable*& );
-   79         /// the same as write_particle_data_table
61         virtual       ParticleDataTable*& operator<<( ParticleDataTable*& ); 80         virtual       ParticleDataTable*& operator<<( ParticleDataTable*& );
62     }; 81     };
63 82
64     ////////////// 83     //////////////
65     // Inlines  // 84     // Inlines  //
66     ////////////// 85     //////////////
67 86
68     inline GenEvent* IO_BaseClass::read_next_event() { 87     inline GenEvent* IO_BaseClass::read_next_event() {
69         // creates a new event and fills it by calling -  
70         // the sister method read_next_event( GenEvent* ) -  
-   88         /// creates a new event and fills it by calling
-   89         /// the sister method read_next_event( GenEvent* )
71         // 90         //
72         // 1. create an empty event container 91         // 1. create an empty event container
73         GenEvent* evt = new GenEvent(); 92         GenEvent* evt = new GenEvent();
74         // 2. fill the evt container - if the read is successful, return the 93         // 2. fill the evt container - if the read is successful, return the
75         //    pointer, otherwise return null and delete the evt 94         //    pointer, otherwise return null and delete the evt
Line 80... Line 99...
80         delete evt; 99         delete evt;
81         return 0; 100         return 0;
82     } 101     }
83 102
84     inline ParticleDataTable* IO_BaseClass::read_particle_data_table() { 103     inline ParticleDataTable* IO_BaseClass::read_particle_data_table() {
85         // creates a new particle data table and fills it by calling -  
86         // the sister method read_particle_data_table( ParticleDataTable* ) -  
-   104         /// creates a new particle data table and fills it by calling
-   105         /// the sister method read_particle_data_table( ParticleDataTable* )
87         // 106         //
88         // 1. create an empty pdt 107         // 1. create an empty pdt
89         ParticleDataTable* pdt = new ParticleDataTable(); 108         ParticleDataTable* pdt = new ParticleDataTable();
90         // 2. fill the pdt container - if the read is successful, return the 109         // 2. fill the pdt container - if the read is successful, return the
91         //    pointer, otherwise return null and delete the evt 110         //    pointer, otherwise return null and delete the evt