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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 11.1.2)


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