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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/wroot/base_leaf (Version 11.3.0) and /externals/g4tools/include/tools/wroot/base_leaf (Version 9.2.p3)


  1 // Copyright (C) 2010, Guy Barrand. All rights    
  2 // See the file tools.license for terms.          
  3                                                   
  4 #ifndef tools_wroot_base_leaf                     
  5 #define tools_wroot_base_leaf                     
  6                                                   
  7 #ifdef TOOLS_MEM                                  
  8 #include "../mem"                                 
  9 #endif                                            
 10                                                   
 11 #include "named"                                  
 12                                                   
 13 #include "cids"                                   
 14 #include "../scast"                               
 15                                                   
 16 namespace tools {                                 
 17 namespace wroot {                                 
 18                                                   
 19 class base_leaf : public virtual ibo {            
 20   static unsigned int kNullTag() {return 0;}      
 21 #ifdef TOOLS_MEM                                  
 22 public:                                           
 23   static const std::string& s_class() {           
 24     static const std::string s_v("tools::wroot    
 25     return s_v;                                   
 26   }                                               
 27 #endif                                            
 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   virtual cid id_cls() const {return id_class(    
 35 public: //ibo                                     
 36   virtual bool stream(buffer& a_buffer) const     
 37     //::printf("debug : base_leaf::stream %s\n    
 38     //::printf("debug :   m_length %d\n",m_len    
 39     //::printf("debug :   m_is_range %d\n",m_i    
 40     //::printf("debug :   m_leaf_count %lu\n",    
 41     unsigned int c;                               
 42     if(!a_buffer.write_version(2,c)) return fa    
 43     if(!Named_stream(a_buffer,m_name,m_title))    
 44     if(!a_buffer.write(m_length)) return false    
 45     if(!a_buffer.write(m_length_type)) return     
 46     uint32 fOffset = 0;                           
 47     if(!a_buffer.write(fOffset)) return false;    
 48     if(!a_buffer.write(m_is_range)) return fal    
 49     bool fIsUnsigned = false;                     
 50     if(!a_buffer.write(fIsUnsigned)) return fa    
 51                                                   
 52     if(m_leaf_count) {                            
 53       if(!a_buffer.write_object(*m_leaf_count)    
 54     } else {                                      
 55       if(!a_buffer.write(kNullTag())) return f    
 56     }                                             
 57                                                   
 58     if(!a_buffer.set_byte_count(c)) return fal    
 59     return true;                                  
 60   }                                               
 61 public:                                           
 62   virtual bool fill_buffer(buffer&) const = 0;    
 63 public:                                           
 64   base_leaf(std::ostream& a_out,const std::str    
 65   :m_out(a_out)                                   
 66   ,m_name(a_name)                                 
 67   ,m_title(a_title)                               
 68                                                   
 69   ,m_length(0)                                    
 70   ,m_length_type(0)                               
 71   ,m_leaf_count(0)                                
 72   ,m_is_range(false)                              
 73   {                                               
 74 #ifdef TOOLS_MEM                                  
 75     mem::increment(s_class().c_str());            
 76 #endif                                            
 77   }                                               
 78   virtual ~base_leaf(){                           
 79 #ifdef TOOLS_MEM                                  
 80     mem::decrement(s_class().c_str());            
 81 #endif                                            
 82   }                                               
 83 protected:                                        
 84   base_leaf(const base_leaf& a_from)              
 85   :ibo(a_from)                                    
 86   ,m_out(a_from.m_out)                            
 87   ,m_length(0)                                    
 88   ,m_length_type(0)                               
 89   ,m_leaf_count(0)                                
 90   ,m_is_range(false)                              
 91   {}                                              
 92   base_leaf& operator=(const base_leaf&){retur    
 93 public:                                           
 94   const std::string& name() const {return m_na    
 95   //const std::string& title() const {return m    
 96   void set_title(const std::string& a_value) {    
 97   uint32 length() const {return m_length;}        
 98   void set_length(uint32 a_value) {m_length =     
 99   void set_is_range(bool a_value) {m_is_range     
100 protected:                                        
101   std::ostream& m_out;                            
102 protected: //Named                                
103   std::string m_name;                             
104   std::string m_title;                            
105   uint32 m_length;          //  Number of fixe    
106   uint32 m_length_type;     //  Number of byte    
107   ibo* m_leaf_count;                              
108   bool m_is_range;                                
109 };                                                
110                                                   
111 }}                                                
112                                                   
113 #endif