Warning, /include/Geant4/tools/rroot/matrix 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_matrix
0005 #define tools_rroot_matrix
0006
0007 //NOTE : not yet tested.
0008
0009 #include "../scast"
0010 #include "buffer"
0011 #include "named"
0012
0013 namespace tools {
0014 namespace rroot {
0015
0016 class matrix : public virtual iro {
0017 static const std::string& s_store_class() {
0018 static const std::string s_v("TMatrix");
0019 return s_v;
0020 }
0021 public:
0022 static const std::string& s_class() {
0023 static const std::string s_v("tools::rroot::matrix");
0024 return s_v;
0025 }
0026 public: //iro
0027 virtual void* cast(const std::string& a_class) const {
0028 if(void* p = cmp_cast<matrix>(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 matrix(*this);}
0033 public:
0034 static cid id_class() {return matrix_cid();}
0035 virtual void* cast(cid a_class) const {
0036 if(void* p = cmp_cast<matrix>(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 // Version 2 streaming (ROOT/v3-00-6).
0046
0047 {uint32 id,bits;
0048 if(!Object_stream(a_buffer,id,bits)) return false;}
0049
0050 int Nrows;
0051 if(!a_buffer.read(Nrows)) return false;
0052 int Ncols;
0053 if(!a_buffer.read(Ncols)) return false;
0054 int Nelems;
0055 if(!a_buffer.read(Nelems)) return false;
0056 int RowLwb;
0057 if(!a_buffer.read(RowLwb)) return false;
0058 int ColLwb;
0059 if(!a_buffer.read(ColLwb)) return false;
0060
0061 if(!dummy_array_stream<float>(a_buffer,Nelems)) return false;
0062
0063 if(!a_buffer.check_byte_count(_s,_c,s_store_class())) return false;
0064 return true;
0065 }
0066
0067 public:
0068 matrix(){
0069 }
0070 virtual ~matrix(){
0071 }
0072 protected:
0073 matrix(const matrix& a_from): iro(a_from){}
0074 matrix& operator=(const matrix&){return *this;}
0075 };
0076
0077 }}
0078
0079 #endif