PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Typedefs
notifier.h File Reference
`#include <ptlib.h>`
`#include <ptlib/smartptr.h>`
Include dependency graph for notifier.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
class | PNotifierFunctionTemplate< ParamType >
| This is an abstract class for which a descendent is declared for every function that may be called. More...
class | PNotifierTemplate< ParamType >
| The `PNotifier` and `PNotifierFunction` classes build a completely type safe mechanism for calling arbitrary member functions on classes. More...

## Macros
#define | PDECLARE_NOTIFIER_COMMON1(notifier, notifiee, func, ParamType, BaseClass)
#define | PDECLARE_NOTIFIER_COMMON2(notifier, notifiee, func, ParamType, BaseClass)
#define | PDECLARE_NOTIFIER_COMMON(notifier, notifiee, func, ParamType, BaseClass)
#define | PDECLARE_NOTIFIER2(notifier, notifiee, func, ParamType) PDECLARE_NOTIFIER_COMMON(notifier, notifiee, func, ParamType, PNotifierFunctionTemplate<ParamType>)
| Declare a notifier object class. More...
#define | PDECLARE_NOTIFIER(notifier, notifiee, func) PDECLARE_NOTIFIER2(notifier, notifiee, func, P_INT_PTR)
| Declare PNotifier derived class with P_INT_PTR parameter. Uses PDECLARE_NOTIFIER2 macro. More...
#define | PCREATE_NOTIFIER2_EXT(obj, notifiee, func, type) notifiee::func##_PNotifier::Create(obj)
| Create a PNotifier object instance. More...
#define | PCREATE_NOTIFIER_EXT(obj, notifiee, func) notifiee::func##_PNotifier::Create(obj)
| Create PNotifier object instance with P_INT_PTR parameter. Uses PCREATE_NOTIFIER2_EXT macro. More...
#define | PCREATE_NOTIFIER2(func, type) P_DISABLE_MSVC_WARNINGS(4355, func##_PNotifier::Create(this))
| Create a PNotifier object instance. More...
#define | PCREATE_NOTIFIER(func) P_DISABLE_MSVC_WARNINGS(4355, func##_PNotifier::Create(this))
| Create PNotifier object instance with P_INT_PTR parameter. Uses PCREATE_NOTIFIER2 macro. More...

## Typedefs
typedef PNotifierFunctionTemplate < P_INT_PTR > | PNotifierFunction
typedef PNotifierTemplate < P_INT_PTR > | PNotifier

## Macro Definition Documentation

#define PCREATE_NOTIFIER | ( |  | func | ) | P_DISABLE_MSVC_WARNINGS(4355, func##_PNotifier::Create(this))

Create PNotifier object instance with P_INT_PTR parameter. Uses PCREATE_NOTIFIER2 macro.

#define PCREATE_NOTIFIER2 | ( |  | func,
|  |  | type
| ) |  | P_DISABLE_MSVC_WARNINGS(4355, func##_PNotifier::Create(this))

Create a PNotifier object instance.

This macro creates an instance of the particular `PNotifier` class using the `func` parameter as the member function to call.

The `this` object is used as the instance to call the function against. The `PCREATE_NOTIFIER_EXT` macro may be used if the instance to be called is not the current object instance.

#define PCREATE_NOTIFIER2_EXT | ( |  | obj,
|  |  | notifiee,
|  |  | func,
|  |  | type
| ) |  | notifiee::func##_PNotifier::Create(obj)

Create a PNotifier object instance.

This macro creates an instance of the particular `PNotifier` class using the `func` parameter as the member function to call.

The `obj` parameter is the instance to call the function against. If the instance to be called is the current instance, ie if `obj` is `this` then the `PCREATE_NOTIFIER` macro should be used.

#define PCREATE_NOTIFIER_EXT | ( |  | obj,
|  |  | notifiee,
|  |  | func
| ) |  | notifiee::func##_PNotifier::Create(obj)

Create PNotifier object instance with P_INT_PTR parameter. Uses PCREATE_NOTIFIER2_EXT macro.

#define PDECLARE_NOTIFIER | ( |  | notifier,
|  |  | notifiee,
|  |  | func
| ) |  | PDECLARE_NOTIFIER2(notifier, notifiee, func, P_INT_PTR)

Declare PNotifier derived class with P_INT_PTR parameter. Uses PDECLARE_NOTIFIER2 macro.

#define PDECLARE_NOTIFIER2 | ( |  | notifier,
|  |  | notifiee,
|  |  | func,
|  |  | ParamType
| ) |  | PDECLARE_NOTIFIER_COMMON(notifier, notifiee, func, ParamType, PNotifierFunctionTemplate<ParamType>)

Declare a notifier object class.

This macro declares the descendent class of `PNotifierFunction` that will be used in instances of `PNotifier` created by the `PCREATE_NOTIFIER` or `PCREATE_NOTIFIER2` macros.

The macro is expected to be used inside a class declaration. The class it declares will therefore be a nested class within the class being declared. The name of the new nested class is derived from the member function name which should guarentee the class names are unique.

The `notifier` parameter is the class of the function that will be calling the notification function. The `notifiee` parameter is the class to which the called member function belongs. Finally the `func` parameter is the name of the member function to be declared.

This macro will also declare the member function itself. This will be:

          void func(notifier & n, P_INT_PTR extra)     // for PNOTIFIER
          void func(notifier & n, void * extra)  // for PNOTIFIER2

The implementation of the function is left for the user.

#define PDECLARE_NOTIFIER_COMMON | ( |  | notifier,
|  |  | notifiee,
|  |  | func,
|  |  | ParamType,
|  |  | BaseClass
| ) |  |

Value:
PDECLARE_NOTIFIER_COMMON1(notifier, notifiee, func, ParamType, BaseClass) \
PDECLARE_NOTIFIER_COMMON2(notifier, notifiee, func, ParamType, BaseClass)

#define PDECLARE_NOTIFIER_COMMON1 | ( |  | notifier,
|  |  | notifiee,
|  |  | func,
|  |  | ParamType,
|  |  | BaseClass
| ) |  |

Value:
class func##_PNotifier : public BaseClass { \
public: \
func##_PNotifier(notifiee * target) : BaseClass(target, target) { } \
virtual void Call(PObject & note, ParamType extra) const \

#define PDECLARE_NOTIFIER_COMMON2 | ( |  | notifier,
|  |  | notifiee,
|  |  | func,
|  |  | ParamType,
|  |  | BaseClass
| ) |  |

Value:
{ notifiee * target = reinterpret_cast<notifiee *>(this->GetTarget()); \
if (target != NULL) \
target->func(reinterpret_cast<notifier &>(note), extra); \
} \
static PNotifierTemplate<ParamType> Create(notifiee * obj) { return new func##_PNotifier(obj); } \
static PNotifierTemplate<ParamType> Create(notifiee & obj) { return new func##_PNotifier(&obj); } \
}; \
friend class func##_PNotifier; \
virtual void func(notifier & note, ParamType extra) \

## Typedef Documentation

typedef PNotifierTemplate<P_INT_PTR> PNotifier

typedef PNotifierFunctionTemplate<P_INT_PTR> PNotifierFunction