//1 arg to Callback template struct CallbackMethodActionArgPte : public CallbackAction { Ptr object; M method; T arg; void Execute() { if(object) (object->*method)(arg); } CallbackMethodActionArgPte(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback pteback1(O *object, void (M::*method)(Q), T arg) { return Callback(new CallbackMethodActionArgPte(object, method, arg)); } template struct CallbackMethodActionArg : public CallbackAction { O *object; M method; T arg; void Execute() { (object->*method)(arg); } CallbackMethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback callback1(O *object, void (M::*method)(Q), T arg) { return Callback(new CallbackMethodActionArg (object, method, arg)); } template Callback callback1(const O *object, void (M::*method)(Q) const, T arg) { return Callback(new CallbackMethodActionArg (object, method, arg)); } template struct CallbackActionCallArg : public CallbackAction { F fn; T arg; void Execute() { fn(arg); } CallbackActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Callback callback1(void (*fn)(Q), T arg) { return Callback(new CallbackActionCallArg(fn, arg)); } //reduct template Callback callback1(Callback1 cb, T arg) { return Callback(new CallbackActionCallArg, T>(cb, arg)); } //1 arg to Callback1 template struct Callback1MethodActionArgPte : public Callback1Action { Ptr object; M method; T arg; void Execute(P1 p1) { if(object) (object->*method)(p1, arg); } Callback1MethodActionArgPte(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback1 pteback1(O *object, void (M::*method)(P1, Q), T arg) { return Callback1(new Callback1MethodActionArgPte (object, method, arg)); } template struct Callback1MethodActionArg : public Callback1Action { O *object; M method; T arg; void Execute(P1 p1) { (object->*method)(p1, arg); } Callback1MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback1 callback1(O *object, void (M::*method)(P1, Q), T arg) { return Callback1(new Callback1MethodActionArg (object, method, arg)); } template Callback1 callback1(const O *object, void (M::*method)(P1, Q) const, T arg) { return Callback1(new Callback1MethodActionArg (object, method, arg)); } template struct Callback1ActionCallArg : public Callback1Action { F fn; T arg; void Execute(P1 p1) { fn(p1, arg); } Callback1ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Callback1 callback1(void (*fn)(P1, Q), T arg) { return Callback1(new Callback1ActionCallArg(fn, arg)); } //reduct template Callback1 callback1(Callback2 cb, T arg) { return Callback1(new Callback1ActionCallArg, P1, T>(cb, arg)); } //1 arg to Callback2 template struct Callback2MethodActionArg : public Callback2Action { O *object; M method; T arg; void Execute(P1 p1, P2 p2) { (object->*method)(p1, p2, arg); } Callback2MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback2 callback1(O *object, void (M::*method)(P1, P2, Q), T arg) { return Callback2(new Callback2MethodActionArg (object, method, arg)); } template Callback2 callback1(const O *object, void (M::*method)(P1, P2, Q) const, T arg) { return Callback2(new Callback2MethodActionArg (object, method, arg)); } template struct Callback2ActionCallArg : Callback2Action { F fn; T arg; void Execute(P1 p1, P2 p2) { fn(p1, p2, arg); } Callback2ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Callback2 callback1(void (*fn)(P1, P2, Q), T arg) { return Callback2(new Callback2ActionCallArg(fn, arg)); } //reduct template Callback2 callback1(Callback3 cb, T arg) { return Callback2(new Callback2ActionCallArg, P1, P2, T>(cb, arg)); } //1 arg to Callback3 template struct Callback3MethodActionArg : public Callback3Action { O *object; M method; T arg; void Execute(P1 p1, P2 p2, P3 p3) { (object->*method)(p1, p2, p3, arg); } Callback3MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback3 callback1(O *object, void (M::*method)(P1, P2, P3, Q), T arg) { return Callback3(new Callback3MethodActionArg (object, method, arg)); } template Callback3 callback1(const O *object, void (M::*method)(P1, P2, P3, Q) const, T arg) { return Callback3(new Callback3MethodActionArg (object, method, arg)); } template struct Callback3ActionCallArg : Callback3Action { F fn; T arg; void Execute(P1 p1, P2 p2, P3 p3) { fn(p1, p2, p3, arg); } Callback3ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Callback3 callback1(void (*fn)(P1, P2, P3, Q), T arg) { return Callback3(new Callback3ActionCallArg(fn, arg)); } //reduct template Callback3 callback1(Callback4 cb, T arg) { return Callback3(new Callback3ActionCallArg, P1, P2, P3, T>(cb, arg)); } //1 arg to Callback4 template struct Callback4MethodActionArg : public Callback4Action { O *object; M method; T arg; void Execute(P1 p1, P2 p2, P3 p3, P4 p4) { (object->*method)(p1, p2, p3, p4, arg); } Callback4MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Callback4 callback1(O *object, void (M::*method)(P1, P2, P3, P4, Q), T arg) { return Callback4(new Callback4MethodActionArg (object, method, arg)); } template Callback4 callback1(const O *object, void (M::*method)(P1, P2, P3, P4, Q) const, T arg) { return Callback4(new Callback4MethodActionArg (object, method, arg)); } template struct Callback4ActionCallArg : Callback4Action { F fn; T arg; void Execute(P1 p1, P2 p2, P3 p3, P4 p4) { fn(p1, p2, p3, p4, arg); } Callback4ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Callback4 callback1(void (*fn)(P1, P2, P3, P4, Q), T arg) { return Callback4(new Callback4ActionCallArg(fn, arg)); } // ------------------------------------------------------- //1 arg to Gate template struct GateMethodActionArgPte : public GateAction { Ptr object; M method; T arg; bool Execute() { return object? (object->*method)(arg) : false; } GateMethodActionArgPte(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate pteback1(O *object, bool (M::*method)(Q), T arg) { return Gate(new GateMethodActionArgPte(object, method, arg)); } template struct GateMethodActionArg : public GateAction { O *object; M method; T arg; bool Execute() { return object ? (object->*method)(arg) : false; } GateMethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate callback1(O *object, bool (M::*method)(Q), T arg) { return Gate(new GateMethodActionArg (object, method, arg)); } template Gate callback1(const O *object, bool (M::*method)(Q) const, T arg) { return Gate(new GateMethodActionArg (object, method, arg)); } template struct GateActionCallArg : public GateAction { F fn; T arg; bool Execute() { return fn(arg); } GateActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Gate callback1(bool (*fn)(Q), T arg) { return Gate(new GateActionCallArg(fn, arg)); } //reduct template Gate callback1(Gate1 cb, T arg) { return Gate(new GateActionCallArg, T>(cb, arg)); } //1 arg to Gate1 template struct Gate1MethodActionArgPte : public Gate1Action { Ptr object; M method; T arg; bool Execute(P1 p1) { return object ? (object->*method)(p1, arg) : false; } Gate1MethodActionArgPte(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate1 pteback1(O *object, bool (M::*method)(P1, Q), T arg) { return Gate1(new Gate1MethodActionArgPte (object, method, arg)); } template struct Gate1MethodActionArg : public Gate1Action { O *object; M method; T arg; bool Execute(P1 p1) { return object ? (object->*method)(p1, arg) : false; } Gate1MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate1 callback1(O *object, bool (M::*method)(P1, Q), T arg) { return Gate1(new Gate1MethodActionArg (object, method, arg)); } template Gate1 callback1(const O *object, bool (M::*method)(P1, Q) const, T arg) { return Gate1(new Gate1MethodActionArg (object, method, arg)); } template struct Gate1ActionCallArg : public Gate1Action { F fn; T arg; bool Execute(P1 p1) { return fn(p1, arg); } Gate1ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Gate1 callback1(bool (*fn)(P1, Q), T arg) { return Gate1(new Gate1ActionCallArg(fn, arg)); } //reduct template Gate1 callback1(Gate2 cb, T arg) { return Gate1(new Gate1ActionCallArg, P1, T>(cb, arg)); } //1 arg to Gate2 template struct Gate2MethodActionArg : public Gate2Action { O *object; M method; T arg; bool Execute(P1 p1, P2 p2) { return object ? (object->*method)(p1, p2, arg) : false; } Gate2MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate2 callback1(O *object, bool (M::*method)(P1, P2, Q), T arg) { return Gate2(new Gate2MethodActionArg (object, method, arg)); } template Gate2 callback1(const O *object, bool (M::*method)(P1, P2, Q) const, T arg) { return Gate2(new Gate2MethodActionArg (object, method, arg)); } template struct Gate2ActionCallArg : Gate2Action { F fn; T arg; bool Execute(P1 p1, P2 p2) { return fn(p1, p2, arg); } Gate2ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Gate2 callback1(bool (*fn)(P1, P2, Q), T arg) { return Gate2(new Gate2ActionCallArg(fn, arg)); } //reduct template Gate2 callback1(Gate3 cb, T arg) { return Gate2(new Gate2ActionCallArg, P1, P2, T>(cb, arg)); } //1 arg to Gate3 template struct Gate3MethodActionArg : public Gate3Action { O *object; M method; T arg; bool Execute(P1 p1, P2 p2, P3 p3) { return object ? (object->*method)(p1, p2, p3, arg) : false; } Gate3MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate3 callback1(O *object, bool (M::*method)(P1, P2, P3, Q), T arg) { return Gate3(new Gate3MethodActionArg (object, method, arg)); } template Gate3 callback1(const O *object, bool (M::*method)(P1, P2, P3, Q) const, T arg) { return Gate3(new Gate3MethodActionArg (object, method, arg)); } template struct Gate3ActionCallArg : Gate3Action { F fn; T arg; bool Execute(P1 p1, P2 p2, P3 p3) { return fn(p1, p2, p3, arg); } Gate3ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Gate3 callback1(bool (*fn)(P1, P2, P3, Q), T arg) { return Gate3(new Gate3ActionCallArg(fn, arg)); } //reduct template Gate3 callback1(Gate4 cb, T arg) { return Gate3(new Gate3ActionCallArg, P1, P2, P3, T>(cb, arg)); } //1 arg to Gate4 template struct Gate4MethodActionArg : public Gate4Action { O *object; M method; T arg; bool Execute(P1 p1, P2 p2, P3 p3, P4 p4) { return object ? (object->*method)(p1, p2, p3, p4, arg) : false; } Gate4MethodActionArg(O *object, M method, T arg) : object(object), method(method), arg(arg) {} }; template Gate4 callback1(O *object, bool (M::*method)(P1, P2, P3, P4, Q), T arg) { return Gate4(new Gate4MethodActionArg (object, method, arg)); } template Gate4 callback1(const O *object, bool (M::*method)(P1, P2, P3, P4, Q) const, T arg) { return Gate4(new Gate4MethodActionArg (object, method, arg)); } template struct Gate4ActionCallArg : Gate4Action { F fn; T arg; bool Execute(P1 p1, P2 p2, P3 p3, P4 p4) { return fn(p1, p2, p3, p4, arg); } Gate4ActionCallArg(F fn, T arg) : fn(fn), arg(arg) {} }; template Gate4 callback1(bool (*fn)(P1, P2, P3, P4, Q), T arg) { return Gate4(new Gate4ActionCallArg(fn, arg)); }