Changeset 3132 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Jan 12, 2007, 2:26:57 PM (19 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/phistwrapper.h
r3125 r3132 12 12 13 13 //! Wrapper class interface for 1d-histogram like objects , used by PIHisto 14 // methodes par defaut dans pihisto.cc 14 15 class P1DHistoWrapper 15 16 { 16 17 public: 17 virtual ~P1DHistoWrapper() { } 18 P1DHistoWrapper(); 19 virtual ~P1DHistoWrapper(); 18 20 19 21 virtual int_4 NBins() = 0; … … 27 29 28 30 // Renvoie contenu du bin i 29 virtual r_8 operator()(int_4 i) = 0;31 virtual r_8 Value(int_4 i) = 0; 30 32 virtual r_8 Error(int_4 i) = 0; 31 33 34 inline r_8 operator()(int_4 i) { return ( Value(i)*mScale+mOff ); } 32 35 // Methode de mise a jour du contenu 33 36 // avec implementation par defaut - ne faisant rien … … 36 39 // ajoute des lignes de texte avec les infos statistiques (dans text) 37 40 // renvoie le nombre de lignes ajoutees - avec implementation par defaut 38 virtual int GetStatInfoAsText(vector<string> & /* text */ ) { return 0; } 41 virtual int GetStatInfoAsText(vector<string> & text ); 42 43 // Methode de decodage des options - avec implementation par defaut 44 // l'implementation par defaut ds le fichier pihisto.cc 45 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 46 47 protected: 48 r_8 mScale, mOff; // scaling coefficient, offset coefficient 39 49 40 50 }; -
trunk/SophyaPI/PIext/pihisto.cc
r3125 r3132 9 9 #include <typeinfo> 10 10 11 //RZDEL #include "sopnamsp.h"12 11 #include "pihisto.h" 12 13 //------ Implementation classe P1DHistoWrapper 14 P1DHistoWrapper::P1DHistoWrapper() 15 : mScale(1.) , mOff(0.) 16 { 17 } 18 19 P1DHistoWrapper::~P1DHistoWrapper() 20 { 21 } 22 23 int P1DHistoWrapper::GetStatInfoAsText(vector<string> & /* text */ ) 24 { 25 return 0; 26 } 27 28 int P1DHistoWrapper::DecodeOptionString(vector<string> & opt, bool rmdecopt) 29 { 30 if(opt.size() < 1) return(0); 31 32 vector<string> udopt; // On gardera ici les options non decodees 33 unsigned int k = 0; 34 int ndec = opt.size(); 35 for( k=0; k<opt.size(); k++ ) { 36 string & opts = opt[k]; 37 if(opts.substr(0,7) == "hs1") { 38 mScale = 1.; mOff = 0.; 39 } 40 else if(opts.substr(0,7) == "hscale=") { 41 mScale = atof(opts.substr(7).c_str()); 42 } 43 else if(opt[k].substr(0,8) == "hoffset=") { 44 mOff = atof(opts.substr(8).c_str()); 45 } 46 else { 47 ndec--; 48 // S'il faut supprimer les options decodees 49 if (rmdecopt) udopt.push_back(opts); 50 } 51 } 52 // S'il faut supprimer les options decodees, on remplace l'argument opt 53 // par le vecteur des options non decodees. 54 if (rmdecopt) opt = udopt; 55 return(ndec); 56 } 57 13 58 14 59 //++ … … 212 257 } 213 258 } 259 214 260 // S'il faut supprimer les options decodees, on remplace l'argument opt 215 261 // par le vecteur des options non decodees. 216 262 if (rmdecopt) opt = udopt; 217 return(ndec+ndec1); 263 264 // Decodage des options par le histo-wrapper 265 int ndec2 = 0; 266 if ( ( optsz1-ndec1-ndec > 0) && (mHisto) ) { 267 ndec2 = mHisto->DecodeOptionString(opt, rmdecopt); 268 } 269 return(ndec+ndec1+ndec2); 218 270 } 219 271 … … 246 298 info += " statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n"; 247 299 info += " as a fraction of total size \n"; 300 info += " ---- HistoWrapper options : \n" ; 301 info += " hscale=value : multiplicative factor (in Y) \n" ; 302 info += " hoffset=value : additive coefficient (in Y) \n" ; 303 info += " hs1 : set hscale=1 hoffset=0 (default) \n" ; 248 304 // On recupere ensuite la chaine info de la classe de base 249 305 PIDrawer::GetOptionsHelpInfo(info); -
trunk/SophyaPI/PIext/sohiswrap.h
r3125 r3132 38 38 virtual r_8 BinHighEdge(int_4 i) { return mHis->BinHighEdge(i) ; } 39 39 40 virtual r_8 operator()(int_4 i) { return (*mHis)(i) ; }40 virtual r_8 Value(int_4 i) { return (*mHis)(i) ; } 41 41 virtual r_8 Error(int_4 i) { return mHis->Error(i) ; } 42 42 … … 85 85 virtual r_8 BinHighEdge(int_4 i) { return mHis->BinHighEdge(i) ; } 86 86 87 virtual r_8 operator()(int_4 i) { return (*mHis)(i) ; }87 virtual r_8 Value(int_4 i) { return (*mHis)(i) ; } 88 88 virtual r_8 Error(int_4 i) { return mHis->Error(i) ; } 89 89
Note:
See TracChangeset
for help on using the changeset viewer.