OOFILE  1.9
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members

Generic broadcaster for messaging. More...

#include <oofmsg.h>

Inheritance diagram for oofBroadcaster:
Inheritance graph
[legend]
Collaboration diagram for oofBroadcaster:
Collaboration graph
[legend]

Public Member Functions

void addReceiver (oofReceiver *)
 Append receiver to end of list. More...
 
bool askAllReturningAny (bool returnAny, OOFmsgT msg, unsigned long senderDefined=0, const oofReceiver *skipping=0)
 
oofReceiveraskAllStoppingAtFirst (bool stopOn, OOFmsgT msg, unsigned long senderDefined=0, const oofReceiver *skipping=0)
 
void broadcast (OOFmsgT msg, unsigned long senderDefined=0, const oofReceiver *skipping=0)
 Broadcast a message to all anonymous subscribers. More...
 
bool isBroadcasting () const
 
 oofBroadcaster ()
 
 oofBroadcaster (const oofBroadcaster &)
 
void removeReceiver (const oofReceiver *)
 
virtual ~oofBroadcaster ()
 

Protected Member Functions

void BroadcastShutdown ()
 

Protected Attributes

bool mLostReceiversWhileBroadcasting
 simple flag that removeReceiver was called during nested broadcast More...
 
unsigned long mNestedBroadcastingDepth
 aid to debugging and removeReceiver More...
 
OOF_ExpandableLongArraymReceivers
 owned More...
 

Detailed Description

Generic broadcaster for messaging.

See also
oofReceiver Has ability to iterate over listeners to get responses, eg: when seeking validation of database state.

Definition at line 76 of file oofmsg.h.

Constructor & Destructor Documentation

oofBroadcaster::oofBroadcaster ( )

Definition at line 41 of file oofmsg.cpp.

oofBroadcaster::oofBroadcaster ( const oofBroadcaster )

Definition at line 48 of file oofmsg.cpp.

oofBroadcaster::~oofBroadcaster ( )
virtual

Definition at line 55 of file oofmsg.cpp.

References BroadcastShutdown().

Member Function Documentation

void oofBroadcaster::addReceiver ( oofReceiver addingReceiver)

Append receiver to end of list.

Includes assertion to check if already in list.

Definition at line 181 of file oofmsg.cpp.

References OOF_ExpandableLongArray::append(), OOF_ExpandableLongArray::find(), and mReceivers.

Referenced by oofSingleListener::oofSingleListener(), oofReceiver::subscribeTo(), and oofSingleListener::subscribeTo().

bool oofBroadcaster::askAllReturningAny ( bool  returnAny,
OOFmsgT  msg,
unsigned long  senderDefined = 0,
const oofReceiver skipping = 0 
)
oofReceiver * oofBroadcaster::askAllStoppingAtFirst ( bool  stopOn,
OOFmsgT  msg,
unsigned long  senderDefined = 0,
const oofReceiver skipping = 0 
)
void oofBroadcaster::broadcast ( OOFmsgT  msg,
unsigned long  senderDefined = 0,
const oofReceiver skipping = 0 
)

Broadcast a message to all anonymous subscribers.

Parameters
msgconstant value indicating the action or event that has occurred.
senderDefinedadditional param for caller to pass through
skippinga receiver to be skipped when broadcasting, to avoid circular messages
Todo:
use void* for senderDefined so can cope with values >32bits eg oidT in HUGE databases or 64bit pointers.

Definition at line 82 of file oofmsg.cpp.

References OOF_ExpandableLongArray::count(), OOF_ExpandableLongArray::deleteAllMatching(), mLostReceiversWhileBroadcasting, mNestedBroadcastingDepth, mReceivers, oofReceiver::receiveMsg(), and OOF_ExpandableLongArray::value().

Referenced by dbTable::addOIDtoSelection(), dbTable::appendSelection(), BroadcastShutdown(), dbTable::clearSelection(), oofGraphSettingsCompleter::completePromises(), oofRepTextStyleCompleter::completePromises(), dbTable::deleteRecord(), dbTable::difference_with(), dbTable::dropRecordFromSelection(), dbTable::insert(), dbTable::intersection_with(), dbTable::invert(), dbGUI::leaveRecord(), dbAbstractEditHelper::LoadData(), dbTable::loadRelatedContextJoiningFromTo(), dbGUI::newRecord(), dbRelRefBase::relateFromRecord(), dbRelRefBase::relateRecord(), dbTable::removeSelection(), dbTable::resumeSorting(), dbGUI::revertRecord(), dbTable::revertRecord(), dbGUI::saveRecord(), dbTable::saveRecord(), dbTable::search(), dbTable::searchSelection(), dbRelRefBase::selectAllRelated(), dbTable::selectJustOID(), dbTable::setSelection(), dbTable::suspendSorting(), dbTable::union_with(), dbTable::union_with_no_overlap(), and dbTable::unloadRecord().

void oofBroadcaster::BroadcastShutdown ( )
protected

Definition at line 62 of file oofmsg.cpp.

References broadcast(), mReceivers, and OOFmsg_BroadcasterClosing.

Referenced by ~oofBroadcaster().

bool oofBroadcaster::isBroadcasting ( ) const
inline

Definition at line 160 of file oofmsg.h.

References mNestedBroadcastingDepth.

void oofBroadcaster::removeReceiver ( const oofReceiver rcvrPtr)

Member Data Documentation

bool oofBroadcaster::mLostReceiversWhileBroadcasting
protected

simple flag that removeReceiver was called during nested broadcast

Definition at line 98 of file oofmsg.h.

Referenced by broadcast(), and removeReceiver().

unsigned long oofBroadcaster::mNestedBroadcastingDepth
protected

aid to debugging and removeReceiver

Definition at line 97 of file oofmsg.h.

Referenced by broadcast(), isBroadcasting(), and removeReceiver().

OOF_ExpandableLongArray* oofBroadcaster::mReceivers
protected

The documentation for this class was generated from the following files: