Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 1 // Copyright (C) 2010, Guy Barrand. All rights reserved. 2 // See the file tools.license for terms. 2 // See the file tools.license for terms. 3 3 4 #ifndef tools_wroot_bufobj 4 #ifndef tools_wroot_bufobj 5 #define tools_wroot_bufobj 5 #define tools_wroot_bufobj 6 6 7 #include "iobject" 7 #include "iobject" 8 #include "buffer" 8 #include "buffer" 9 9 10 namespace tools { 10 namespace tools { 11 namespace wroot { 11 namespace wroot { 12 12 13 class bufobj : public virtual iobject,public b 13 class bufobj : public virtual iobject,public buffer { 14 public: 14 public: 15 static const std::string& s_class() { 15 static const std::string& s_class() { 16 static const std::string s_v("tools::wroot 16 static const std::string s_v("tools::wroot::bufobj"); 17 return s_v; 17 return s_v; 18 } 18 } 19 public: 19 public: 20 virtual const std::string& name() const {ret 20 virtual const std::string& name() const {return m_name;} 21 virtual const std::string& title() const {re 21 virtual const std::string& title() const {return m_title;} 22 virtual const std::string& store_class_name( 22 virtual const std::string& store_class_name() const {return m_store_cls;} 23 virtual bool stream(buffer& a_buffer) const 23 virtual bool stream(buffer& a_buffer) const {return a_buffer.write_fast_array(m_buffer,length());} 24 public: 24 public: 25 bufobj(std::ostream& a_out,bool a_byte_swap, 25 bufobj(std::ostream& a_out,bool a_byte_swap,uint32 a_size, 26 const std::string& a_name, 26 const std::string& a_name, 27 const std::string& a_title, 27 const std::string& a_title, 28 const std::string& a_store_cls) 28 const std::string& a_store_cls) 29 :buffer(a_out,a_byte_swap,a_size) 29 :buffer(a_out,a_byte_swap,a_size) 30 ,m_name(a_name) 30 ,m_name(a_name) 31 ,m_title(a_title) 31 ,m_title(a_title) 32 ,m_store_cls(a_store_cls) 32 ,m_store_cls(a_store_cls) 33 { 33 { 34 #ifdef TOOLS_MEM 34 #ifdef TOOLS_MEM 35 mem::increment(s_class().c_str()); 35 mem::increment(s_class().c_str()); 36 #endif 36 #endif 37 } 37 } 38 virtual ~bufobj(){ 38 virtual ~bufobj(){ 39 #ifdef TOOLS_MEM 39 #ifdef TOOLS_MEM 40 mem::decrement(s_class().c_str()); 40 mem::decrement(s_class().c_str()); 41 #endif 41 #endif 42 } 42 } 43 protected: 43 protected: 44 bufobj(const bufobj& a_from): iobject(a_from 44 bufobj(const bufobj& a_from): iobject(a_from),buffer(a_from){ 45 #ifdef TOOLS_MEM 45 #ifdef TOOLS_MEM 46 mem::increment(s_class().c_str()); 46 mem::increment(s_class().c_str()); 47 #endif 47 #endif 48 } 48 } 49 bufobj& operator=(const bufobj &){return *th 49 bufobj& operator=(const bufobj &){return *this;} 50 protected: 50 protected: 51 std::string m_name; 51 std::string m_name; 52 std::string m_title; 52 std::string m_title; 53 std::string m_store_cls; 53 std::string m_store_cls; 54 }; 54 }; 55 55 56 }} 56 }} 57 57 58 #endif 58 #endif