Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/rroot/vector3 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_vector3
0005 #define tools_rroot_vector3
0006 
0007 #include "../scast"
0008 #include "object"
0009 #include "cids"
0010 
0011 namespace tools {
0012 namespace rroot {
0013 
0014 class vector3 : public virtual iro {
0015   typedef iro parent;
0016 private:
0017   static const std::string& s_store_class() {
0018     static const std::string s_v("TVector3");
0019     return s_v;
0020   }
0021 public:
0022   static const std::string& s_class() {
0023     static const std::string s_v("tools::rroot::vector3");
0024     return s_v;
0025   }
0026 public: //iro
0027   virtual void* cast(const std::string& a_class) const {
0028     if(void* p = cmp_cast<vector3>(this,a_class)) return p;
0029     return 0;
0030   }
0031   virtual const std::string& s_cls() const {return s_class();}
0032   virtual iro* copy() const {return new vector3(*this);}
0033 public:
0034   static cid id_class() {return vector3_cid();}
0035   virtual void* cast(cid a_class) const {
0036     if(void* p = cmp_cast<vector3>(this,a_class)) {return p;}
0037     else return 0;
0038   }
0039 public:
0040   virtual bool stream(buffer& a_buffer) {
0041     unsigned int _s,_c;
0042     short v;
0043     if(!a_buffer.read_version(v,_s,_c)) return false;
0044 
0045     //printf("debug : tools::rroot::vector3::stream : version %d\n",v);
0046 
0047    {uint32 id,bits;
0048     if(!Object_stream(a_buffer,id,bits)) return false;}
0049 
0050     if(!a_buffer.read(m_x)) return false;
0051     if(!a_buffer.read(m_y)) return false;
0052     if(!a_buffer.read(m_z)) return false;
0053 
0054     if(!a_buffer.check_byte_count(_s,_c,s_store_class())) return false;
0055     return true;
0056   }
0057 
0058 public:
0059   vector3():m_x(0),m_y(0),m_z(0){
0060 #ifdef TOOLS_MEM
0061     mem::increment(s_class().c_str());
0062 #endif
0063   }
0064   virtual ~vector3(){
0065 #ifdef TOOLS_MEM
0066     mem::decrement(s_class().c_str());
0067 #endif
0068   }
0069 public:
0070   vector3(const vector3& a_from)
0071   :parent(a_from)
0072   ,m_x(a_from.m_x),m_y(a_from.m_y),m_z(a_from.m_z)
0073   {}
0074   vector3& operator=(const vector3& a_from){
0075     m_x = a_from.m_x;
0076     m_y = a_from.m_y;
0077     m_z = a_from.m_z;
0078     return *this;
0079   }
0080 public:
0081   double x() const {return m_x;}
0082   double y() const {return m_y;}
0083   double z() const {return m_z;}
0084 private:
0085   double m_x,m_y,m_z;
0086 };
0087 
0088 }}
0089 
0090 #endif