| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

# extends.h

Go to the documentation of this file.

    00001 #ifndef GAUDIKERNEL_EXTENDS_H
    00002 #define GAUDIKERNEL_EXTENDS_H
    00003
    00004 #include "GaudiKernel/IInterface.h"
    00005
    00009 template <typename BASE, typename I1>
    00010 struct GAUDI_API extends1: public BASE, virtual public extend_interfaces1<I1> {
    00012   typedef extends1 base_class;
    00014   typedef extend_interfaces1<I1> extend_interfaces_base;
    00015 #ifndef __GCCXML__
    00017   typedef typename extend_interfaces_base::ext_iids interfaces;
    00018 #endif
    00019
    00021   template <typename A1, typename A2, typename A3> extends1(A1 a1, A2 a2, A3 a3): BASE(a1,a2,a3){}
    00023   template <typename A1, typename A2> extends1(A1 a1, A2 a2): BASE(a1, a2){}
    00025   template <typename A1> extends1(A1 a1): BASE(a1){}
    00027   extends1(): BASE(){}
    00028
    00030   virtual void *i_cast(const std::type_info &tid) const {
    00031     void *ptr = 0;
    00032 #ifndef __GCCXML__
    00033     check_cast<base_class> caster(this,tid,ptr);
    00034     mpl::for_each<interfaces>(caster);
    00035 #endif
    00036     if (!ptr) {
    00037       ptr = BASE::i_cast(tid);
    00038     }
    00039     return ptr;
    00040   }
    00041
    00043   virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){
    00044     if (!pp) return StatusCode::FAILURE;
    00045     *pp = 0;
    00046 #ifndef __GCCXML__
    00047     interfaceMatch<base_class> matcher(this,ti,*pp);
    00048     mpl::for_each<interfaces>(matcher);
    00049     if (!*pp) { // cast failed, try the base class
    00050       return BASE::queryInterface(ti,pp);
    00051     }
    00052     this->addRef();
    00053 #endif
    00054     return StatusCode::SUCCESS;
    00055   }
    00056
    00058   virtual std::vector<std::string> getInterfaceNames() const {
    00059     std::vector<std::string> v = BASE::getInterfaceNames(); // start from the base
    00060 #ifndef __GCCXML__
    00061     AppendInterfaceName appender(v);
    00062     mpl::for_each<interfaces>(appender);
    00063 #endif
    00064     return v;
    00065   }
    00066
    00068   virtual ~extends1() {}
    00069 };
    00070
    00074 template <typename BASE, typename I1, typename I2>
    00075 struct GAUDI_API extends2: public BASE, virtual public extend_interfaces2<I1,I2> {
    00077   typedef extends2 base_class;
    00079   typedef extend_interfaces2<I1,I2> extend_interfaces_base;
    00080 #ifndef __GCCXML__
    00082   typedef typename extend_interfaces_base::ext_iids interfaces;
    00083 #endif
    00084
    00086   template <typename A1, typename A2, typename A3> extends2(A1 a1, A2 a2, A3 a3): BASE(a1,a2,a3){}
    00088   template <typename A1, typename A2> extends2(A1 a1, A2 a2): BASE(a1, a2){}
    00090   template <typename A1> extends2(A1 a1): BASE(a1){}
    00092   extends2(): BASE(){}
    00093
    00095   virtual void *i_cast(const std::type_info &tid) const {
    00096     void *ptr = 0;
    00097 #ifndef __GCCXML__
    00098     check_cast<base_class> caster(this,tid,ptr);
    00099     mpl::for_each<interfaces>(caster);
    00100 #endif
    00101     if (!ptr) {
    00102       ptr = BASE::i_cast(tid);
    00103     }
    00104     return ptr;
    00105   }
    00106
    00108   virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){
    00109     if (!pp) return StatusCode::FAILURE;
    00110     *pp = 0;
    00111 #ifndef __GCCXML__
    00112     interfaceMatch<base_class> matcher(this,ti,*pp);
    00113     mpl::for_each<interfaces>(matcher);
    00114     if (!*pp) { // cast failed, try the base class
    00115       return BASE::queryInterface(ti,pp);
    00116     }
    00117     this->addRef();
    00118 #endif
    00119     return StatusCode::SUCCESS;
    00120   }
    00121
    00123   virtual std::vector<std::string> getInterfaceNames() const {
    00124     std::vector<std::string> v = BASE::getInterfaceNames(); // start from the base
    00125 #ifndef __GCCXML__
    00126     AppendInterfaceName appender(v);
    00127     mpl::for_each<interfaces>(appender);
    00128 #endif
    00129     return v;
    00130   }
    00131
    00133   virtual ~extends2() {}
    00134 };
    00135
    00139 template <typename BASE, typename I1, typename I2, typename I3>
    00140 struct GAUDI_API extends3: public BASE, virtual public extend_interfaces3<I1,I2,I3> {
    00142   typedef extends3 base_class;
    00144   typedef extend_interfaces3<I1,I2,I3> extend_interfaces_base;
    00145 #ifndef __GCCXML__
    00147   typedef typename extend_interfaces_base::ext_iids interfaces;
    00148 #endif
    00149
    00151   template <typename A1, typename A2, typename A3> extends3(A1 a1, A2 a2, A3 a3): BASE(a1,a2,a3){}
    00153   template <typename A1, typename A2> extends3(A1 a1, A2 a2): BASE(a1, a2){}
    00155   template <typename A1> extends3(A1 a1): BASE(a1){}
    00157   extends3(): BASE(){}
    00158
    00160   virtual void *i_cast(const std::type_info &tid) const {
    00161     void *ptr = 0;
    00162 #ifndef __GCCXML__
    00163     check_cast<base_class> caster(this,tid,ptr);
    00164     mpl::for_each<interfaces>(caster);
    00165 #endif
    00166     if (!ptr) {
    00167       ptr = BASE::i_cast(tid);
    00168     }
    00169     return ptr;
    00170   }
    00171
    00173   virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){
    00174     if (!pp) return StatusCode::FAILURE;
    00175     *pp = 0;
    00176 #ifndef __GCCXML__
    00177     interfaceMatch<base_class> matcher(this,ti,*pp);
    00178     mpl::for_each<interfaces>(matcher);
    00179     if (!*pp) { // cast failed, try the base class
    00180       return BASE::queryInterface(ti,pp);
    00181     }
    00182     this->addRef();
    00183 #endif
    00184     return StatusCode::SUCCESS;
    00185   }
    00186
    00188   virtual std::vector<std::string> getInterfaceNames() const {
    00189     std::vector<std::string> v = BASE::getInterfaceNames(); // start from the base
    00190 #ifndef __GCCXML__
    00191     AppendInterfaceName appender(v);
    00192     mpl::for_each<interfaces>(appender);
    00193 #endif
    00194     return v;
    00195   }
    00196
    00198   virtual ~extends3() {}
    00199 };
    00200
    00201 #endif /* GAUDIKERNEL_EXTENDS_H */