46 template<
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
55 template<
class R,
class A,
class B>
64 template<
class R,
class A>
89 template <
class Object,
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
97 template <
class Object,
class R,
class A,
class B>
100 R (Object::*
method)(A, B);
104 template <
class Object,
class R,
class A>
105 struct MemberFunctionImpl<Object, R, A, NO_ARG, NO_ARG> :
public FunctionImpl<R, A>{
111 template <
class Object,
class R>
112 struct MemberFunctionImpl<Object, R, NO_ARG, NO_ARG, NO_ARG> :
public FunctionImpl<R>{
128 template <
class Object,
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
136 template <
class Object,
class R,
class A,
class B>
139 R (Object::*
method)(A, B)
const;
143 template <
class Object,
class R,
class A>
144 struct ConstMemberFunctionImpl<Object, R, A, NO_ARG> :
public FunctionImpl<R, A>{
146 R (Object::*
method)(A)
const;
150 template <
class Object,
class R>
151 struct ConstMemberFunctionImpl<Object, R, NO_ARG> :
public FunctionImpl<R>{
153 R (Object::*
method)()
const;
167 template <
class Object,
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
174 template <
class Object,
class R,
class A,
class B>
180 template <
class Object,
class R,
class A>
181 struct FunctorFunctionImpl<Object, R, A, NO_ARG> :
public FunctionImpl<R, A>{
185 template <
class Object,
class R>
186 struct FunctorFunctionImpl<Object, R, NO_ARG> :
public FunctionImpl<R>{
201 template <
class Object,
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
208 template <
class Object,
class R,
class A,
class B>
214 template <
class Object,
class R,
class A>
215 struct ConstFunctorFunctionImpl<Object, R, A, NO_ARG> :
public FunctionImpl<R, A>{
219 template <
class Object,
class R>
220 struct ConstFunctorFunctionImpl<Object, R, NO_ARG> :
public FunctionImpl<R>{
236 template <
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
242 template <
class R,
class A,
class B>
248 template <
class R,
class A>
249 struct GlobalFunctionImpl<R, A, NO_ARG> :
public FunctionImpl<R, A>{
254 struct GlobalFunctionImpl<R, NO_ARG> :
public FunctionImpl<R>{
283 template<
class R=
void,
class A=NO_ARG,
class B=NO_ARG,
class C=NO_ARG>
311 operator bool()
const {
return impl; }
317 template<
class R,
class A,
class B>
318 struct Function<R, A, B, NO_ARG> :
public std::binary_function<A, B, R>{
322 Function(R (*global_function)(A,B)):
impl(new GlobalFunctionImpl<R,A,B>){
323 ((GlobalFunctionImpl<R,A,B>*)(
impl.get()))->global_function = global_function;
327 operator bool()
const {
return impl; }
329 operator Function<R,A,B> ()
const {
return (*(
const Function<R,A,B>*)(
this)); }
332 template<
class R,
class A>
333 struct Function<R, A, NO_ARG> :
public std::unary_function<A, R>{
337 Function(R (*global_function)(A)):
impl(new GlobalFunctionImpl<R,A>){
338 ((GlobalFunctionImpl<R,A>*)(
impl.get()))->global_function = global_function;
342 operator bool()
const {
return impl; }
344 operator Function<R,A> ()
const {
return (*(
const Function<R,A>*)(
this)); }
347 struct Function<R, NO_ARG>{
348 typedef R result_type;
352 Function(R (*global_function)()):
impl(new GlobalFunctionImpl<R>){
353 ((GlobalFunctionImpl<R>*)(
impl.get()))->global_function = global_function;
358 operator bool()
const {
return impl; }
360 operator Function<R> ()
const {
return (*(
const Function<R>*)(
this)); }
375 template<
class Object,
class R,
class A,
class B,
class C>
379 impl->method = method;
387 template<
class Object,
class R,
class A,
class B>
391 impl->method = method;
399 template<
class Object,
class R,
class A>
403 impl->method = method;
412 template<
class Object,
class R>
416 impl->method = method;
424 template<
class Object,
class R,
class A,
class B,
class C>
428 impl->method = method;
436 template<
class Object,
class R,
class A,
class B>
440 impl->method = method;
447 template<
class Object,
class R,
class A>
451 impl->method = method;
459 template<
class Object,
class R>
460 Function<R> function(
const Object &obj, R(Object::*method)()
const){
463 impl->method = method;
471 template<
class Object,
class R,
class A,
class B,
class C>
472 Function<R, A, B, C> function(Object *obj, R(Object::*method)(A, B, C)){
return function<Object, R, A, B, C>(*obj, method); }
478 template<
class Object,
class R,
class A,
class B>
479 Function<R, A, B> function(Object *obj, R(Object::*method)(A, B)){
return function<Object, R, A, B>(*obj, method); }
485 template<
class Object,
class R,
class A>
486 Function<R, A> function(Object *obj, R(Object::*method)(A)){
return function<Object, R, A>(*obj, method); }
493 template<
class Object,
class R>
494 Function<R> function(Object *obj, R(Object::*method)()){
return function<Object, R>(*obj, method); }
500 template<
class Object,
class R,
class A,
class B,
class C>
501 Function<R, A, B, C> function(
const Object *obj, R(Object::*method)(A, B, C)
const){
return function<Object, R, A, B, C>(*obj, method); }
507 template<
class Object,
class R,
class A,
class B>
508 Function<R, A, B> function(
const Object *obj, R(Object::*method)(A, B)
const){
return function<Object, R, A, B>(*obj, method); }
514 template<
class Object,
class R,
class A>
515 Function<R, A> function(
const Object *obj, R(Object::*method)(A)
const){
return function<Object, R, A>(*obj, method); }
522 template<
class Object,
class R>
523 Function<R> function(
const Object *obj, R(Object::*method)()
const){
return function<Object, R>(*obj, method); }
532 template <
class R =
void,
class A = NO_ARG,
class B = NO_ARG,
class C = NO_ARG>
struct SelectFunctor{};
539 template<
class Object,
class R,
class A,
class B,
class C>
551 template<
class Object,
class R,
class A,
class B,
class C>
560 template<
class Object>
567 template<
class Object>
577 template<
class Object,
class R,
class A,
class B,
class C>
578 Function<R, A, B, C> function(Object *obj,
SelectFunctor<R, A, B, C> selector){
return function<Object, R, A, B, C>(*obj, selector); }
585 template<
class Object,
class R,
class A,
class B,
class C>
586 Function<R, A, B, C> function(
const Object *obj,
SelectFunctor<R, A, B, C> selector){
return function<Object, R, A, B, C>(*obj, selector); }
597 template<
class R,
class A,
class B,
class C>
606 template<
class R,
class A,
class B>
616 template<
class R,
class A>
The General Function Template.
Definition: Function.h:284
const Object * obj
Definition: Function.h:203
FunctionImpl implementation for Functors.
Definition: Function.h:168
virtual R operator()(A a, B b, C c) const
function interface
Definition: Function.h:204
undocument this line if you encounter any issues!
Definition: Any.h:37
virtual R operator()(A a, B b, C c) const
function interface
Definition: Function.h:239
virtual R operator()(A a, B b, C c) const
function interface
Definition: Function.h:170
FunctionImpl implementation for member functions.
Definition: Function.h:90
Function(R(*global_function)(A, B, C))
Constructor from given global function (for implicit conversion)
Definition: Function.h:298
R(Object::* method)(A, B, C)
Definition: Function.h:92
Object * obj
Definition: Function.h:169
Function(FunctionImpl< R, A, B, C > *impl)
Constructor with given Impl.
Definition: Function.h:289
R(* global_function)(A, B, C)
Definition: Function.h:238
R operator()(A a, B b, C c) const
function operator (always const)
Definition: Function.h:308
FunctionImpl implementation for functors of const objects.
Definition: Function.h:202
const Object * obj
Definition: Function.h:130
General Implementation for binary functions.
Definition: Function.h:47
virtual ~FunctionImpl()
Definition: Function.h:59
virtual R operator()(A a, B b, C c) const
function interface
Definition: Function.h:93
icl::utils::SmartPtr< FunctionImpl< R, A, B, C > > impl
Implementation.
Definition: Function.h:303
FunctionImpl implementation for const member functions.
Definition: Function.h:129
Object * obj
Definition: Function.h:91
Function()
Empty constructor (implementation will become null)
Definition: Function.h:286
virtual ~FunctionImpl()
Definition: Function.h:68
Empty utility template that can be used to select a special functor.
Definition: Function.h:532
virtual R operator()(A a, B b, C c) const
function interface
Definition: Function.h:132
FunctionImpl implementation for global functions.
Definition: Function.h:237
virtual R operator()(A a, B b, C c) const =0
function interface
R(Object::* method)(A, B, C) const
Definition: Function.h:131
Function(icl::utils::SmartPtr< FunctionImpl< R, A, B, C > >impl)
Constructor with given SmartPtr<Impl>
Definition: Function.h:292
virtual ~FunctionImpl()
Definition: Function.h:50
virtual ~FunctionImpl()
Definition: Function.h:77
Specialization of the SmartPtrBase class for Pointers.
Definition: SmartPtr.h:75