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_graph 5 #define tools_rroot_graph 6 7 #include "../scast" 8 #include "buffer" 9 10 #include "cids" 11 12 namespace tools { 13 namespace rroot { 14 15 class graph : public virtual iro { 16 static const std::string& s_store_class() { 17 static const std::string s_v("TGraph"); 18 return s_v; 19 } 20 public: 21 static const std::string& s_class() { 22 static const std::string s_v("tools::rroot::graph"); 23 return s_v; 24 } 25 public: //iro 26 virtual void* cast(const std::string& a_class) const { 27 if(void* p = cmp_cast<graph>(this,a_class)) return p; 28 return 0; 29 } 30 virtual const std::string& s_cls() const {return s_class();} 31 public: 32 static cid id_class() {return graph_cid();} 33 virtual void* cast(cid a_class) const { 34 if(void* p = cmp_cast<graph>(this,a_class)) {return p;} 35 else return 0; 36 } 37 public: 38 virtual iro* copy() const {return new graph(*this);} 39 virtual bool stream(buffer& a_buffer) { 40 uint32 startpos = a_buffer.length(); 41 short v; 42 unsigned int _s,_c; 43 if(!a_buffer.read_version(v,_s,_c)) return false; 44 a_buffer.set_offset(startpos+_c+sizeof(unsigned int)); 45 if(!a_buffer.check_byte_count(_s,_c,s_store_class())) return false; 46 return true; 47 } 48 public: 49 graph(){ 50 #ifdef TOOLS_MEM 51 mem::increment(s_class().c_str()); 52 #endif 53 } 54 virtual ~graph(){ 55 #ifdef TOOLS_MEM 56 mem::decrement(s_class().c_str()); 57 #endif 58 } 59 protected: 60 graph(const graph& a_from): iro(a_from){} 61 graph& operator=(const graph&){return *this;} 62 }; 63 64 }} 65 66 #endif