All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
include/N3AnaBase/event/io.h
00001 #ifndef __N3AnaBase__io_h
00002 #define __N3AnaBase__io_h 1
00003 
00004 #include <stdexcept>
00005 #include <iostream>
00006 #include <sstream>
00007 #include <string>
00008 #include <typeinfo>
00009 
00010 // Boost serialization tools:
00011 #include <datatools/serialization/io_factory.h>
00012 
00013 #include <N3AnaBase/event/ana_event.h>
00014 
00015 namespace nemo3 {
00016 
00017   using namespace std;
00018   namespace ds = datatools::serialization;
00019 
00034 
00035   namespace io {
00036 
00037     struct constants 
00038     {
00039       static const bool IO_AR_MODE;
00040     };
00041 
00043     class store_mgr : public ds::data_writer
00044     {
00045     public:
00046 
00048       store_mgr ();
00049 
00051       virtual ~store_mgr ();
00052 
00054       void open (const string & filename_);
00055 
00057       void close ();
00058 
00060       void store_event (const ana_event & event_)
00061       {
00062         this->ds::data_writer::store<ana_event> (event_);
00063       }
00064 
00065     };
00066 
00068     class load_mgr : public ds::data_reader
00069     {
00070     public:
00071 
00073       load_mgr ();
00074 
00076       virtual ~load_mgr ();
00077 
00079       void open (const string & filename_);
00080 
00082       void close ();
00083 
00085       bool check_next_event ();
00086 
00088       bool has_next_event ();
00089 
00091       void load_event (ana_event & event_)
00092       {
00093         this->ds::data_reader::load<ana_event> (event_);
00094       }
00095 
00096     };
00097 
00099     void open_store (store_mgr & writer_,
00100                      const string & filename_);
00101 
00103     void close_store (store_mgr & writer_);
00104 
00106     void store_event (store_mgr & writer_, const ana_event & event_);
00107 
00109     void open_load (load_mgr & reader_,
00110                     const string & filename_);
00111 
00113     void close_load (load_mgr & reader_);
00114 
00116     bool check_next_event (load_mgr & reader_);
00117 
00119     bool has_next_event (load_mgr & reader_);
00120 
00122     void load_event (load_mgr & reader_, ana_event & event_);
00123 
00124   } // end of namespace io
00125 
00126 } // end of namespace nemo3
00127 
00128 #endif // __N3AnaBase__io_h
00129 
00130 // end of io.h