Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/rroot/dummy 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_dummy
0005 #define tools_rroot_dummy
0006 
0007 // dummy class with a generic streamer.
0008 // It is used within the reading of a tree
0009 // to create some generic object when we get
0010 // from the file a class name which is unknown
0011 // from the tree factory.
0012 
0013 #include "iro"
0014 
0015 #include "buffer"
0016 #include "../scast"
0017 #include "cids"
0018 
0019 namespace tools {
0020 namespace rroot {
0021 
0022 class dummy : public virtual iro {
0023 public:
0024   static const std::string& s_class() {
0025     static const std::string s_v("tools::rroot::dummy");
0026     return s_v;
0027   }
0028 public: //iro
0029   virtual void* cast(const std::string& a_class) const {
0030     if(void* p = cmp_cast<dummy>(this,a_class)) return p;
0031     return 0;
0032   }
0033   virtual const std::string& s_cls() const {return s_class();}
0034 public:
0035   static cid id_class() {return dummy_cid();}
0036   virtual void* cast(cid a_class) const {
0037     if(void* p = cmp_cast<dummy>(this,a_class)) {return p;}
0038     return 0;
0039   }
0040 public:
0041   virtual iro* copy() const {return new dummy(*this);}
0042   virtual bool stream(buffer& a_buffer) {
0043     //the below code skips correctly the data in the file.
0044     uint32 startpos = a_buffer.length();
0045     short v;
0046     unsigned int _s,_c;
0047     if(!a_buffer.read_version(v,_s,_c)) return false;
0048     a_buffer.set_offset(startpos+_c+sizeof(unsigned int));
0049     if(!a_buffer.check_byte_count(_s,_c,"dummy")) return false;
0050     return true;
0051   }
0052 public:
0053   dummy(){
0054 #ifdef TOOLS_MEM
0055     mem::increment(s_class().c_str());
0056 #endif
0057   }
0058   virtual ~dummy(){
0059 #ifdef TOOLS_MEM
0060     mem::decrement(s_class().c_str());
0061 #endif
0062   }
0063 public:
0064   dummy(const dummy& a_from): iro(a_from){
0065 #ifdef TOOLS_MEM
0066     mem::increment(s_class().c_str());
0067 #endif
0068   }
0069   dummy& operator=(const dummy&){return *this;}
0070 };
0071 
0072 }}
0073 
0074 #endif