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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/sg/bcbk (Version 11.3.0) and /externals/g4tools/include/tools/sg/bcbk (Version 11.2.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_sg_bcbk                               4 #ifndef tools_sg_bcbk
  5 #define tools_sg_bcbk                               5 #define tools_sg_bcbk
  6                                                     6 
  7 // "cbk" is for callback. Base class to handle      7 // "cbk" is for callback. Base class to handle a callback.
  8                                                     8 
  9 #ifdef TOOLS_MEM                                    9 #ifdef TOOLS_MEM
 10 #include "../mem"                                  10 #include "../mem"
 11 #endif                                             11 #endif
 12                                                    12 
 13 #include "../scast"                                13 #include "../scast"
 14 #include "../S_STRING"                             14 #include "../S_STRING"
 15                                                    15 
 16 #include <string>                                  16 #include <string>
 17                                                    17 
 18 namespace tools {                                  18 namespace tools {
 19 namespace sg {                                     19 namespace sg {
 20                                                    20 
 21 enum return_action {                               21 enum return_action {
 22   return_none,                                     22   return_none,
 23   return_to_render                                 23   return_to_render
 24 };                                                 24 };
 25                                                    25 
 26 class bcbk {                                       26 class bcbk {
 27 public:                                            27 public:
 28   TOOLS_SCLASS(tools::sg::bcbk)                    28   TOOLS_SCLASS(tools::sg::bcbk)
 29 public:                                            29 public:
 30   virtual void* cast(const std::string& a_clas     30   virtual void* cast(const std::string& a_class) const {
 31     if(void* p = cmp_cast<bcbk>(this,a_class))     31     if(void* p = cmp_cast<bcbk>(this,a_class)) {return p;}
 32     return 0;                                      32     return 0;
 33   }                                                33   }
 34   virtual const std::string& s_cls() const {re     34   virtual const std::string& s_cls() const {return s_class();}
 35 public:                                            35 public:
 36   virtual return_action action() = 0;              36   virtual return_action action() = 0;
 37   virtual bcbk* copy() const = 0;                  37   virtual bcbk* copy() const = 0;
 38   //virtual bool equal(const bcbk&) const = 0;     38   //virtual bool equal(const bcbk&) const = 0; //it would need the upper cast.
 39 public:                                            39 public:
 40   virtual ~bcbk(){                                 40   virtual ~bcbk(){
 41 #ifdef TOOLS_MEM                                   41 #ifdef TOOLS_MEM
 42     mem::decrement(s_class().c_str());             42     mem::decrement(s_class().c_str());
 43 #endif                                             43 #endif
 44   }                                                44   }
 45 protected:                                         45 protected:
 46   bcbk()                                           46   bcbk()
 47   :m_single_shoot(false)                           47   :m_single_shoot(false)
 48   ,m_is_valid(true)                                48   ,m_is_valid(true)
 49   {                                                49   {
 50 #ifdef TOOLS_MEM                                   50 #ifdef TOOLS_MEM
 51     mem::increment(s_class().c_str());             51     mem::increment(s_class().c_str());
 52 #endif                                             52 #endif
 53   }                                                53   }
 54   bcbk(const bcbk& a_from)                         54   bcbk(const bcbk& a_from)
 55   :m_single_shoot(a_from.m_single_shoot)           55   :m_single_shoot(a_from.m_single_shoot)
 56   ,m_is_valid(a_from.m_is_valid)                   56   ,m_is_valid(a_from.m_is_valid)
 57   {                                                57   {
 58 #ifdef TOOLS_MEM                                   58 #ifdef TOOLS_MEM
 59     mem::increment(s_class().c_str());             59     mem::increment(s_class().c_str());
 60 #endif                                             60 #endif
 61   }                                                61   }
 62   bcbk& operator=(const bcbk& a_from){             62   bcbk& operator=(const bcbk& a_from){
 63     m_single_shoot = a_from.m_single_shoot;        63     m_single_shoot = a_from.m_single_shoot;
 64     m_is_valid = a_from.m_is_valid;                64     m_is_valid = a_from.m_is_valid;
 65     return *this;                                  65     return *this;
 66   }                                                66   }
 67 public:                                            67 public:
 68   void set_single_shoot(bool a_value) {m_singl     68   void set_single_shoot(bool a_value) {m_single_shoot = a_value;}
 69   bool is_single_shoot() const {return m_singl     69   bool is_single_shoot() const {return m_single_shoot;}
 70                                                    70 
 71   bool is_valid() const {return m_is_valid;}       71   bool is_valid() const {return m_is_valid;}
 72   void invalidate() {m_is_valid = false;}          72   void invalidate() {m_is_valid = false;}
 73 protected:                                         73 protected:
 74   bool m_single_shoot;                             74   bool m_single_shoot;
 75   bool m_is_valid;                                 75   bool m_is_valid;
 76 };                                                 76 };
 77                                                    77 
 78 }}                                                 78 }}
 79                                                    79 
 80 #define TOOLS_CBK(a__class,a__sclass,a__parent     80 #define TOOLS_CBK(a__class,a__sclass,a__parent)\
 81 private:\                                          81 private:\
 82   typedef a__parent parent;\                       82   typedef a__parent parent;\
 83 public:\                                           83 public:\
 84   TOOLS_SCLASS(a__sclass)\                         84   TOOLS_SCLASS(a__sclass)\
 85 public:\                                           85 public:\
 86   virtual void* cast(const std::string& a_clas     86   virtual void* cast(const std::string& a_class) const {\
 87     if(void* p = tools::cmp_cast<a__class>(thi     87     if(void* p = tools::cmp_cast<a__class>(this,a_class)) return p;\
 88     return parent::cast(a_class);\                 88     return parent::cast(a_class);\
 89   }\                                               89   }\
 90   virtual const std::string& s_cls() const {re     90   virtual const std::string& s_cls() const {return s_class();}\
 91   virtual tools::sg::bcbk* copy() const {retur     91   virtual tools::sg::bcbk* copy() const {return new a__class(*this);}
 92                                                    92 
 93 #define TOOLS_T_CBK(a__T,a__class,a__sclass,a_     93 #define TOOLS_T_CBK(a__T,a__class,a__sclass,a__parent)\
 94 private:\                                          94 private:\
 95   typedef a__parent parent;\                       95   typedef a__parent parent;\
 96 public:\                                           96 public:\
 97   TOOLS_T_SCLASS(a__T,a__sclass)\                  97   TOOLS_T_SCLASS(a__T,a__sclass)\
 98 public:\                                           98 public:\
 99   virtual void* cast(const std::string& a_clas     99   virtual void* cast(const std::string& a_class) const {\
100     if(void* p = tools::cmp_cast<a__class>(thi    100     if(void* p = tools::cmp_cast<a__class>(this,a_class)) return p;\
101     return parent::cast(a_class);\                101     return parent::cast(a_class);\
102   }\                                              102   }\
103   virtual const std::string& s_cls() const {re    103   virtual const std::string& s_cls() const {return s_class();}\
104   virtual tools::sg::bcbk* copy() const {retur    104   virtual tools::sg::bcbk* copy() const {return new a__class(*this);}
105                                                   105 
106 #define TOOLS_T2_CBK(a__T1,a__T2,a__class,a__s    106 #define TOOLS_T2_CBK(a__T1,a__T2,a__class,a__sclass,a__parent)\
107 private:\                                         107 private:\
108   typedef a__parent parent;\                      108   typedef a__parent parent;\
109 public:\                                          109 public:\
110   TOOLS_T2_SCLASS(a__T1,a__T2,a__sclass)\         110   TOOLS_T2_SCLASS(a__T1,a__T2,a__sclass)\
111 public:\                                          111 public:\
112   virtual void* cast(const std::string& a_clas    112   virtual void* cast(const std::string& a_class) const {\
113     if(void* p = tools::cmp_cast<a__class>(thi    113     if(void* p = tools::cmp_cast<a__class>(this,a_class)) return p;\
114     return parent::cast(a_class);\                114     return parent::cast(a_class);\
115   }\                                              115   }\
116   virtual const std::string& s_cls() const {re    116   virtual const std::string& s_cls() const {return s_class();}\
117   virtual tools::sg::bcbk* copy() const {retur    117   virtual tools::sg::bcbk* copy() const {return new a__class(*this);}
118                                                   118 
119 #define TOOLS_T3_CBK(a__T1,a__T2,a__T3,a__clas    119 #define TOOLS_T3_CBK(a__T1,a__T2,a__T3,a__class,a__sclass,a__parent)\
120 private:\                                         120 private:\
121   typedef a__parent parent;\                      121   typedef a__parent parent;\
122 public:\                                          122 public:\
123   TOOLS_T3_SCLASS(a__T1,a__T2,a__T3,a__sclass)    123   TOOLS_T3_SCLASS(a__T1,a__T2,a__T3,a__sclass)\
124 public:\                                          124 public:\
125   virtual void* cast(const std::string& a_clas    125   virtual void* cast(const std::string& a_class) const {\
126     if(void* p = tools::cmp_cast<a__class>(thi    126     if(void* p = tools::cmp_cast<a__class>(this,a_class)) return p;\
127     return parent::cast(a_class);\                127     return parent::cast(a_class);\
128   }\                                              128   }\
129   virtual const std::string& s_cls() const {re    129   virtual const std::string& s_cls() const {return s_class();}\
130   virtual tools::sg::bcbk* copy() const {retur    130   virtual tools::sg::bcbk* copy() const {return new a__class(*this);}
131                                                   131 
132 #endif                                            132 #endif