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 {uint32 id,bits;
0046 if(!Object_stream(a_buffer,id,bits)) return false;}
0047
0048 if(!a_buffer.read(m_x)) return false;
0049 if(!a_buffer.read(m_y)) return false;
0050 if(!a_buffer.read(m_z)) return false;
0051
0052 if(!a_buffer.check_byte_count(_s,_c,s_store_class())) return false;
0053 return true;
0054 }
0055
0056 public:
0057 vector3():m_x(0),m_y(0),m_z(0){
0058 }
0059 virtual ~vector3(){
0060 }
0061 public:
0062 vector3(const vector3& a_from)
0063 :parent(a_from)
0064 ,m_x(a_from.m_x),m_y(a_from.m_y),m_z(a_from.m_z)
0065 {}
0066 vector3& operator=(const vector3& a_from){
0067 m_x = a_from.m_x;
0068 m_y = a_from.m_y;
0069 m_z = a_from.m_z;
0070 return *this;
0071 }
0072 public:
0073 double x() const {return m_x;}
0074 double y() const {return m_y;}
0075 double z() const {return m_z;}
0076 private:
0077 double m_x,m_y,m_z;
0078 };
0079
0080 }}
0081
0082 #endif