g4tools  5.4.0
graph
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_rroot_graph
5 #define tools_rroot_graph
6 
7 #include "../scast"
8 #include "buffer"
9 
10 #include "cids"
11 
12 namespace tools {
13 namespace rroot {
14 
15 class graph : public virtual iro {
16  static const std::string& s_store_class() {
17  static const std::string s_v("TGraph");
18  return s_v;
19  }
20 public:
21  static const std::string& s_class() {
22  static const std::string s_v("tools::rroot::graph");
23  return s_v;
24  }
25 public: //iro
26  virtual void* cast(const std::string& a_class) const {
27  if(void* p = cmp_cast<graph>(this,a_class)) return p;
28  return 0;
29  }
30  virtual const std::string& s_cls() const {return s_class();}
31 public:
32  static cid id_class() {return graph_cid();}
33  virtual void* cast(cid a_class) const {
34  if(void* p = cmp_cast<graph>(this,a_class)) {return p;}
35  else return 0;
36  }
37 public:
38  virtual iro* copy() const {return new graph(*this);}
39  virtual bool stream(buffer& a_buffer) {
40  uint32 startpos = a_buffer.length();
41  short v;
42  unsigned int s,c;
43  if(!a_buffer.read_version(v,s,c)) return false;
44  a_buffer.set_offset(startpos+c+sizeof(unsigned int));
45  if(!a_buffer.check_byte_count(s,c,s_store_class())) return false;
46  return true;
47  }
48 public:
49  graph(){
50 #ifdef TOOLS_MEM
51  mem::increment(s_class().c_str());
52 #endif
53  }
54  virtual ~graph(){
55 #ifdef TOOLS_MEM
56  mem::decrement(s_class().c_str());
57 #endif
58  }
59 protected:
60  graph(const graph& a_from): iro(a_from){}
61  graph& operator=(const graph&){return *this;}
62 };
63 
64 }}
65 
66 #endif
tools::rroot::graph::graph
graph()
Definition: graph:49
tools::rroot::graph::id_class
static cid id_class()
Definition: graph:32
tools::rroot::graph
Definition: graph:15
tools::rroot::buffer::check_byte_count
bool check_byte_count(uint32 a_start_pos, uint32 a_byte_count, const std::string &a_store_cls)
Definition: buffer:568
buffer
tools::rroot::graph::stream
virtual bool stream(buffer &a_buffer)
Definition: graph:39
tools::rroot::graph::operator=
graph & operator=(const graph &)
Definition: graph:61
tools::rroot::buffer::read_version
bool read_version(short &a_version)
Definition: buffer:503
tools::rroot::graph::s_class
static const std::string & s_class()
Definition: graph:21
tools::rroot::buffer::length
uint32 length() const
Definition: buffer:120
tools::rroot::graph::graph
graph(const graph &a_from)
Definition: graph:60
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::rroot::buffer::set_offset
void set_offset(unsigned int a_off)
Definition: buffer:117
tools::rroot::buffer
Definition: buffer:43
tools::rroot::graph::cast
virtual void * cast(cid a_class) const
Definition: graph:33
tools::rroot::graph::s_cls
virtual const std::string & s_cls() const
Definition: graph:30
tools::rroot::graph::copy
virtual iro * copy() const
Definition: graph:38
tools::rroot::iro
Definition: iro:19
cids
tools::rroot::graph::cast
virtual void * cast(const std::string &a_class) const
Definition: graph:26
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::rroot::graph::~graph
virtual ~graph()
Definition: graph:54
tools::rroot::graph_cid
cid graph_cid()
Definition: cids:28
tools::cid
unsigned short cid
Definition: cid:9