Main Table of Contents


Table of Contents

class PtMethodRef
PtMethodRef: class summary
PtMethodRef::PtMethodRef()
PtMethodRef::Call()
PtMethodRef::Set()
PtMethodRef::Valid()

class PtMethodRef


Intro
PtMethodRef: class summary
PtMethodRef::PtMethodRef()
PtMethodRef::Call()
PtMethodRef::Set()
PtMethodRef::Valid()

A PtMethodRef is used to specify callback functions. Please see the chapter "Event Handling" for a complete set of the methods which use a PtMethodRefs.

Three different kinds of functions may be placed in a PtMethodRef:

typedef int (PtCallback::*PtFunc) ();
typedef int (PtCallback::*PtFuncCallback) (PtObjectNote *); typedef int (PtCallback::*PtFuncInt) (int);

Use the PtFuncCallback data type when creating your method references for setting watches. POET uses the other two function types internally for progress monitoring callbacks.


PtMethodRef: class summary


Intro

Files to include Class declaration Base class
poet.hxx ptcllbck.hxx none

Member functions:

constructor PtMethodRef();
Call int Call();
Set void Set(PtCallback* , PtFunc);
Valid int Valid();

PtMethodRef::PtMethodRef()


Intro

Declaration:

PtMethodRef::PtMethodRef() PtMethodRef::PtMethodRef(PtCallback* , PtFunc) PtMethodRef::PtMethodRef(PtCallback* , PtFuncCallback) PtMethodRef::PtMethodRef(PtCallback* , PtFuncInt)

Description:

Constructors. The first form does not install a function. The last three forms each install a function of the given type and the address of an object which contains this function:

class Useless : public PtCallback
{
public:
Func() { cout << "PtFunc"; }
FuncCallback( PtObjectNote * ) { cout << "PtFuncCallback"; }
FuncInt(int) { cout << "PtFuncInt"; }
};
Useless UselessObject;
PtMethodRef Empty;
PtMethodRef Func(&UselessObject, (PtFunc) Useless::Func);
PtMethodRef FuncInt(&UselessObject, (PtFuncInt) Useless::FuncInt);
PtMethodRef FuncCallback(&UselessObject, (PtFuncCallback)
Useless::FuncCallback);

PtMethodRef::Call()


Intro

Declarations:

int PtMethodRef::Call() int PtMethodRef::Call(int) int PtMethodRef::Call(PtObjectNote*)

Description:

Calls the function stored in the PtMethodRef, passing the parameters to this function. You will not normally call this function yourself - POET calls it when a callback function is triggered.

The second form of the function looks to see if a function with an integer parameter has been installed. If not, it calls the void function. The last form of the function calls the Notify() method of the callback object if no function is stored in the PtMethodRef.

Returns the return value from the function.


PtMethodRef::Set()


Intro

Declaration:

void PtMethodRef::Set(PtCallback* , PtFunc) void PtMethodRef::Set(PtCallback* , PtFuncInt) void PtMethodRef::Set(PtCallback* , PtFuncCallback)

Description:

Installs a function of the given type:

PtMethodRef FuncRef;
FuncRef.Set(&UselessObject, (PtFunc) Useless::Func);
FuncRef.Set(&UselessObject, (PtFuncInt) Useless::FuncInt);
FuncRef.Set(&UselessObject, (PtFuncCallback) Useless::FuncCallback);

PtMethodRef::Valid()


Intro

Declaration:

int PtMethodRef::Valid()

Description:

Returns a non-zero value if the PtMethodRef has an object pointer stored in it. This generally means that the PtMethodRef is valid.

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.