inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_wroot_bufobj 00005 #define inlib_wroot_bufobj 00006 00007 // inheritance : 00008 #include "iobject" 00009 #include "buffer" 00010 00011 namespace inlib { 00012 namespace wroot { 00013 00014 class bufobj : public virtual iobject,public buffer { 00015 public: 00016 static const std::string& s_class() { 00017 static const std::string s_v("inlib::wroot::bufobj"); 00018 return s_v; 00019 } 00020 public: 00021 virtual const std::string& name() const {return m_name;} 00022 virtual const std::string& title() const {return m_title;} 00023 virtual const std::string& store_class_name() const { 00024 return m_store_cls; 00025 } 00026 virtual bool stream(buffer& a_buffer) const { 00027 return a_buffer.write_fast_array(m_buffer,length()); 00028 } 00029 public: 00030 bufobj(std::ostream& a_out,bool a_byte_swap,uint32 a_size, 00031 const std::string& a_name, 00032 const std::string& a_title, 00033 const std::string& a_store_cls) 00034 : buffer(a_out,a_byte_swap,a_size) 00035 ,m_name(a_name) 00036 ,m_title(a_title) 00037 ,m_store_cls(a_store_cls) 00038 { 00039 #ifdef INLIB_MEM 00040 mem::increment(s_class().c_str()); 00041 #endif 00042 } 00043 virtual ~bufobj(){ 00044 #ifdef INLIB_MEM 00045 mem::decrement(s_class().c_str()); 00046 #endif 00047 } 00048 protected: 00049 bufobj(const bufobj& a_from): iobject(a_from),buffer(a_from){ 00050 #ifdef INLIB_MEM 00051 mem::increment(s_class().c_str()); 00052 #endif 00053 } 00054 bufobj& operator=(const bufobj &){return *this;} 00055 protected: 00056 std::string m_name; 00057 std::string m_title; 00058 std::string m_store_cls; 00059 }; 00060 00061 }} 00062 00063 #endif