SUMO - Simulation of Urban MObility
FXEX::FXThreadEvent Class Reference

#include <FXThreadEvent.h>

Inheritance diagram for FXEX::FXThreadEvent:
Inheritance graph
Collaboration diagram for FXEX::FXThreadEvent:
Collaboration graph

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 &)
 
FXThreadEventoperator= (const FXThreadEvent &)
 

Protected Attributes

void * data
 
FXuint datalen
 
FXuint flags
 
FXSelector message
 
FXuint options
 
FXObject * target
 

Private Attributes

FXThreadEventHandle event
 

Detailed Description

:Description

Interthread communication object


Usage:

GUI_thread.h:

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; };

GUI_thread.cpp:

// 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 }

Worker_thread.cpp:

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 112 of file FXThreadEvent.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
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.

◆ anonymous enum

anonymous enum
inherited
Enumerator
ID_NONE 
ID_DELETE 
ID_DISABLE 
ID_ENABLE 
ID_SETVALUE 
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 

Definition at line 92 of file FXBaseObject.h.

◆ anonymous enum

anonymous enum
Enumerator
ID_THREAD_EVENT 
ID_LAST 

Definition at line 123 of file FXThreadEvent.h.

Constructor & Destructor Documentation

◆ FXThreadEvent() [1/2]

FXEX::FXThreadEvent::FXThreadEvent ( const FXThreadEvent )
protected

◆ FXThreadEvent() [2/2]

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, PIPE_READ, and UNUSED_PARAMETER.

◆ ~FXThreadEvent()

FXEX::FXThreadEvent::~FXThreadEvent ( )
virtual

destructor

Definition at line 92 of file FXThreadEvent.cpp.

References PIPE_READ, and PIPE_WRITE.

Member Function Documentation

◆ create()

virtual void FXEX::FXBaseObject::create ( )
inlinevirtualinherited

create resource

Definition at line 194 of file FXBaseObject.h.

◆ destroy()

virtual void FXEX::FXBaseObject::destroy ( )
inlinevirtualinherited

destroy resource

Definition at line 200 of file FXBaseObject.h.

◆ detach()

virtual void FXEX::FXBaseObject::detach ( )
inlinevirtualinherited

detach resource

Definition at line 197 of file FXBaseObject.h.

◆ disable()

virtual void FXEX::FXBaseObject::disable ( )
inlinevirtualinherited

disable us

Definition at line 181 of file FXBaseObject.h.

Referenced by FXEX::FXBaseObject::onCmdDisable().

◆ enable()

virtual void FXEX::FXBaseObject::enable ( )
inlinevirtualinherited

enable us

Definition at line 176 of file FXBaseObject.h.

Referenced by FXEX::FXBaseObject::onCmdEnable().

◆ getApp()

FXApp * FXEX::FXBaseObject::getApp ( )
inherited

application pointer

Definition at line 124 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::app.

◆ getSelector()

FXSelector FXEX::FXBaseObject::getSelector ( )
inlineinherited

get the message

Definition at line 141 of file FXBaseObject.h.

◆ getTarget()

FXObject* FXEX::FXBaseObject::getTarget ( )
inlineinherited

get the target

Definition at line 131 of file FXBaseObject.h.

◆ getUserData()

void* FXEX::FXBaseObject::getUserData ( )
inlineinherited

get user data

Definition at line 151 of file FXBaseObject.h.

◆ getUserDataLen()

FXuint FXEX::FXBaseObject::getUserDataLen ( )
inlineinherited

get user daat length

Definition at line 161 of file FXBaseObject.h.

◆ isEnabled()

FXbool FXEX::FXBaseObject::isEnabled ( )
inlineinherited

are we enabled?

Definition at line 171 of file FXBaseObject.h.

◆ isReadonly()

virtual FXbool FXEX::FXBaseObject::isReadonly ( )
inlinevirtualinherited

are we modifiable

Definition at line 186 of file FXBaseObject.h.

◆ load()

void FXEX::FXBaseObject::load ( FXStream &  store)
virtualinherited

◆ onCmdDisable()

long FXEX::FXBaseObject::onCmdDisable ( FXObject *  ,
FXSelector  ,
void *   
)
inherited

Definition at line 147 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::disable().

◆ onCmdEnable()

long FXEX::FXBaseObject::onCmdEnable ( FXObject *  ,
FXSelector  ,
void *   
)
inherited

Definition at line 141 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::enable().

◆ onThreadEvent()

long FXEX::FXThreadEvent::onThreadEvent ( FXObject *  ,
FXSelector  sel,
void *   
)

Definition at line 145 of file FXThreadEvent.cpp.

◆ onThreadSignal()

long FXEX::FXThreadEvent::onThreadSignal ( FXObject *  ,
FXSelector  ,
void *   
)

Definition at line 131 of file FXThreadEvent.cpp.

References PIPE_READ, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

◆ onUpdate()

long FXEX::FXBaseObject::onUpdate ( FXObject *  sender,
FXSelector  ,
void *   
)
inherited

◆ operator=()

FXThreadEvent& FXEX::FXThreadEvent::operator= ( const FXThreadEvent )
protected

◆ save()

void FXEX::FXBaseObject::save ( FXStream &  store) const
virtualinherited

◆ setReadonly()

void FXEX::FXBaseObject::setReadonly ( FXbool  mode = TRUE)
virtualinherited

set modifiable mode

Definition at line 132 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::FLAG_READONLY, and FXEX::FXBaseObject::flags.

◆ setSelector()

void FXEX::FXBaseObject::setSelector ( FXSelector  sel)
inlineinherited

set the selector

Definition at line 146 of file FXBaseObject.h.

Referenced by GUIApplicationWindow::dependentBuild(), and GNEApplicationWindow::dependentBuild().

◆ setTarget()

void FXEX::FXBaseObject::setTarget ( FXObject *  tgt)
inlineinherited

set the target

Definition at line 136 of file FXBaseObject.h.

Referenced by GUIApplicationWindow::dependentBuild(), and GNEApplicationWindow::dependentBuild().

◆ setUserData()

void FXEX::FXBaseObject::setUserData ( void *  d)
inlineinherited

set user data

Definition at line 156 of file FXBaseObject.h.

◆ setUserDataLen()

void FXEX::FXBaseObject::setUserDataLen ( FXuint  len)
inlineinherited

set the user data length

Definition at line 166 of file FXBaseObject.h.

◆ signal() [1/2]

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 106 of file FXThreadEvent.cpp.

References PIPE_WRITE, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

Referenced by GUIRunThread::makeStep(), GUILoadThread::retrieveMessage(), GNELoadThread::retrieveMessage(), GUIRunThread::retrieveMessage(), GUILoadThread::run(), GUIApplicationWindow::sendBlockingEvent(), GUILoadThread::submitEndAndCleanup(), and GNELoadThread::submitEndAndCleanup().

◆ signal() [2/2]

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 118 of file FXThreadEvent.cpp.

References PIPE_WRITE, and UNUSED_PARAMETER.

Field Documentation

◆ data

void* FXEX::FXBaseObject::data
protectedinherited

◆ datalen

FXuint FXEX::FXBaseObject::datalen
protectedinherited

Definition at line 87 of file FXBaseObject.h.

Referenced by FXEX::FXBaseObject::load(), and FXEX::FXBaseObject::save().

◆ event

FXThreadEventHandle FXEX::FXThreadEvent::event
private

Definition at line 116 of file FXThreadEvent.h.

◆ flags

FXuint FXEX::FXBaseObject::flags
protectedinherited

◆ message

FXSelector FXEX::FXBaseObject::message
protectedinherited

◆ options

FXuint FXEX::FXBaseObject::options
protectedinherited

Definition at line 89 of file FXBaseObject.h.

Referenced by FXEX::FXBaseObject::load(), and FXEX::FXBaseObject::save().

◆ target

FXObject* FXEX::FXBaseObject::target
protectedinherited

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