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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/named (Version 11.3.0) and /externals/g4tools/include/tools/rroot/named (Version 9.0.p1)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_rroot_named                         
  5 #define tools_rroot_named                         
  6                                                   
  7 #include "object"                                 
  8 #include "../scast"                               
  9 #include "../vdata"                               
 10 #include "cids"                                   
 11                                                   
 12 namespace tools {                                 
 13 namespace rroot {                                 
 14                                                   
 15 inline bool Named_stream(buffer& a_buffer,std:    
 16   short v;                                        
 17   unsigned int _s, _c;                            
 18   if(!a_buffer.read_version(v,_s,_c)) return f    
 19  {uint32 id,bits;                                 
 20   if(!Object_stream(a_buffer,id,bits)) return     
 21   if(!a_buffer.read(a_name)) return false;        
 22   if(!a_buffer.read(a_title)) return false;       
 23   if(!a_buffer.check_byte_count(_s,_c,"TNamed"    
 24   return true;                                    
 25 }                                                 
 26                                                   
 27 inline bool AttLine_stream(buffer& a_buffer,sh    
 28   short v;                                        
 29   unsigned int _s, _c;                            
 30   if(!a_buffer.read_version(v,_s,_c)) return f    
 31   if(!a_buffer.read(a_color)) return false;       
 32   if(!a_buffer.read(a_style)) return false;       
 33   if(!a_buffer.read(a_width)) return false;       
 34   if(!a_buffer.check_byte_count(_s,_c,"TAttLin    
 35   return true;                                    
 36 }                                                 
 37                                                   
 38 inline bool AttFill_stream(buffer& a_buffer,sh    
 39   short v;                                        
 40   unsigned int _s, _c;                            
 41   if(!a_buffer.read_version(v,_s,_c)) return f    
 42   if(!a_buffer.read(a_color)) return false;       
 43   if(!a_buffer.read(a_style)) return false;       
 44   if(!a_buffer.check_byte_count(_s,_c,"TAttFil    
 45   return true;                                    
 46 }                                                 
 47                                                   
 48 inline bool AttMarker_stream(buffer& a_buffer)    
 49   short fMarkerColor;                             
 50   short fMarkerStyle;                             
 51   float fMarkerWidth;                             
 52   short v;                                        
 53   unsigned int _s, _c;                            
 54   if(!a_buffer.read_version(v,_s,_c)) return f    
 55   if(!a_buffer.read(fMarkerColor)) return fals    
 56   if(!a_buffer.read(fMarkerStyle)) return fals    
 57   if(!a_buffer.read(fMarkerWidth)) return fals    
 58   if(!a_buffer.check_byte_count(_s,_c,"TAttMar    
 59   return true;                                    
 60 }                                                 
 61                                                   
 62 inline bool GeoAtt_stream(buffer& a_buffer) {     
 63   unsigned int fGeoAtt;            // option f    
 64   short v;                                        
 65   unsigned int _s, _c;                            
 66   if(!a_buffer.read_version(v,_s,_c)) return f    
 67   if(!a_buffer.read(fGeoAtt)) return false;       
 68   if(!a_buffer.check_byte_count(_s,_c,"TGeoAtt    
 69   return true;                                    
 70 }                                                 
 71                                                   
 72 inline bool Att3D_stream(buffer& a_buffer) {      
 73   short v;                                        
 74   unsigned int _s, _c;                            
 75   if(!a_buffer.read_version(v,_s,_c)) return f    
 76   if(!a_buffer.check_byte_count(_s,_c,"TAtt3D"    
 77   return true;                                    
 78 }                                                 
 79                                                   
 80 template <class T>                                
 81 inline bool Array_stream(buffer& a_buffer,std:    
 82   a_v.clear();                                    
 83   int sz;                                         
 84   if(!a_buffer.read(sz)) return false;            
 85   //check sz is not crazy :                       
 86   if(!a_buffer.check_eob(sz)) return false;       
 87   a_v.resize(sz);                                 
 88   if(!a_buffer.read_fast_array<T>(vec_data(a_v    
 89   return true;                                    
 90 }                                                 
 91                                                   
 92 template <class T>                                
 93 inline bool dummy_array_stream(buffer& a_buffe    
 94   char is_array;                                  
 95   if(!a_buffer.read(is_array)) return false;      
 96   if(!is_array) return true;                      
 97   if(!a_n) return true;                           
 98   T* v = new T[a_n];                              
 99   bool status = a_buffer.read_fast_array<T>(v,    
100   delete [] v;                                    
101   return status;                                  
102 }                                                 
103                                                   
104 class named : public virtual iro {                
105   static const std::string& s_store_class() {     
106     static const std::string s_v("TNamed");       
107     return s_v;                                   
108   }                                               
109 public:                                           
110   static const std::string& s_class() {           
111     static const std::string s_v("tools::rroot    
112     return s_v;                                   
113   }                                               
114 public: //iro                                     
115   virtual void* cast(const std::string& a_clas    
116     if(void* p = cmp_cast<named>(this,a_class)    
117     return 0;                                     
118   }                                               
119   virtual const std::string& s_cls() const {re    
120 public:                                           
121   static cid id_class() {return named_cid();}     
122   virtual void* cast(cid a_class) const {         
123     if(void* p = cmp_cast<named>(this,a_class)    
124     else return 0;                                
125   }                                               
126   //virtual void* cast(cid) const {return name    
127 public:                                           
128   virtual iro* copy() const {return new named(    
129   virtual bool stream(buffer& a_buffer) {         
130     return Named_stream(a_buffer,m_name,m_titl    
131   }                                               
132 public:                                           
133   named() {                                       
134 #ifdef TOOLS_MEM                                  
135     mem::increment(s_class().c_str());            
136 #endif                                            
137   }                                               
138   virtual ~named() {                              
139 #ifdef TOOLS_MEM                                  
140     mem::decrement(s_class().c_str());            
141 #endif                                            
142   }                                               
143 protected:                                        
144   named(const named& a_from):iro(a_from),m_nam    
145 #ifdef TOOLS_MEM                                  
146     mem::increment(s_class().c_str());            
147 #endif                                            
148   }                                               
149   named& operator=(const named& a_from){          
150     m_name = a_from.m_name;                       
151     m_title = a_from.m_title;                     
152     return *this;                                 
153   }                                               
154 protected:                                        
155   std::string m_name;                             
156   std::string m_title;                            
157 };                                                
158                                                   
159 }}                                                
160                                                   
161 #endif