SUMO - Simulation of Urban MObility
|
#include <FXThreadEvent.h>
Public Types | |
enum | { ID_NONE = 0, ID_DELETE = 6, ID_DISABLE, ID_ENABLE, ID_SETVALUE = 17, ID_SETINTVALUE, ID_SETREALVALUE, ID_SETSTRINGVALUE, ID_SETINTRANGE, ID_SETREALRANGE, ID_GETINTVALUE, ID_GETREALVALUE, ID_GETSTRINGVALUE, ID_XML, ID_META, ID_COMMENT, ID_DOCUMENT, ID_TAG, ID_CONTENT, ID_LAST } |
enum | { ID_THREAD_EVENT = FXBaseObject::ID_LAST, ID_LAST } |
Public Member Functions | |
virtual void | create () |
create resource More... | |
virtual void | destroy () |
destroy resource More... | |
virtual void | detach () |
detach resource More... | |
virtual void | disable () |
disable us More... | |
virtual void | enable () |
enable us More... | |
FXThreadEvent (FXObject *tgt=NULL, FXSelector sel=0) | |
Construct an object capable of signaling the main FOX event loop. More... | |
FXApp * | getApp () |
application pointer More... | |
FXSelector | getSelector () |
get the message More... | |
FXObject * | getTarget () |
get the target More... | |
void * | getUserData () |
get user data More... | |
FXuint | getUserDataLen () |
get user daat length More... | |
FXbool | isEnabled () |
are we enabled? More... | |
virtual FXbool | isReadonly () |
are we modifiable More... | |
virtual void | load (FXStream &store) |
load object from stream More... | |
long | onCmdDisable (FXObject *, FXSelector, void *) |
long | onCmdEnable (FXObject *, FXSelector, void *) |
long | onThreadEvent (FXObject *, FXSelector, void *) |
long | onThreadSignal (FXObject *, FXSelector, void *) |
long | onUpdate (FXObject *, FXSelector, void *) |
virtual void | save (FXStream &store) const |
save object to stream More... | |
virtual void | setReadonly (FXbool mode=TRUE) |
set modifiable mode More... | |
void | setSelector (FXSelector sel) |
set the selector More... | |
void | setTarget (FXObject *tgt) |
set the target More... | |
void | setUserData (void *d) |
set user data More... | |
void | setUserDataLen (FXuint len) |
set the user data length More... | |
void | signal () |
void | signal (FXuint seltype) |
virtual | ~FXThreadEvent () |
destructor More... | |
Protected Types | |
enum | { FLAG_ENABLED = 0x00000002, FLAG_UPDATE = 0x00000004, FLAG_FOCUSED = 0x00000010, FLAG_DIRTY = 0x00000020, FLAG_RECALC = 0x00000040, FLAG_DEFAULT = 0x00000200, FLAG_INITIAL = 0x00000400, FLAG_ACTIVE = 0x00001000, FLAG_CHANGED = 0x00010000, FLAG_READONLY = 0x10000000 } |
flags defined are the same as those defined in FXWindow, etc. More... | |
Protected Member Functions | |
FXThreadEvent (const FXThreadEvent &) | |
FXThreadEvent & | operator= (const FXThreadEvent &) |
Protected Attributes | |
void * | data |
FXuint | datalen |
FXuint | flags |
FXSelector | message |
FXuint | options |
FXObject * | target |
Private Attributes | |
FXThreadEventHandle | event |
:Description
Interthread communication object
Usage:
class MyGUI::FXWhatEver { // constructor MyGUI(...);
// message IDs enum { ID_THREAD_EVENT = FXWhatEver::ID_LAST, ID_LAST };
// message handler long onThreadEvent(FXObject*, FXSelector, void*);
// thread event object FXThreadEvent m_threadEvent; };
// message map FXDEFMAP(MyGUI, FXWhatEver) = { FXMAPFUNC(SEL_THREAD_EVENT, MyGUI::ID_THREAD_EVENT, MyGUI::onThreadEvent) };
// constructor MyGUI::MyGUI(...) { m_threadEvent.setTarget(this), m_threadEvent.setSelector(ID_THREAD_EVENT); }
// message handler long onThreadEvent(FXObject*, FXSelector, void*) { do something with the GUI }
int threadFunction(...) { FXThreadEvent* pThreadEvent = (FXThreadEvent*)(ptr);
while (not_finished) { // work hard ...
// wake up GUI if (something_happened_and_the_GUI_needs_to_know_it) { pThreadEvent.signal(); } }
... }
Definition at line 111 of file FXThreadEvent.h.
|
protectedinherited |
flags defined are the same as those defined in FXWindow, etc.
Enumerator | |
---|---|
FLAG_ENABLED | |
FLAG_UPDATE | |
FLAG_FOCUSED | |
FLAG_DIRTY | |
FLAG_RECALC | |
FLAG_DEFAULT | |
FLAG_INITIAL | |
FLAG_ACTIVE | |
FLAG_CHANGED | |
FLAG_READONLY |
Definition at line 67 of file FXBaseObject.h.
|
inherited |
Definition at line 92 of file FXBaseObject.h.
anonymous enum |
Enumerator | |
---|---|
ID_THREAD_EVENT | |
ID_LAST |
Definition at line 122 of file FXThreadEvent.h.
|
protected |
FXEX::FXThreadEvent::FXThreadEvent | ( | FXObject * | tgt = NULL , |
FXSelector | sel = 0 |
||
) |
Construct an object capable of signaling the main FOX event loop.
Definition at line 77 of file FXThreadEvent.cpp.
References ID_THREAD_EVENT, and PIPE_READ.
|
virtual |
|
inlinevirtualinherited |
create resource
Definition at line 194 of file FXBaseObject.h.
|
inlinevirtualinherited |
destroy resource
Definition at line 200 of file FXBaseObject.h.
|
inlinevirtualinherited |
detach resource
Definition at line 197 of file FXBaseObject.h.
|
inlinevirtualinherited |
disable us
Definition at line 181 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::onCmdDisable().
|
inlinevirtualinherited |
enable us
Definition at line 176 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::onCmdEnable().
|
inherited |
application pointer
Definition at line 124 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::app.
|
inlineinherited |
get the message
Definition at line 141 of file FXBaseObject.h.
|
inlineinherited |
get the target
Definition at line 131 of file FXBaseObject.h.
|
inlineinherited |
get user data
Definition at line 151 of file FXBaseObject.h.
|
inlineinherited |
get user daat length
Definition at line 161 of file FXBaseObject.h.
|
inlineinherited |
are we enabled?
Definition at line 171 of file FXBaseObject.h.
|
inlinevirtualinherited |
are we modifiable
Definition at line 186 of file FXBaseObject.h.
|
virtualinherited |
load object from stream
Definition at line 112 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::app, FXEX::FXBaseObject::data, FXEX::FXBaseObject::datalen, FXEX::FXBaseObject::flags, load(), FXEX::FXBaseObject::message, FXEX::FXBaseObject::options, and FXEX::FXBaseObject::target.
Definition at line 147 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::disable().
Definition at line 141 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::enable().
Definition at line 141 of file FXThreadEvent.cpp.
Definition at line 128 of file FXThreadEvent.cpp.
References PIPE_READ, and FXEX::SEL_THREAD.
Definition at line 153 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::FLAG_ENABLED, and FXEX::FXBaseObject::flags.
|
protected |
|
virtualinherited |
save object to stream
Definition at line 100 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::app, FXEX::FXBaseObject::data, FXEX::FXBaseObject::datalen, FXEX::FXBaseObject::flags, FXEX::FXBaseObject::message, FXEX::FXBaseObject::options, and FXEX::FXBaseObject::target.
|
virtualinherited |
set modifiable mode
Definition at line 132 of file FXBaseObject.cpp.
References FXEX::FXBaseObject::FLAG_READONLY, and FXEX::FXBaseObject::flags.
|
inlineinherited |
set the selector
Definition at line 146 of file FXBaseObject.h.
Referenced by GUIApplicationWindow::dependentBuild().
|
inlineinherited |
set the target
Definition at line 136 of file FXBaseObject.h.
Referenced by GUIApplicationWindow::dependentBuild().
|
inlineinherited |
set user data
Definition at line 156 of file FXBaseObject.h.
|
inlineinherited |
set the user data length
Definition at line 166 of file FXBaseObject.h.
void FXEX::FXThreadEvent::signal | ( | ) |
Signal the event - using the SEL_THREAD FXSelector type
This is meant to be called from the worker thread - it sends a mesage to the target, which is in another thread.
Definition at line 105 of file FXThreadEvent.cpp.
References PIPE_WRITE, and FXEX::SEL_THREAD.
Referenced by GUIRunThread::makeStep(), GUILoadThread::retrieveMessage(), GUIRunThread::retrieveMessage(), and GUILoadThread::submitEndAndCleanup().
void FXEX::FXThreadEvent::signal | ( | FXuint | seltype | ) |
Signal the event - using the specified FXSelector
This is meant to be called from the worker thread - it sends a mesage to the target, which is in another thread.
Definition at line 116 of file FXThreadEvent.cpp.
References PIPE_WRITE, and UNUSED_PARAMETER.
|
protectedinherited |
Definition at line 86 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::FXBaseObject(), FXEX::FXBaseObject::load(), FXEX::FXBaseObject::save(), and FXEX::FXBaseObject::~FXBaseObject().
|
protectedinherited |
Definition at line 87 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::load(), and FXEX::FXBaseObject::save().
|
private |
Definition at line 115 of file FXThreadEvent.h.
|
protectedinherited |
Definition at line 88 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::FXBaseObject(), FXEX::FXBaseObject::load(), FXEX::FXBaseObject::onUpdate(), FXEX::FXBaseObject::save(), and FXEX::FXBaseObject::setReadonly().
|
protectedinherited |
Definition at line 85 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::FXBaseObject(), FXEX::FXBaseObject::load(), and FXEX::FXBaseObject::save().
|
protectedinherited |
Definition at line 89 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::load(), and FXEX::FXBaseObject::save().
|
protectedinherited |
Definition at line 84 of file FXBaseObject.h.
Referenced by FXEX::FXBaseObject::FXBaseObject(), FXEX::FXBaseObject::load(), FXEX::FXBaseObject::save(), and FXEX::FXBaseObject::~FXBaseObject().