From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02479.html | 538 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 538 insertions(+) create mode 100644 docs/doxygen/nel/a02479.html (limited to 'docs/doxygen/nel/a02479.html') diff --git a/docs/doxygen/nel/a02479.html b/docs/doxygen/nel/a02479.html new file mode 100644 index 00000000..6f518017 --- /dev/null +++ b/docs/doxygen/nel/a02479.html @@ -0,0 +1,538 @@ + + +NeL: NLMISC::CEventServer class Reference + + + +
+

NLMISC::CEventServer Class Reference

#include <event_server.h> +

+


Detailed Description

+CEventServer
Author:
Stephane Coutelas

+Nevrax France

+
Date:
2000
+ +

+ +

+Definition at line 52 of file event_server.h. + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void addEmitter (IEventEmitter *emitter)
void addListener (CClassId id, IEventListener *listener)
void postEvent (CEvent *event)
void pump (bool allWindows=false)
void removeEmitter (IEventEmitter *emitter)
void removeListener (CClassId id, IEventListener *listener)
virtual ~CEventServer ()

Protected Member Functions

virtual bool pumpEvent (CEvent *event)

Private Attributes

std::list< IEventEmitter * > _Emitters
std::list< CEvent * > _Events
mapListener _Listeners
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
virtual NLMISC::CEventServer::~CEventServer  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 59 of file event_server.h. +

+

00059 {}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CEventServer::addEmitter IEventEmitter emitter  ) 
+
+ + + + + +
+   + + +

+Add an Emitter to the server

Parameters:
+ + +
emitter 
+
+ +

+Definition at line 136 of file event_server.cpp. +

+Referenced by NL3D::CDriverUser::setDisplay(). +

+

00137 {
+00138         _Emitters.push_back(emitter);
+00139 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CEventServer::addListener CClassId  id,
IEventListener listener
+
+ + + + + +
+   + + +

+Add a callback (associated with an id)

Parameters:
+ + + +
id of the CEvent class to hook
listener to use with this event
+
+ +

+Definition at line 105 of file event_server.cpp. +

+References _Listeners. +

+Referenced by NL3D::CEvent3dMouseListener::addToServer(), and NLMISC::CEventListenerAsync::addToServer(). +

+

00106 {
+00107         _Listeners.insert( mapListener::value_type(id, listener));
+00108 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CEventServer::postEvent CEvent event  ) 
+
+ + + + + +
+   + + +

+add event to the list

Parameters:
+ + +
event 
+
+ +

+Definition at line 41 of file event_server.cpp. +

+

00042 {
+00043         _Events.push_back(event);
+00044 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CEventServer::pump bool  allWindows = false  ) 
+
+ + + + + +
+   + + +

+get call every callbacks associated with event id

Parameters:
+ + +
allWindows is true : pump the messages of all windows, not only the driver window.
+
+ +

+Definition at line 51 of file event_server.cpp. +

+References pumpEvent(). +

+

00052 {
+00053         std::list<IEventEmitter*>::iterator item = _Emitters.begin();
+00054         
+00055         // getting events from emitters
+00056         while(item!=_Emitters.end())
+00057         {
+00058                 // ask emitters to submit their events to server
+00059                 (*item)->submitEvents(*this, allWindows);
+00060                 item++;
+00061         }
+00062 
+00063         
+00064         std::list<CEvent*>::iterator itev = _Events.begin();
+00065         
+00066         while(itev!=_Events.end())
+00067         {
+00068                 // pump event
+00069                 bool bDelete=pumpEvent(*itev);
+00070                 if (bDelete)
+00071                         delete *itev;
+00072                 itev=_Events.erase (itev);
+00073         }
+00074 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CEventServer::pumpEvent CEvent event  )  [protected, virtual]
+
+ + + + + +
+   + + +

+call every callbacks associated with event id

Parameters:
+ + +
event 
+
+
Returns:
true if the pointer must be delete, false if it not. (post to another message queue...)
+ +

+Definition at line 80 of file event_server.cpp. +

+References _Listeners, and uint64. +

+Referenced by pump(). +

+

00081 {
+00082         // taking id
+00083         uint64 id = (uint64) *event;
+00084 
+00085         // looking for the first occurence of id
+00086         mapListener::iterator it = _Listeners.find(id);
+00087 
+00088         // calling every callbacks
+00089         while(it!=_Listeners.end() && (uint64)(*it).first == id)
+00090         {
+00091                 IEventListener *a = (IEventListener *)((*it).second);
+00092                 (*a) (*event);
+00093                 it++;
+00094         }
+00095 
+00096         // delete the pointer
+00097         return true;
+00098 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CEventServer::removeEmitter IEventEmitter emitter  ) 
+
+ + + + + +
+   + + +

+Remove an Emitter from the server

Parameters:
+ + +
emitter 
+
+ +

+Definition at line 145 of file event_server.cpp. +

+Referenced by NL3D::CDriverUser::release(). +

+

00146 {
+00147         _Emitters.remove(emitter);
+00148 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CEventServer::removeListener CClassId  id,
IEventListener listener
+
+ + + + + +
+   + + +

+Remove a callback

Parameters:
+ + + +
id of event's callback
listener to be removed
+
+ +

+Definition at line 114 of file event_server.cpp. +

+References _Listeners. +

+Referenced by NL3D::CEvent3dMouseListener::removeFromServer(), and NLMISC::CEventListenerAsync::removeFromServer(). +

+

00115 {
+00116         // looking for the first occurence of id
+00117         mapListener::iterator it = _Listeners.find(id);
+00118 
+00119         // looking for occurence with the right callback
+00120         while(it!=_Listeners.end() && (*it).first == id)
+00121         {
+00122                 if((*it).second==listener)
+00123                 {
+00124                         // erasing pair
+00125                         _Listeners.erase(it);
+00126                         return;
+00127                 }
+00128                 it++;
+00129         }
+00130 }
+
+


Field Documentation

+

+ + + + +
+ + +
std::list<IEventEmitter*> NLMISC::CEventServer::_Emitters [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 55 of file event_server.h.

+

+ + + + +
+ + +
std::list<CEvent*> NLMISC::CEventServer::_Events [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 56 of file event_server.h.

+

+ + + + +
+ + +
mapListener NLMISC::CEventServer::_Listeners [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 54 of file event_server.h. +

+Referenced by addListener(), pumpEvent(), and removeListener().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 13:12:07 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1