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 //printf("debug : tools::rroot::matrix::stream : version %d\n",v);
0046
0047 // Version 2 streaming (ROOT/v3-00-6).
0048
0049 {uint32 id,bits;
0050 if(!Object_stream(a_buffer,id,bits)) return false;}
0051
0052 int Nrows;
0053 if(!a_buffer.read(Nrows)) return false;
0054 int Ncols;
0055 if(!a_buffer.read(Ncols)) return false;
0056 int Nelems;
0057 if(!a_buffer.read(Nelems)) return false;
0058 int RowLwb;
0059 if(!a_buffer.read(RowLwb)) return false;
0060 int ColLwb;
0061 if(!a_buffer.read(ColLwb)) return false;
0062
0063 //Real_t* Elements; //[fNelems]
0064 if(!dummy_array_stream<float>(a_buffer,Nelems)) return false;
0065
0066 if(!a_buffer.check_byte_count(_s,_c,s_store_class())) return false;
0067 return true;
0068 }
0069
0070 public:
0071 matrix(){
0072 #ifdef TOOLS_MEM
0073 mem::increment(s_class().c_str());
0074 #endif
0075 }
0076 virtual ~matrix(){
0077 #ifdef TOOLS_MEM
0078 mem::decrement(s_class().c_str());
0079 #endif
0080 }
0081 protected:
0082 matrix(const matrix& a_from): iro(a_from){}
0083 matrix& operator=(const matrix&){return *this;}
0084 };
0085
0086 }}
0087
0088 #endif