LibCT 2.0
Public Member Functions | Private Attributes

LibCT::EventType Class Reference

EventType represents a specific event and stores all the listeners for that event. More...

#include <EventType.h>

List of all members.

Public Member Functions

 EventType (const std::string &name)
 Constructor.
 ~EventType ()
 Destructor.
template<typename T >
ListenerHandle RegisterListener (EventListener *pEventListener, void(T::*Callback)(EventOccurance *))
void UnregisterListener (ListenerHandle handle)
 Unregister a listener.
void Dispatch (int priority, EventData *pEventData)
 Dispatch an event to all listeners.
void DispatchTo (EventListener *pTarget, int priority, EventData *pEventData)
 Dispatch an event to a specific listener.
const std::string & GetName () const
unsigned int Ref ()
unsigned int Deref ()

Private Attributes

ListenerListm_pListeners
 List of listeners.
std::string m_Name
 Name of the EventType.
unsigned int m_Refs
 Number of loaded projects that ref this event.

Detailed Description

EventType represents a specific event and stores all the listeners for that event.


Constructor & Destructor Documentation

LibCT::EventType::EventType ( const std::string &  name)

Constructor.

Parameters:
nameName of the event
LibCT::EventType::~EventType ( )

Destructor.


Member Function Documentation

unsigned int LibCT::EventType::Deref ( )

Decrement ref count

Returns:
Current ref count (after decrement)
void LibCT::EventType::Dispatch ( int  priority,
EventData pEventData 
)

Dispatch an event to all listeners.

Parameters:
priorityPriority of the event
pEventDataCustom data to send with the event
void LibCT::EventType::DispatchTo ( EventListener pTarget,
int  priority,
EventData pEventData 
)

Dispatch an event to a specific listener.

Parameters:
pTargetEventListener to send the event to
priorityPriority of the event
pEventDataCustom data to send with the event
const std::string& LibCT::EventType::GetName ( ) const

Get the name of this EventType

Returns:
The name of the EventType
unsigned int LibCT::EventType::Ref ( )

Increment ref count

Returns:
Current ref count (after increment)
template<typename T >
ListenerHandle LibCT::EventType::RegisterListener ( EventListener pEventListener,
void(T::*)(EventOccurance *)  Callback 
) [inline]

Register a new EventListener

Returns:
A ListenerHandle representing this connecton
Parameters:
pEventListenerInstance that will be listening
CallbackMember function to call when the event fires
void LibCT::EventType::UnregisterListener ( ListenerHandle  handle)

Unregister a listener.

Parameters:
handleListenerHandle representing the connection to break

Member Data Documentation

std::string LibCT::EventType::m_Name [private]

Name of the EventType.

List of listeners.

unsigned int LibCT::EventType::m_Refs [private]

Number of loaded projects that ref this event.


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