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_sg_h2plot_cp 00005 #define inlib_sg_h2plot_cp 00006 00007 // Inheritance : 00008 #include "h2plot" 00009 00010 namespace inlib { 00011 namespace sg { 00012 00013 class h1d2plot_cp : public h1d2plot { 00014 public: 00015 static const std::string& s_class() { 00016 static const std::string s_v("inlib::sg::h1d2plot_cp"); 00017 return s_v; 00018 } 00019 public: 00020 virtual void* cast(const std::string& a_class) const { 00021 if(void* p = inlib::cmp_cast<h1d2plot_cp>(this,a_class)) {return p;} 00022 return h1d2plot::cast(a_class); 00023 } 00024 public: 00025 h1d2plot_cp(const inlib::histo::h1d& a_data) 00026 :h1d2plot(m_cp) //give ref of m_cp to h1d2plot. 00027 ,m_cp(a_data) //do a local copy. 00028 //WARNING : the upper is ok as long as h1d2plot constructor does nothing 00029 // else than keeping the ref to m_cp. Else it would do 00030 // something on an empty histo (and not on a copy of the 00031 // passed a_data). 00032 {} 00033 virtual ~h1d2plot_cp(){} 00034 private: 00035 h1d2plot_cp(const h1d2plot_cp& a_from) 00036 :plottable(a_from),bins1D(a_from),h1d2plot(m_cp) 00037 ,m_cp(a_from.m_cp) 00038 {} 00039 private: 00040 h1d2plot_cp& operator=(const h1d2plot_cp&){return *this;} 00041 private: 00042 inlib::histo::h1d m_cp; 00043 }; 00044 00045 class h2d2plot_cp : public h2d2plot { 00046 public: 00047 static const std::string& s_class() { 00048 static const std::string s_v("inlib::sg::h2d2plot_cp"); 00049 return s_v; 00050 } 00051 public: 00052 virtual void* cast(const std::string& a_class) const { 00053 if(void* p = inlib::cmp_cast<h2d2plot_cp>(this,a_class)) {return p;} 00054 return h2d2plot::cast(a_class); 00055 } 00056 public: 00057 h2d2plot_cp(const inlib::histo::h2d& a_data) 00058 :h2d2plot(m_cp) 00059 ,m_cp(a_data) 00060 {} 00061 virtual ~h2d2plot_cp(){} 00062 private: 00063 h2d2plot_cp(const h2d2plot_cp& a_from) 00064 :plottable(a_from),bins2D(a_from),h2d2plot(m_cp) 00065 ,m_cp(a_from.m_cp) 00066 {} 00067 private: 00068 h2d2plot_cp& operator=(const h2d2plot_cp&){return *this;} 00069 private: 00070 inlib::histo::h2d m_cp; 00071 }; 00072 00073 class p1d2plot_cp : public p1d2plot { 00074 public: 00075 static const std::string& s_class() { 00076 static const std::string s_v("inlib::sg::p1d2plot_cp"); 00077 return s_v; 00078 } 00079 public: 00080 virtual void* cast(const std::string& a_class) const { 00081 if(void* p = inlib::cmp_cast<p1d2plot_cp>(this,a_class)) {return p;} 00082 return p1d2plot::cast(a_class); 00083 } 00084 public: 00085 p1d2plot_cp(const inlib::histo::p1d& a_data) 00086 :p1d2plot(m_cp) 00087 ,m_cp(a_data) 00088 {} 00089 virtual ~p1d2plot_cp(){} 00090 private: 00091 p1d2plot_cp(const p1d2plot_cp& a_from) 00092 :plottable(a_from),bins1D(a_from),p1d2plot(m_cp) 00093 ,m_cp(a_from.m_cp) 00094 {} 00095 private: 00096 p1d2plot_cp& operator=(const p1d2plot_cp&){return *this;} 00097 private: 00098 inlib::histo::p1d m_cp; 00099 }; 00100 00101 }} 00102 00103 #endif