SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
FXEX::FXThreadEvent Class Reference

#include <FXThreadEvent.h>

Inheritance diagram for FXEX::FXThreadEvent:
FXEX::FXBaseObject FXObject

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...
 
FXObjectgetTarget ()
 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
 
FXObjecttarget
 

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

Member Enumeration Documentation

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 68 of file FXBaseObject.h.

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 93 of file FXBaseObject.h.

anonymous enum
Enumerator
ID_THREAD_EVENT 
ID_LAST 

Definition at line 124 of file FXThreadEvent.h.

Constructor & Destructor Documentation

FXEX::FXThreadEvent::FXThreadEvent ( const FXThreadEvent )
protected
FXEX::FXThreadEvent::FXThreadEvent ( FXObject tgt = NULL,
FXSelector  sel = 0 
)

Construct an object capable of signaling the main FOX event loop.

Definition at line 79 of file FXThreadEvent.cpp.

References ID_THREAD_EVENT, PIPE_READ, and UNUSED_PARAMETER.

FXEX::FXThreadEvent::~FXThreadEvent ( )
virtual

destructor

Definition at line 94 of file FXThreadEvent.cpp.

References PIPE_READ, and PIPE_WRITE.

Member Function Documentation

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

create resource

Definition at line 195 of file FXBaseObject.h.

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

destroy resource

Definition at line 201 of file FXBaseObject.h.

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

detach resource

Definition at line 198 of file FXBaseObject.h.

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

disable us

Definition at line 182 of file FXBaseObject.h.

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

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

enable us

Definition at line 177 of file FXBaseObject.h.

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

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

application pointer

Definition at line 126 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::app.

FXSelector FXEX::FXBaseObject::getSelector ( )
inlineinherited

get the message

Definition at line 142 of file FXBaseObject.h.

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

get the target

Definition at line 132 of file FXBaseObject.h.

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

get user data

Definition at line 152 of file FXBaseObject.h.

FXuint FXEX::FXBaseObject::getUserDataLen ( )
inlineinherited

get user daat length

Definition at line 162 of file FXBaseObject.h.

FXbool FXEX::FXBaseObject::isEnabled ( )
inlineinherited

are we enabled?

Definition at line 172 of file FXBaseObject.h.

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

are we modifiable

Definition at line 187 of file FXBaseObject.h.

void FXEX::FXBaseObject::load ( FXStream &  store)
virtualinherited
long FXEX::FXBaseObject::onCmdDisable ( FXObject ,
FXSelector  ,
void *   
)
inherited

Definition at line 149 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::disable().

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

Definition at line 143 of file FXBaseObject.cpp.

References FXEX::FXBaseObject::enable().

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

Definition at line 144 of file FXThreadEvent.cpp.

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

Definition at line 131 of file FXThreadEvent.cpp.

References PIPE_READ, and FXEX::SEL_THREAD.

long FXEX::FXBaseObject::onUpdate ( FXObject sender,
FXSelector  ,
void *   
)
inherited
FXThreadEvent& FXEX::FXThreadEvent::operator= ( const FXThreadEvent )
protected
void FXEX::FXBaseObject::save ( FXStream &  store) const
virtualinherited
void FXEX::FXBaseObject::setReadonly ( FXbool  mode = TRUE)
virtualinherited

set modifiable mode

Definition at line 134 of file FXBaseObject.cpp.

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

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

set the selector

Definition at line 147 of file FXBaseObject.h.

Referenced by GUIApplicationWindow::dependentBuild().

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

set the target

Definition at line 137 of file FXBaseObject.h.

Referenced by GUIApplicationWindow::dependentBuild().

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

set user data

Definition at line 157 of file FXBaseObject.h.

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

set the user data length

Definition at line 167 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 108 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 119 of file FXThreadEvent.cpp.

References PIPE_WRITE, and UNUSED_PARAMETER.

Field Documentation

void* FXEX::FXBaseObject::data
protectedinherited
FXuint FXEX::FXBaseObject::datalen
protectedinherited

Definition at line 88 of file FXBaseObject.h.

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

FXThreadEventHandle FXEX::FXThreadEvent::event
private

Definition at line 117 of file FXThreadEvent.h.

FXuint FXEX::FXBaseObject::flags
protectedinherited
FXSelector FXEX::FXBaseObject::message
protectedinherited
FXuint FXEX::FXBaseObject::options
protectedinherited

Definition at line 90 of file FXBaseObject.h.

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

FXObject* FXEX::FXBaseObject::target
protectedinherited

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