Bind

SigC::bind() alters a SigC::Slot by fixing arguments to certain values. More...

Functions

Slot0< R > bind (const Slot1< R, C1 > &s, A1 a1)
 template <class A1,class R,class C1>.

Slot1< R, P1 > bind (const Slot2< R, P1, C1 > &s, A1 a1)
 template <class A1,class R,class P1,class C1>.

Slot2< R, P1, P2 > bind (const Slot3< R, P1, P2, C1 > &s, A1 a1)
 template <class A1,class R,class P1,class P2,class C1>.

Slot3< R, P1, P2, P3 > bind (const Slot4< R, P1, P2, P3, C1 > &s, A1 a1)
 template <class A1,class R,class P1,class P2,class P3,class C1>.

Slot4< R, P1, P2, P3, P4 > bind (const Slot5< R, P1, P2, P3, P4, C1 > &s, A1 a1)
 template <class A1,class R,class P1,class P2,class P3,class P4,class C1>.

Slot0< R > bind (const Slot2< R, C1, C2 > &s, A1 a1, A2 a2)
 template <class A1,class A2,class R,class C1,class C2>.

Slot1< R, P1 > bind (const Slot3< R, P1, C1, C2 > &s, A1 a1, A2 a2)
 template <class A1,class A2,class R,class P1,class C1,class C2>.

Slot2< R, P1, P2 > bind (const Slot4< R, P1, P2, C1, C2 > &s, A1 a1, A2 a2)
 template <class A1,class A2,class R,class P1,class P2,class C1,class C2>.

Slot3< R, P1, P2, P3 > bind (const Slot5< R, P1, P2, P3, C1, C2 > &s, A1 a1, A2 a2)
 template <class A1,class A2,class R,class P1,class P2,class P3,class C1,class C2>.

Slot0< R1 > bind_return (const Slot0< R2 > &s, R1 ret)
 template <class R1,class R2>.

Slot1< R1, P1 > bind_return (const Slot1< R2, P1 > &s, R1 ret)
 template <class R1,class R2,class P1>.

Slot2< R1, P1, P2 > bind_return (const Slot2< R2, P1, P2 > &s, R1 ret)
 template <class R1,class R2,class P1,class P2>.

Slot3< R1, P1, P2, P3 > bind_return (const Slot3< R2, P1, P2, P3 > &s, R1 ret)
 template <class R1,class R2,class P1,class P2,class P3>.

Slot4< R1, P1, P2, P3, P4 > bind_return (const Slot4< R2, P1, P2, P3, P4 > &s, R1 ret)
 template <class R1,class R2,class P1,class P2,class P3,class P4>.

Slot5< R1, P1, P2, P3, P4,
P5 > 
bind_return (const Slot5< R2, P1, P2, P3, P4, P5 > &s, R1 ret)
 template <class R1,class R2,class P1,class P2,class P3,class P4,class P5>.


Detailed Description

SigC::bind() alters a SigC::Slot by fixing arguments to certain values.

Argument fixing starts from the last argument. Up to two arguments can be bound at a time.

Simple sample usage:

 void f(int, int);
 SigC:Slot2<void, int, int> s1 = SigC::slot(f);

 SigC::Slot1<void, int>  s2 = SigC::bind(s1,1);
 s2(2);  // call f with arguments 2,1

Multibinding usage:

  void f(int,int);
  SigC::Slot2<void, int, int> s1 = SigC::slot(f);

  SigC::Slot0<void>  s2 = SigC::bind(s1, 1, 2);
  s2();  // call f with arguments 1, 2

Type specified usage:

  class A {};
  class B : public A {};
  B* b;
  SigC::Slot0<void, A*> s1;

  SigC::Slot0<void> s2 = SIgC::bind(s1, b);  // B* converted to A*

SigC::bind_return() alters a Slot by fixing the return value to certain values

Return value fixing ignores any slot return value. The slot is destroyed in the process and a new one is created, so references to the slot will no longer be valid.

Typecasting may be necessary to match arguments between the slot and the bound return value. Types must be an exact match. To ensure the proper type, the type can be explicitly specified on template instantation.

Simple sample usage:

 void f(int, int);
 SigC::Slot1<int, int, int>  s1 = SigC::bind_return(slot(&f), 1);
 std::cout << "s2: " << s1(2, 1) << std::endl;

Type specified usage:

 class A {};
 class B : public A {};
 B* b;
 SigC::Slot1<void> s1;

 SigC::Slot0<A*> s2 = SigC::bind_return<A*>(s1, b);  // B* must be told to match A*

Generated on Fri Oct 11 18:16:04 2002 for libsigc++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002