The class PtCallback is used to specify a method that will be called asynchronously when certain events occur. To define a callback method a class must be derived from PtCallback and the Notify() method must be overloaded. This class contains one virtual function, Notify(), which does nothing by default.
Files to include | Class declaration | Base class |
poet.hxx | ptcllbck.hxx | none |
constructor | PtCallback(PtBase* pb = 0); |
destructor | virtual ~PtCallback(); |
Notify | virtual int Notify(PtObjectNote* ); |
PtFunc | typedef int(PtCallback::* PtFunc)(); |
PtFuncCallback | typedef int(PtCallback::* PtFuncCallback)(PtObjectNote* ); |
PtFuncInt | typedef int(PtCallback::* PtFuncInt)(int); |
- PtCallback::PtCallback()
- virtual PtCallback::~PtCallback()
- virtual int PtCallback::Notify(PtObjectNote* pNote)
Notifies your program that an event has taken place. Notify is a callback function used for Watch & Notify, and is called by POET when an event specified in an active watch is triggered.
The default implementation in PtCallback:: Notify() does nothing. A class which contains callback functions may override this function to provide its own Notify() function.
The PtObjectNote will give you complete information about the event which has occured. See the class description for PtObjectNote for details.
When you are using progress callbacks, PtExcMgr:: SetActionStarting() and PtExcMgr:: SetActionTerminated() require the address of a function which take no parameters. The typedef for PtFunc simply says that the function returns an int, takes no parameters, and is a member function of a class derived from PtCallback:
When you use Watch & Notify, your callback function needs a PtObjectNote to describe the event which triggered the Notify. If you need to pass the address of such a callback function to another function, the type of this function is PtFuncCallback. The typedef simply says that the function returns an int, takes a PtObjectNote* as a parameter, and is a member function of a class derived from PtCallback:
When you are using progress callbacks, PtExcMgr:: SetActionPending() requires the address of a function which takes an integer as a parameter. This is used to report the percent of the operation which is completed. The typedef for PtFuncInt simply says that the function returns an int, takes an int as a parameter, and is a member function of a class derived from PtCallback:
Copyright (c) 1996 POET Software, Inc. All rights reserved. Reproduction in whole or in part in any form or medium without the express permission of POET Software, Inc. is prohibited.