g4tools  5.4.0
h2plot_cp
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_sg_h2plot_cp
5 #define tools_sg_h2plot_cp
6 
7 // Inheritance :
8 #include "h2plot"
9 
10 namespace tools {
11 namespace sg {
12 
13 class h1d2plot_cp : public h1d2plot {
14 public:
16 public:
17  virtual void* cast(const std::string& a_class) const {
18  if(void* p = cmp_cast<h1d2plot_cp>(this,a_class)) {return p;}
19  return h1d2plot::cast(a_class);
20  }
21 public:
22  virtual plottable* copy() const {return new h1d2plot_cp(*this);}
23 public:
24  h1d2plot_cp(const histo::h1d& a_data)
25  :h1d2plot(m_cp) //give ref of m_cp to h1d2plot.
26  ,m_cp(a_data) //do a local copy.
27  //WARNING : the upper is ok as long as h1d2plot constructor does nothing
28  // else than keeping the ref to m_cp. Else it would do
29  // something on an empty histo (and not on a copy of the
30  // passed a_data).
31  {
32 #ifdef TOOLS_MEM
33  mem::increment(s_class().c_str());
34 #endif
35  }
36  virtual ~h1d2plot_cp(){
37 #ifdef TOOLS_MEM
38  mem::decrement(s_class().c_str());
39 #endif
40  }
41 public:
42  h1d2plot_cp(const h1d2plot_cp& a_from)
43  :plottable(a_from)
44  ,bins1D(a_from)
45  ,h1d2plot(m_cp)
46  ,m_cp(a_from.m_cp)
47  {
48 #ifdef TOOLS_MEM
49  mem::increment(s_class().c_str());
50 #endif
51  }
53  h1d2plot::operator=(a_from);
54  m_cp = a_from.m_cp;
55  return *this;
56  }
57 public:
58  const histo::h1d& data() const {return m_cp;}
59  histo::h1d& data() {return m_cp;}
60 protected:
62 };
63 
64 class h2d2plot_cp : public h2d2plot {
65 public:
67 public:
68  virtual void* cast(const std::string& a_class) const {
69  if(void* p = cmp_cast<h2d2plot_cp>(this,a_class)) {return p;}
70  return h2d2plot::cast(a_class);
71  }
72 public:
73  virtual plottable* copy() const {return new h2d2plot_cp(*this);}
74 public:
75  h2d2plot_cp(const histo::h2d& a_data)
76  :h2d2plot(m_cp)
77  ,m_cp(a_data)
78  {
79 #ifdef TOOLS_MEM
80  mem::increment(s_class().c_str());
81 #endif
82  }
83  virtual ~h2d2plot_cp(){
84 #ifdef TOOLS_MEM
85  mem::decrement(s_class().c_str());
86 #endif
87  }
88 public:
89  h2d2plot_cp(const h2d2plot_cp& a_from)
90  :plottable(a_from),bins2D(a_from),h2d2plot(m_cp)
91  ,m_cp(a_from.m_cp)
92  {
93 #ifdef TOOLS_MEM
94  mem::increment(s_class().c_str());
95 #endif
96  }
98  h2d2plot::operator=(a_from);
99  m_cp = a_from.m_cp;
100  return *this;
101  }
102 protected:
104 };
105 
106 class p1d2plot_cp : public p1d2plot {
107 public:
109 public:
110  virtual void* cast(const std::string& a_class) const {
111  if(void* p = cmp_cast<p1d2plot_cp>(this,a_class)) {return p;}
112  return p1d2plot::cast(a_class);
113  }
114 public:
115  virtual plottable* copy() const {return new p1d2plot_cp(*this);}
116 public:
117  p1d2plot_cp(const histo::p1d& a_data)
118  :p1d2plot(m_cp)
119  ,m_cp(a_data)
120  {
121 #ifdef TOOLS_MEM
122  mem::increment(s_class().c_str());
123 #endif
124  }
125  virtual ~p1d2plot_cp(){
126 #ifdef TOOLS_MEM
127  mem::decrement(s_class().c_str());
128 #endif
129  }
130 public:
131  p1d2plot_cp(const p1d2plot_cp& a_from)
132  :plottable(a_from),bins1D(a_from),p1d2plot(m_cp)
133  ,m_cp(a_from.m_cp)
134  {
135 #ifdef TOOLS_MEM
136  mem::increment(s_class().c_str());
137 #endif
138  }
140  p1d2plot::operator=(a_from);
141  m_cp = a_from.m_cp;
142  return *this;
143  }
144 protected:
146 };
147 
148 }}
149 
150 #endif
tools::sg::p1d2plot_cp::p1d2plot_cp
p1d2plot_cp(const histo::p1d &a_data)
Definition: h2plot_cp:117
tools::histo::p1d
Definition: p1d:12
tools::sg::bins1D
Definition: plottables:13
tools::sg::p1d2plot_cp::p1d2plot_cp
p1d2plot_cp(const p1d2plot_cp &a_from)
Definition: h2plot_cp:131
tools::sg::bins2D
Definition: plottables:42
tools::sg::h2d2plot_cp::m_cp
histo::h2d m_cp
Definition: h2plot_cp:103
tools::histo::h1d
Definition: h1d:14
tools::sg::h2d2plot_cp::~h2d2plot_cp
virtual ~h2d2plot_cp()
Definition: h2plot_cp:83
tools::sg::h2d2plot::cast
virtual void * cast(const std::string &a_class) const
Definition: h2plot:205
tools::sg::h1d2plot_cp
Definition: h2plot_cp:13
tools::sg::plottable
Definition: plottable:15
tools::sg::p1d2plot_cp::operator=
p1d2plot_cp & operator=(const p1d2plot_cp &a_from)
Definition: h2plot_cp:139
h2plot
tools::sg::p1d2plot_cp::m_cp
histo::p1d m_cp
Definition: h2plot_cp:145
tools::histo::h2d
Definition: h2d:12
tools::sg::p1d2plot_cp::cast
virtual void * cast(const std::string &a_class) const
Definition: h2plot_cp:110
tools::sg::h2d2plot::operator=
h2d2plot & operator=(const h2d2plot &a_from)
Definition: h2plot:309
TOOLS_SCLASS
#define TOOLS_SCLASS(a_name)
Definition: S_STRING:41
tools::sg::p1d2plot_cp
Definition: h2plot_cp:106
tools::sg::h2d2plot_cp::copy
virtual plottable * copy() const
Definition: h2plot_cp:73
tools::sg::h2d2plot_cp
Definition: h2plot_cp:64
tools::sg::h2d2plot_cp::h2d2plot_cp
h2d2plot_cp(const h2d2plot_cp &a_from)
Definition: h2plot_cp:89
tools::sg::h1d2plot_cp::data
const histo::h1d & data() const
Definition: h2plot_cp:58
tools::sg::h2d2plot_cp::operator=
h2d2plot_cp & operator=(const h2d2plot_cp &a_from)
Definition: h2plot_cp:97
tools::sg::p1d2plot
Definition: h2plot:321
tools::sg::p1d2plot::operator=
p1d2plot & operator=(const p1d2plot &a_from)
Definition: h2plot:405
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::sg::h1d2plot::operator=
h1d2plot & operator=(const h1d2plot &a_from)
Definition: h2plot:188
tools::sg::p1d2plot_cp::~p1d2plot_cp
virtual ~p1d2plot_cp()
Definition: h2plot_cp:125
tools::sg::h2d2plot_cp::h2d2plot_cp
h2d2plot_cp(const histo::h2d &a_data)
Definition: h2plot_cp:75
tools::sg::h1d2plot_cp::h1d2plot_cp
h1d2plot_cp(const h1d2plot_cp &a_from)
Definition: h2plot_cp:42
tools::sg::p1d2plot_cp::copy
virtual plottable * copy() const
Definition: h2plot_cp:115
tools::sg::h2d2plot
Definition: h2plot:201
tools::sg::h2d2plot_cp::cast
virtual void * cast(const std::string &a_class) const
Definition: h2plot_cp:68
tools::sg::h1d2plot_cp::~h1d2plot_cp
virtual ~h1d2plot_cp()
Definition: h2plot_cp:36
tools::sg::h1d2plot_cp::m_cp
histo::h1d m_cp
Definition: h2plot_cp:61
tools::sg::h1d2plot_cp::h1d2plot_cp
h1d2plot_cp(const histo::h1d &a_data)
Definition: h2plot_cp:24
tools::sg::h1d2plot_cp::cast
virtual void * cast(const std::string &a_class) const
Definition: h2plot_cp:17
tools::sg::h1d2plot_cp::copy
virtual plottable * copy() const
Definition: h2plot_cp:22
tools::sg::h1d2plot_cp::operator=
h1d2plot_cp & operator=(const h1d2plot_cp &a_from)
Definition: h2plot_cp:52
tools::sg::p1d2plot::cast
virtual void * cast(const std::string &a_class) const
Definition: h2plot:325
tools::sg::h1d2plot
Definition: h2plot:27
tools::sg::h1d2plot_cp::data
histo::h1d & data()
Definition: h2plot_cp:59
tools::sg::h1d2plot::cast
virtual void * cast(const std::string &a_class) const
Definition: h2plot:31