GLOW API version 1.0 reference

Back to
Table of contents


class ReceiverTracker

General information

type: class
inherits: (none)
module: glowSenderReceiver

ReceiverTracker is a class that keeps track of TReceivers, receiving endpoints of object communcation lines. The tracker can optionally delete all receivers it is tracking when it is deleted. This can be useful to prevent memory leaks when you have a set of receivers associated with a GLOW object that serve no purpose other than to listen for that object's messages. If that object is deleted, a corresponding ReceiverTracker can delete the associated receivers automatically.

You should use ReceiverTracker if you want to set up some automatic tracking and/or deletion of receiver objects.

Constants

Deleting options
Options for auto-deletion of receivers

enum ReceiverTracker::DeletingOptions neverDelete

Never auto-delete receivers

enum ReceiverTracker::DeletingOptions alwaysDelete

Always auto-delete receivers when unbound or when the ReceiverTracker is destructed.

enum ReceiverTracker::DeletingOptions referenceCountDelete

Auto-delete receivers when unbound or when the ReceiverTracker is destructed, but only if no other trackers are tracking the receiver.

Methods

Destructor

~ReceiverTracker(void)

If auto-deleting is active, the destructor deletes all receivers tracked by this ReceiverTracker.

Managing the receiver list
Manage the list of receivers tracked using these methods.

void Bind(TReceiver<>* receiver)

Binds to the given receiver. The receiver may be templated on any type. Throws an assertion if the tracker is already bound to this receiver.

bool IsBoundTo(TReceiver<>* receiver) const

Returns true if and only if this tracker is bound to the given receiver. The receiver may be templated on any type.

unsigned int NumReceivers(void)

Returns the number of receivers bound to this tracker.

void Unbind(TReceiver<>* receiver)

Unbinds from the given receiver. The receiver may be templated on any type. May also delete the receiver, according to the current DeletingOptions. Throws an assertion if the tracker is not bound to this receiver.

void UnbindAll(void)

Unbinds this tracker from all receivers. May also delete them, according to the current DeletingOptions.

void DeleteAllReceivers(void)

Deletes all bound receivers, regardless of their reference count.

void SetAutoDeletingOptions(ReceiverTracker::DeletingOptions options)

Sets up automatic deleting options of receivers on unbinding or tracker destruction.

ReceiverTracker::DeletingOptions GetAutoDeletingOptions(void) const

Returns current automatic deleting options of receivers on unbinding or tracker destruction.

Back to
Table of contents


The GLOW Toolkit