Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 3 4 #ifndef tools_rroot_streamer_fac 5 #define tools_rroot_streamer_fac 6 7 #include "info" 8 #include "iros" 9 10 namespace tools { 11 namespace rroot { 12 13 class streamer_fac : public virtual ifac { 14 public: //ifac 15 virtual std::ostream& out() const {return m_out;} 16 virtual iro* create(const std::string& a_class,const args& a_args) { 17 // for read_sinfos() : 18 if(rcmp(a_class,"TStreamerInfo")) { 19 return new streamer_info(*this); 20 } else if(rcmp(a_class,"TObjArray")) { 21 std::string* sc = ifac::arg_class(a_args); 22 if(sc) { 23 if((*sc)==streamer_element::s_class()){ 24 return new obj_array<streamer_element>(*this); 25 } else { 26 m_out << "tools::rroot::streamer_fac::create :" 27 << " Can't create TObjArray of " << *sc << "." 28 << std::endl; 29 return 0; 30 } 31 } else { 32 return new iros(*this); 33 } 34 } else if(rcmp(a_class,"TStreamerBase") 35 ||rcmp(a_class,"TStreamerBasicType") 36 ||rcmp(a_class,"TStreamerBasicPointer") 37 ||rcmp(a_class,"TStreamerObjectAny") 38 ||rcmp(a_class,"TStreamerObject") 39 ||rcmp(a_class,"TStreamerObjectPointer") 40 ||rcmp(a_class,"TStreamerString") 41 ||rcmp(a_class,"TStreamerSTL") 42 ||rcmp(a_class,"TStreamerLoop") 43 ||rcmp(a_class,"TList") 44 ) { 45 return new dummy_streamer_element(); 46 47 } else { 48 m_out << "tools::rroot::streamer_fac::create :" 49 << " dummy. Can't create object of class " << sout(a_class) << "." 50 << std::endl; 51 } 52 return 0; 53 } 54 public: 55 streamer_fac(std::ostream& a_out):m_out(a_out){} 56 virtual ~streamer_fac(){} 57 protected: 58 streamer_fac(const streamer_fac& a_from): ifac(a_from),m_out(a_from.m_out){} 59 streamer_fac& operator=(const streamer_fac&){return *this;} 60 protected: 61 std::ostream& m_out; 62 }; 63 64 }} 65 66 #endif