Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members  

PLMCallback Class Reference

Member function pointer abstraction. More...

#include <PLMCallback.hpp>

Inheritance diagram for PLMCallback:

Inheritance graph
[legend]
List of all members.

Public Methods

virtual void Execute (void *ptr)=0

Detailed Description

Member function pointer abstraction.

Notes on callbacks use :

Goal: allows to use pointers on member functions as standard pointers.

Use : One object A needs a pointer to the member function of another object B, the first one (A) is the 'caller', the second one is the 'called' (B). So:

  • the caller needs a 'PLMxxxCallback *' attribute or variable initialized with a corresponding PLMxxxCallbackDef object (where xxx is nothing, Int or Void)
  • the called (B) has to supply a suitable member function (void func (void*) for basic PLMCallback, int func (void*) for PLMIntCallback, ...)
Example:
    class CObjectA
    { ...
      PLMCallback *cb;
      ...
      ??? func (???) { ... if (cb) cb->Execute(???); ... }
    };

    class CObjectB
    {
      ...
      void methodB (void *);
      ...
    };

    CObjectB bb;

    CObjectA caller;
    caller.cb = new PLMCallbackDef<CObjectB> (&bb, &CObjectB::methodB);


Member Function Documentation

virtual void PLMCallback::Execute void *    ptr [pure virtual]
 

Invoke the pointed member function.

Implemented in PLMCallbackDef< T >.


The documentation for this class was generated from the following file:
  • PLMCallback.hpp

Generated by Doxygen 1.2.18 on Tue Oct 26 12:07:38 2004.