Warning, /include/Geant4/tools/rroot/streamer_fac is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_rroot_streamer_fac
0005 #define tools_rroot_streamer_fac
0006
0007 #include "info"
0008 #include "iros"
0009
0010 namespace tools {
0011 namespace rroot {
0012
0013 class streamer_fac : public virtual ifac {
0014 public: //ifac
0015 virtual std::ostream& out() const {return m_out;}
0016 virtual iro* create(const std::string& a_class,const args& a_args) {
0017 // for read_sinfos() :
0018 if(rcmp(a_class,"TStreamerInfo")) {
0019 return new streamer_info(*this);
0020 } else if(rcmp(a_class,"TObjArray")) {
0021 std::string* sc = ifac::arg_class(a_args);
0022 if(sc) {
0023 if((*sc)==streamer_element::s_class()){
0024 return new obj_array<streamer_element>(*this);
0025 } else {
0026 m_out << "tools::rroot::streamer_fac::create :"
0027 << " Can't create TObjArray of " << *sc << "."
0028 << std::endl;
0029 return 0;
0030 }
0031 } else {
0032 return new iros(*this);
0033 }
0034 } else if(rcmp(a_class,"TStreamerBase")
0035 ||rcmp(a_class,"TStreamerBasicType")
0036 ||rcmp(a_class,"TStreamerBasicPointer")
0037 ||rcmp(a_class,"TStreamerObjectAny")
0038 ||rcmp(a_class,"TStreamerObject")
0039 ||rcmp(a_class,"TStreamerObjectPointer")
0040 ||rcmp(a_class,"TStreamerString")
0041 ||rcmp(a_class,"TStreamerSTL")
0042 ||rcmp(a_class,"TStreamerLoop")
0043 ||rcmp(a_class,"TList")
0044 ) {
0045 return new dummy_streamer_element();
0046
0047 } else {
0048 m_out << "tools::rroot::streamer_fac::create :"
0049 << " dummy. Can't create object of class " << sout(a_class) << "."
0050 << std::endl;
0051 }
0052 return 0;
0053 }
0054 public:
0055 streamer_fac(std::ostream& a_out):m_out(a_out){}
0056 virtual ~streamer_fac(){}
0057 protected:
0058 streamer_fac(const streamer_fac& a_from): ifac(a_from),m_out(a_from.m_out){}
0059 streamer_fac& operator=(const streamer_fac&){return *this;}
0060 protected:
0061 std::ostream& m_out;
0062 };
0063
0064 }}
0065
0066 #endif