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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/rroot/base_leaf (Version 11.3.0) and /externals/g4tools/include/tools/rroot/base_leaf (Version 10.6.p2)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_rroot_base_leaf                     
  5 #define tools_rroot_base_leaf                     
  6                                                   
  7 #ifdef TOOLS_MEM                                  
  8 #include "../mem"                                 
  9 #endif                                            
 10                                                   
 11 #include "named"                                  
 12                                                   
 13 namespace tools {                                 
 14 namespace rroot {                                 
 15                                                   
 16 class base_leaf : public virtual iro {            
 17 public:                                           
 18   static const std::string& s_class() {           
 19     static const std::string s_v("tools::rroot    
 20     return s_v;                                   
 21   }                                               
 22 public: //iro                                     
 23   virtual void* cast(const std::string& a_clas    
 24     if(void* p = cmp_cast<base_leaf>(this,a_cl    
 25     return 0;                                     
 26   }                                               
 27   virtual const std::string& s_cls() const {re    
 28 public:                                           
 29   static cid id_class() {return base_leaf_cid(    
 30   virtual void* cast(cid a_class) const {         
 31     if(void* p = cmp_cast<base_leaf>(this,a_cl    
 32     else return 0;                                
 33   }                                               
 34 public:                                           
 35   virtual bool stream(buffer& a_buffer) {         
 36     if(m_own_leaf_count) {                        
 37       if(a_buffer.map_objs()) a_buffer.remove_    
 38       delete m_leaf_count;                        
 39     }                                             
 40     m_leaf_count = 0;                             
 41     m_own_leaf_count = false;                     
 42                                                   
 43     int fOffset;                                  
 44     bool fIsUnsigned;                             
 45                                                   
 46     short v;                                      
 47     unsigned int _s,_c;                           
 48     if(!a_buffer.read_version(v,_s,_c)) return    
 49     //FIXME if (v > 1) {                          
 50     //TLeaf::Class()->ReadBuffer(b, this, R__v    
 51     //FIXME } else {                              
 52     //====process old versions before automati    
 53     if(!Named_stream(a_buffer,m_name,m_title))    
 54                                                   
 55     // Ok with v 1 & 2                            
 56     if(!a_buffer.read(m_length)) return false;    
 57     if(!a_buffer.read(m_length_type)) return f    
 58     if(!a_buffer.read(fOffset)) return false;     
 59     if(!a_buffer.read(m_is_range)) return fals    
 60     if(!a_buffer.read(fIsUnsigned)) return fal    
 61                                                   
 62    {ifac::args args;                              
 63     iro* obj;                                     
 64     bool created;                                 
 65     if(!a_buffer.read_object(m_fac,args,obj,cr    
 66       m_out << "tools::rroot::base_leaf::strea    
 67             << " can't read object."              
 68             << std::endl;                         
 69       return false;                               
 70     }                                             
 71     if(!obj) {                                    
 72       //m_out << "tools::rroot::base_leaf::str    
 73       //      << " null leaf count object."       
 74       //      << std::endl;                       
 75     } else {                                      
 76       m_leaf_count = safe_cast<iro,base_leaf>(    
 77       if(!m_leaf_count) {                         
 78         m_out << "tools::rroot::base_leaf::str    
 79               << " can't cast base_leaf."         
 80               << std::endl;                       
 81         m_leaf_count = 0;                         
 82         if(created) {                             
 83           if(a_buffer.map_objs()) a_buffer.rem    
 84           delete obj;                             
 85         }                                         
 86         return false;                             
 87       }                                           
 88       if(created) m_own_leaf_count = true;        
 89     }}                                            
 90                                                   
 91     if(!a_buffer.check_byte_count(_s,_c,"TLeaf    
 92                                                   
 93     if(!m_length) m_length = 1;                   
 94 /*                                                
 95     fNewValue = false;                            
 96     if(!setAddress(0)) return false;              
 97 */                                                
 98     return true;                                  
 99   }                                               
100 public:                                           
101   virtual bool read_buffer(buffer&) = 0;          
102   virtual bool print_value(std::ostream&,uint3    
103   virtual uint32 num_elem() const = 0;            
104 public:                                           
105   base_leaf(std::ostream& a_out,ifac& a_fac)      
106   :m_out(a_out)                                   
107   ,m_fac(a_fac)                                   
108   ,m_name("")                                     
109   ,m_title("")                                    
110                                                   
111   //,fIndirectAddress(false)                      
112   //,fNewValue(false)                             
113   //,m_ndata(0)                                   
114   ,m_length(0)                                    
115   ,m_length_type(0)                               
116 //,fOffset(0)                                     
117   ,m_is_range(false)                              
118 //,fIsUnsigned(false)                             
119   ,m_leaf_count(0)                                
120   ,m_own_leaf_count(false)                        
121   {                                               
122 #ifdef TOOLS_MEM                                  
123     mem::increment(s_class().c_str());            
124 #endif                                            
125   }                                               
126   virtual ~base_leaf(){                           
127     if(m_own_leaf_count) delete m_leaf_count;     
128 #ifdef TOOLS_MEM                                  
129     mem::decrement(s_class().c_str());            
130 #endif                                            
131   }                                               
132 protected:                                        
133   base_leaf(const base_leaf& a_from)              
134   :iro(a_from)                                    
135   ,m_out(a_from.m_out)                            
136   ,m_fac(a_from.m_fac)                            
137   //,m_ndata(0)                                   
138   ,m_length(0)                                    
139   ,m_length_type(0)                               
140   ,m_is_range(false)                              
141   ,m_leaf_count(0)                                
142   ,m_own_leaf_count(false)                        
143   {}                                              
144   base_leaf& operator=(const base_leaf&){retur    
145 public:                                           
146   const std::string& name() const {return m_na    
147   const std::string& title() const {return m_t    
148   const base_leaf* leaf_count() const {return     
149 /*                                                
150   uint32 length() const {                         
151     // Return the number of effective elements    
152     if(m_leaf_count) {                            
153       m_out << "tools::rroot::base_leaf::lengt    
154             << " m_leaf_count not null. Case n    
155             << std::endl;                         
156       return m_length;                            
157                                                   
158       //uint32 len = m_leaf_count->number();      
159       //if (len > fLeafCount->maximum()) {        
160       //  m_out << "tools::rroot::base_leaf::l    
161       //        << fName << ", len=" << len <<    
162       //        << fLeafCount->maximum()          
163       //        << std::endl;                     
164       //  len = fLeafCount->maximum();            
165       //}                                         
166       //return len * fLength;                     
167                                                   
168     } else {                                      
169       return m_length;                            
170     }                                             
171   }                                               
172 */                                                
173 protected:                                        
174   std::ostream& m_out;                            
175   ifac& m_fac;                                    
176 protected: //Named                                
177   std::string m_name;                             
178   std::string m_title;                            
179   //bool fIndirectAddress;                        
180   //bool fNewValue;                               
181 //uint32 m_ndata;           //! Number of elem    
182   uint32 m_length;          //  Number of fixe    
183   uint32 m_length_type;     //  Number of byte    
184 //int fOffset;              //  Offset in Clon    
185   bool m_is_range;          //  (=true if leaf    
186 //bool fIsUnsigned;         //  (=kTRUE if uns    
187   base_leaf* m_leaf_count;  //  Pointer to Lea    
188   bool m_own_leaf_count;                          
189 };                                                
190                                                   
191 }}                                                
192                                                   
193 #endif