All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
extends.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_EXTENDS_H
2 #define GAUDIKERNEL_EXTENDS_H
3 
5 
9 template <typename BASE, typename I1>
10 struct GAUDI_API extends1: public BASE, virtual public extend_interfaces1<I1> {
15 #ifndef __GCCXML__
18 #endif
19 
21  template <typename A1, typename A2, typename A3> extends1(A1 a1, A2 a2, A3 a3): BASE(a1,a2,a3){}
23  template <typename A1, typename A2> extends1(A1 a1, A2 a2): BASE(a1, a2){}
25  template <typename A1> extends1(A1 a1): BASE(a1){}
27  extends1(): BASE(){}
28 
30  virtual void *i_cast(const InterfaceID &tid) const {
31  void *ptr = 0;
32 #ifndef __GCCXML__
33  interfaceMatch<base_class> matcher(this,tid,ptr);
34  mpl::for_each<interfaces>(matcher);
35 #endif
36  if (!ptr) {
37  ptr = BASE::i_cast(tid);
38  }
39  return ptr;
40  }
41 
43  virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){
44  if (!pp) return StatusCode::FAILURE;
45  *pp = 0;
46 #ifndef __GCCXML__
47  interfaceMatch<base_class> matcher(this,ti,*pp);
48  mpl::for_each<interfaces>(matcher);
49  if (!*pp) { // cast failed, try the base class
50  return BASE::queryInterface(ti,pp);
51  }
52  this->addRef();
53 #endif
54  return StatusCode::SUCCESS;
55  }
56 
58  virtual std::vector<std::string> getInterfaceNames() const {
59  std::vector<std::string> v = BASE::getInterfaceNames(); // start from the base
60 #ifndef __GCCXML__
61  AppendInterfaceName appender(v);
62  mpl::for_each<interfaces>(appender);
63 #endif
64  return v;
65  }
66 
68  virtual ~extends1() {}
69 };
70 
74 template <typename BASE, typename I1, typename I2>
75 struct GAUDI_API extends2: public BASE, virtual public extend_interfaces2<I1,I2> {
80 #ifndef __GCCXML__
83 #endif
84 
86  template <typename A1, typename A2, typename A3> extends2(A1 a1, A2 a2, A3 a3): BASE(a1,a2,a3){}
88  template <typename A1, typename A2> extends2(A1 a1, A2 a2): BASE(a1, a2){}
90  template <typename A1> extends2(A1 a1): BASE(a1){}
92  extends2(): BASE(){}
93 
95  virtual void *i_cast(const InterfaceID &tid) const {
96  void *ptr = 0;
97 #ifndef __GCCXML__
98  interfaceMatch<base_class> matcher(this,tid,ptr);
99  mpl::for_each<interfaces>(matcher);
100 #endif
101  if (!ptr) {
102  ptr = BASE::i_cast(tid);
103  }
104  return ptr;
105  }
106 
108  virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){
109  if (!pp) return StatusCode::FAILURE;
110  *pp = 0;
111 #ifndef __GCCXML__
112  interfaceMatch<base_class> matcher(this,ti,*pp);
113  mpl::for_each<interfaces>(matcher);
114  if (!*pp) { // cast failed, try the base class
115  return BASE::queryInterface(ti,pp);
116  }
117  this->addRef();
118 #endif
119  return StatusCode::SUCCESS;
120  }
121 
123  virtual std::vector<std::string> getInterfaceNames() const {
124  std::vector<std::string> v = BASE::getInterfaceNames(); // start from the base
125 #ifndef __GCCXML__
126  AppendInterfaceName appender(v);
127  mpl::for_each<interfaces>(appender);
128 #endif
129  return v;
130  }
131 
133  virtual ~extends2() {}
134 };
135 
139 template <typename BASE, typename I1, typename I2, typename I3>
140 struct GAUDI_API extends3: public BASE, virtual public extend_interfaces3<I1,I2,I3> {
145 #ifndef __GCCXML__
148 #endif
149 
151  template <typename A1, typename A2, typename A3> extends3(A1 a1, A2 a2, A3 a3): BASE(a1,a2,a3){}
153  template <typename A1, typename A2> extends3(A1 a1, A2 a2): BASE(a1, a2){}
155  template <typename A1> extends3(A1 a1): BASE(a1){}
157  extends3(): BASE(){}
158 
160  virtual void *i_cast(const InterfaceID &tid) const {
161  void *ptr = 0;
162 #ifndef __GCCXML__
163  interfaceMatch<base_class> matcher(this,tid,ptr);
164  mpl::for_each<interfaces>(matcher);
165 #endif
166  if (!ptr) {
167  ptr = BASE::i_cast(tid);
168  }
169  return ptr;
170  }
171 
173  virtual StatusCode queryInterface(const InterfaceID &ti, void** pp){
174  if (!pp) return StatusCode::FAILURE;
175  *pp = 0;
176 #ifndef __GCCXML__
177  interfaceMatch<base_class> matcher(this,ti,*pp);
178  mpl::for_each<interfaces>(matcher);
179  if (!*pp) { // cast failed, try the base class
180  return BASE::queryInterface(ti,pp);
181  }
182  this->addRef();
183 #endif
184  return StatusCode::SUCCESS;
185  }
186 
188  virtual std::vector<std::string> getInterfaceNames() const {
189  std::vector<std::string> v = BASE::getInterfaceNames(); // start from the base
190 #ifndef __GCCXML__
191  AppendInterfaceName appender(v);
192  mpl::for_each<interfaces>(appender);
193 #endif
194  return v;
195  }
196 
198  virtual ~extends3() {}
199 };
200 
201 #endif /* GAUDIKERNEL_EXTENDS_H */
extends2(A1 a1, A2 a2)
Templated constructor with 2 arguments.
Definition: extends.h:88
Base class to be used to extend an interface.
Base class to be used to extend an interface.
mpl::fold< typename IDataProviderSvc::iid::iids::type, typename IDataManagerSvc::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
MPL set of interfaces extended by this one.
Helper class for the cast used in the MPL for_each algorithm in the implementation of queryInterface...
Definition: implements.h:11
extends3(A1 a1, A2 a2, A3 a3)
Templated constructor with 3 arguments.
Definition: extends.h:151
extends2 base_class
Typedef to this class.
Definition: extends.h:77
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Implementation of IInterface::queryInterface.
Definition: extends.h:173
virtual void * i_cast(const InterfaceID &tid) const
Implementation of IInterface::i_cast.
Definition: extends.h:160
extend_interfaces1< I1 > extend_interfaces_base
Typedef to the base of this class.
Definition: extends.h:14
extends2()
Default constructor.
Definition: extends.h:92
extends3(A1 a1)
Templated constructor with 1 argument.
Definition: extends.h:155
extends1(A1 a1)
Templated constructor with 1 argument.
Definition: extends.h:25
virtual void * i_cast(const InterfaceID &tid) const
Implementation of IInterface::i_cast.
Definition: extends.h:95
extends1(A1 a1, A2 a2, A3 a3)
Templated constructor with 3 arguments.
Definition: extends.h:21
virtual ~extends1()
Virtual destructor.
Definition: extends.h:68
Base class used to extend a class implementing other interfaces.
Definition: extends.h:75
extends1 base_class
Typedef to this class.
Definition: extends.h:12
virtual std::vector< std::string > getInterfaceNames() const
Implementation of IInterface::getInterfaceNames.
Definition: extends.h:123
virtual void * i_cast(const InterfaceID &tid) const
Implementation of IInterface::i_cast.
Definition: extends.h:30
Base class used to extend a class implementing other interfaces.
Definition: extends.h:140
extend_interfaces_base::ext_iids interfaces
MPL set of all the implemented interfaces.
Definition: extends.h:17
extends2(A1 a1, A2 a2, A3 a3)
Templated constructor with 3 arguments.
Definition: extends.h:86
extend_interfaces_base::ext_iids interfaces
MPL set of all the implemented interfaces.
Definition: extends.h:82
virtual std::vector< std::string > getInterfaceNames() const
Implementation of IInterface::getInterfaceNames.
Definition: extends.h:58
extends1()
Default constructor.
Definition: extends.h:27
virtual ~extends3()
Virtual destructor.
Definition: extends.h:198
Interface ID class.
Definition: IInterface.h:55
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Implementation of IInterface::queryInterface.
Definition: extends.h:43
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
virtual ~extends2()
Virtual destructor.
Definition: extends.h:133
extends3()
Default constructor.
Definition: extends.h:157
IEqSolver::iid::iids::type ext_iids
MPL set of interfaces extended by this one.
extend_interfaces3< I1, I2, I3 > extend_interfaces_base
Typedef to the base of this class.
Definition: extends.h:144
extends3 base_class
Typedef to this class.
Definition: extends.h:142
extends3(A1 a1, A2 a2)
Templated constructor with 2 arguments.
Definition: extends.h:153
virtual std::vector< std::string > getInterfaceNames() const
Implementation of IInterface::getInterfaceNames.
Definition: extends.h:188
extend_interfaces_base::ext_iids interfaces
MPL set of all the implemented interfaces.
Definition: extends.h:147
extends2(A1 a1)
Templated constructor with 1 argument.
Definition: extends.h:90
Base class to be used to extend an interface.
extends1(A1 a1, A2 a2)
Templated constructor with 2 arguments.
Definition: extends.h:23
#define GAUDI_API
Definition: Kernel.h:108
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)
Implementation of IInterface::queryInterface.
Definition: extends.h:108
extend_interfaces2< I1, I2 > extend_interfaces_base
Typedef to the base of this class.
Definition: extends.h:79
Helper class for the cast used in the MPL for_each algorithm in the implementation of query_interface...
Definition: implements.h:33
mpl::fold< typename IRndmEngine::iid::iids::type, typename mpl::fold< typename ISerialize::iid::iids::type, typename IIncidentListener::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type, mpl::insert< mpl::_1, mpl::_2 > >::type ext_iids
MPL set of interfaces extended by this one.