| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

RootIOAddress.h

Go to the documentation of this file.
00001 
00014 #ifndef ROOTIOADDRESS_H
00015 #define ROOTIOADDRESS_H
00016 
00017 #include "RootIOSvc/RootInputStream.h"
00018 #include "RootIOSvc/RootOutputStream.h"
00019 
00020 
00021 #include "GaudiKernel/GenericAddress.h"
00022 
00023 #include <string>
00024 
00025 namespace RootIO {
00026     std::string branchname(const std::string tespath);
00027 }
00028 
00029 
00030 template<class StreamType>
00031 class RootIOAddress : public GenericAddress
00032 {
00033     mutable StreamType* m_stream;
00034 public:
00036     RootIOAddress(const CLID& clid, const std::string& tespath)
00037         : GenericAddress(ROOT_StorageType,clid,tespath), m_stream(0) {}
00038 
00039 
00040     // Store underlying stream for later use by converter
00041     void setStream(StreamType* stream) { m_stream = stream; }
00042 
00043     // Converter uses this
00044     StreamType* stream() const { return m_stream; }
00045 
00046 
00049     const std::string& tespath() const { return m_par[0]; }
00050 
00053     std::string tesdir() const {
00054         std::string::size_type slash = m_par[0].rfind('/');
00055         if (!slash || slash == std::string::npos) return "/";
00056         return m_par[0].substr(0,slash);
00057     }
00058 
00060     std::string treename() const {
00061         std::string::size_type slash = m_par[0].rfind('/');
00062         if (!slash || slash == std::string::npos) return m_par[0];
00063         return m_par[0].substr(slash+1);
00064     }
00065 
00067     std::string branchname() const {
00068         return RootIO::branchname(tespath());
00069     }
00070 
00071     int entry() const { return m_ipar[0]; }
00072     void setEntry(int entry) { m_ipar[0] = entry; }
00073 };
00074 
00075 
00076 class RootInputAddress : public RootIOAddress<RootInputStream>
00077 {
00078     bool m_read_done;
00079 public:
00080     // Initial construction
00081     RootInputAddress(const CLID& clid, const std::string& tespath);
00082     int fileNumber() { return m_ipar[1]; }
00083     void setFileNumber(int fn) { m_ipar[1] = fn; }
00084     bool readIsDone() { return m_read_done; }
00085     void readDone(bool tf = true) { m_read_done = tf; }
00086 };
00087 
00088 class RootOutputAddress : public RootIOAddress<RootOutputStream>
00089 {
00090 public:
00091     // Initial construction
00092     RootOutputAddress(const CLID& clid, const std::string& tespath);
00093 };
00094 
00095 #endif  // ROOTIOADDRESS_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:18:19 2011 for RootIOSvc by doxygen 1.4.7