Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

oofSingleListener Class Reference
[OOFILE utility classes and functions.]

#include <oofmsg.h>

Inheritance diagram for oofSingleListener:

Inheritance graph
[legend]
Collaboration diagram for oofSingleListener:

Collaboration graph
[legend]
List of all members.

Detailed Description

Special limited oofReceiver which will only ever listen to one oofBroadcaster at a time.

Warning:
If you subclass oofReceiver and override receiveMsg you MUST be careful about destruction. By default, the receiveMsg of oofSingleListener deletes itself. If you check for OOFmsg_BroadcasterClosing in your overriden receiveMsg then you should clear mListensTo.


Public Member Functions

 oofSingleListener (oofBroadcaster *listensTo=0)
 oofSingleListener (const oofSingleListener &)
virtual ~oofSingleListener ()
virtual void subscribeTo (oofBroadcaster *)
virtual void unsubscribe (oofBroadcaster *from=0)
void suspendListening ()
void resumeListening ()
virtual bool receiveMsg (OOFmsgT msg, unsigned long senderDefined)
 The default receiveMsg behaviour is to delete yourself when the broadcaster closes.


Protected Attributes

oofBroadcastermListensTo
oofBroadcastermSuspendedListensTo
unsigned short mSuspendCount


Constructor & Destructor Documentation

oofSingleListener::oofSingleListener oofBroadcaster listensTo = 0  ) 
 

oofSingleListener::oofSingleListener const oofSingleListener  ) 
 

oofSingleListener::~oofSingleListener  )  [virtual]
 


Member Function Documentation

bool oofSingleListener::receiveMsg OOFmsgT  msg,
unsigned long  senderDefined
[virtual]
 

The default receiveMsg behaviour is to delete yourself when the broadcaster closes.

In many user subclasses oofSingleListener is a mixin and you have a class owned elsewhere, not self-deleting.

Warning:
If a subclass is not self-deleting it MUST override receiveMsg handling of the msg OOFmsg_BroadcasterClosing to prevent runtime error.
However it is still important to set mListensTo=0 otherwise when you finally get around to deleting your oofSingleListener, it will try to update a deleted oofBroadcaster and cause a crash.

Implements oofReceiver.

Reimplemented in dbCloneCleanup, dbRelMaintainer, dbFieldCopier, oofE_Table, dbAbstractBrowseHelper, dbAbstractEditHelper, dbBrowseHelper, dbHierBrowseHelper, dbTableViewDisplay, OOF_recordCacheCopier, dbRelRefBase, and oofRepData.

void oofSingleListener::resumeListening  ) 
 

void oofSingleListener::subscribeTo oofBroadcaster  )  [virtual]
 

Reimplemented from oofReceiver.

void oofSingleListener::suspendListening  ) 
 

void oofSingleListener::unsubscribe oofBroadcaster from = 0  )  [virtual]
 

Reimplemented from oofReceiver.


Member Data Documentation

oofBroadcaster* oofSingleListener::mListensTo [protected]
 

unsigned short oofSingleListener::mSuspendCount [protected]
 

oofBroadcaster* oofSingleListener::mSuspendedListensTo [protected]
 


The documentation for this class was generated from the following files:
Generated on Fri Jan 2 01:28:44 2004 for OOFILE by doxygen 1.3.5