lestes::std::broadcaster< T, Y > Class Template Reference

A template for broadcasting class. More...

#include <broadcaster.hh>

Inheritance diagram for lestes::std::broadcaster< T, Y >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void broadcast (ptr< T > what)
 Inform the listeners, that the event has occured on the parameter.
void attach (ptr< broadcast_listener< Y > > listener)
 Register with the broadcaster to listen for the events.

Static Public Member Functions

static ptr< broadcaster< T,
Y > > 
create ()
 Create the broadcaster/event.

Protected Member Functions

void gc_mark ()
 Marks the keystone.
 broadcaster ()

Private Attributes

srp< list< srp< broadcast_listener<
Y > > > > 
listeners

Detailed Description

template<typename T, typename Y = T>
class lestes::std::broadcaster< T, Y >

A template for broadcasting class.

The concept of broadcasting is very similar to the concept of events. At a certain point of the program's run there occurs an important event. Such events can be divided into several categories. The first category of events, and by far the most numerous, is the category that encompasses all events that spring from a single source. These events are represented by the class event, q.v. The second category consists of events, that affect an object of a given type. These events could represent the creation / alteration / destruction of an object. The second category of events need not necesarily come from a single source. The remaining kinds of events are not discussed here.

The second category of events, i.e. the events affecting a single object, can be handled by a simple means: all parties interested in the event would enqueue themselves in a designated place. Then, at the moment of the event, the designated place will be accessed and all enqueued listeners would be notified. The mechanics involved are the same as for the first category. However, the affected object shall be announced to the listeners as well.


Constructor & Destructor Documentation

template<typename T, typename Y = T>
lestes::std::broadcaster< T, Y >::broadcaster (  )  [inline, protected]


Member Function Documentation

template<typename T, typename Y = T>
void lestes::std::broadcaster< T, Y >::broadcast ( ptr< T >  what  )  [inline]

Inform the listeners, that the event has occured on the parameter.

template<typename T, typename Y = T>
void lestes::std::broadcaster< T, Y >::attach ( ptr< broadcast_listener< Y > >  listener  )  [inline]

Register with the broadcaster to listen for the events.

template<typename T, typename Y = T>
static ptr< broadcaster < T, Y > > lestes::std::broadcaster< T, Y >::create ( void   )  [inline, static]

Create the broadcaster/event.

template<typename T, typename Y = T>
void lestes::std::broadcaster< T, Y >::gc_mark ( void   )  [inline, protected, virtual]

Marks the keystone.

Marks all directly reachable parts of the class. The method must be overriden for each inherited class. It should contain abc.gc_mark() for each field abc of the inherited class and call to gc_mark() of the direct ancestor of the class. Does nothing for keystone, only stops processing of ancestors.

Reimplemented from lestes::std::mem::keystone.


Member Data Documentation

template<typename T, typename Y = T>
srp< list < srp < broadcast_listener < Y > > > > lestes::std::broadcaster< T, Y >::listeners [private]


The documentation for this class was generated from the following file:
Generated on Mon Feb 12 18:49:46 2007 for lestes by doxygen 1.5.1-20070107