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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/xy2plot (Version 11.3.0) and /externals/g4tools/include/tools/sg/xy2plot (Version 4.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_sg_xy2plot                          
  5 #define tools_sg_xy2plot                          
  6                                                   
  7 #include "plottables"                             
  8                                                   
  9 #include "../words"                               
 10 #include "../num2s"                               
 11 #include "../vmanip"                              
 12 #include "../mnmx"                                
 13 #include "../forit"                               
 14                                                   
 15 #ifdef TOOLS_MEM                                  
 16 #include "../mem"                                 
 17 #endif                                            
 18                                                   
 19 namespace tools {                                 
 20 namespace sg {                                    
 21                                                   
 22 template <class T>                                
 23 class xy2plot : public virtual points2D {         
 24   static const std::string& s_empty() {           
 25     static const std::string s_v("");             
 26     return s_v;                                   
 27   }                                               
 28 public: //plottable                               
 29   virtual plottable* copy() const {return new     
 30   virtual bool is_valid() const {return true;}    
 31   virtual const std::string& name() const {ret    
 32   virtual void set_name(const std::string& a_s    
 33   virtual const std::string& title() const {re    
 34   virtual const std::string& legend() const {r    
 35   virtual void set_legend(const std::string& a    
 36                                                   
 37   virtual void infos(const std::string& a_opts    
 38     a_sinfos.clear();                             
 39     std::string f_lf("\n");                       
 40     std::vector<std::string> ws;                  
 41     words(a_opts," ",false,ws);                   
 42     tools_vforcit(std::string,ws,it) {            
 43       if(((*it)=="name") && m_name.size()) {      
 44         if(a_sinfos.size()) a_sinfos += f_lf;     
 45         a_sinfos += "Name\n";                     
 46         a_sinfos += m_name;                       
 47                                                   
 48       } else if((*it)=="entries") {               
 49         if(a_sinfos.size()) a_sinfos += f_lf;     
 50         a_sinfos += "Entries\n";                  
 51         if(!numas<unsigned int>(mn<unsigned in    
 52                                                   
 53       }                                           
 54     }                                             
 55   }                                               
 56 public: //points2D                                
 57   virtual float x_axis_min() const {return flo    
 58   virtual float x_axis_max() const {return flo    
 59   virtual float y_axis_min() const {return flo    
 60   virtual float y_axis_max() const {return flo    
 61                                                   
 62   virtual unsigned int points() const {           
 63     return mn<unsigned int>(m_x.size(),m_y.siz    
 64   }                                               
 65   virtual bool ith_point(unsigned int a_index,    
 66     if(a_index>=m_x.size()) {a_x = T();a_y = T    
 67     if(a_index>=m_y.size()) {a_x = T();a_y = T    
 68     a_x = m_x[a_index];                           
 69     a_y = m_y[a_index];                           
 70     return true;                                  
 71   }                                               
 72 public:                                           
 73   typedef typename std::vector<T> data_t;         
 74 public:                                           
 75   xy2plot(const data_t& a_x,const data_t& a_y)    
 76   :m_x(a_x)                                       
 77   ,m_y(a_y)                                       
 78   {                                               
 79 #ifdef TOOLS_MEM                                  
 80     mem::increment(s_class().c_str());            
 81 #endif                                            
 82     minimum<T>(a_x,m_x_min);                      
 83     maximum<T>(a_x,m_x_max);                      
 84                                                   
 85     minimum<T>(a_y,m_y_min);                      
 86     maximum<T>(a_y,m_y_max);                      
 87   }                                               
 88   virtual ~xy2plot(){                             
 89 #ifdef TOOLS_MEM                                  
 90     mem::decrement(s_class().c_str());            
 91 #endif                                            
 92   }                                               
 93 public:                                           
 94   xy2plot(const xy2plot& a_from)                  
 95   :plottable(a_from),points2D(a_from)             
 96   ,m_x(a_from.m_x)                                
 97   ,m_y(a_from.m_y)                                
 98   ,m_name(a_from.m_name)                          
 99   ,m_legend(a_from.m_legend)                      
100   ,m_x_min(a_from.m_x_min)                        
101   ,m_x_max(a_from.m_x_max)                        
102   ,m_y_min(a_from.m_y_min)                        
103   ,m_y_max(a_from.m_y_max)                        
104   {                                               
105 #ifdef TOOLS_MEM                                  
106     mem::increment(s_class().c_str());            
107 #endif                                            
108   }                                               
109   xy2plot& operator=(const xy2plot& a_from){      
110     m_name = a_from.m_name;                       
111     m_legend = a_from.m_legend;                   
112     m_x_min = a_from.m_x_min;                     
113     m_x_max = a_from.m_x_max;                     
114     m_y_min = a_from.m_y_min;                     
115     m_y_max = a_from.m_y_max;                     
116     return *this;                                 
117   }                                               
118 protected:                                        
119   const data_t& m_x;                              
120   const data_t& m_y;                              
121   std::string m_name;                             
122   std::string m_legend;                           
123   T m_x_min;                                      
124   T m_x_max;                                      
125   T m_y_min;                                      
126   T m_y_max;                                      
127                                                   
128 private: static void check_instantiation() {      
129     std::vector<float> data;                      
130     xy2plot<float> dummy(data,data);              
131   }                                               
132 };                                                
133                                                   
134 }}                                                
135                                                   
136 #endif