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