Eclipse SUMO - Simulation of Urban MObility
FXEX::MFXThreadEvent Class Reference

#include <MFXThreadEvent.h>

Inheritance diagram for FXEX::MFXThreadEvent:
[legend]
Collaboration diagram for FXEX::MFXThreadEvent:
[legend]

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 = MFXBaseObject::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...
 
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...
 
 MFXThreadEvent (FXObject *tgt=NULL, FXSelector sel=0)
 Construct an object capable of signaling the main FOX event loop. 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 ~MFXThreadEvent ()
 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

 MFXThreadEvent (const MFXThreadEvent &)
 
MFXThreadEventoperator= (const MFXThreadEvent &)
 

Protected Attributes

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

Private Attributes

FXApp * app
 
MFXThreadEventHandle 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 MFXThreadEvent 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(...) { MFXThreadEvent* pThreadEvent = (MFXThreadEvent*)(ptr);

while (not_finished) { // work hard ...

// wake up GUI if (something_happened_and_the_GUI_needs_to_know_it) { pThreadEvent.signal(); } }

... }

Definition at line 101 of file MFXThreadEvent.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 54 of file MFXBaseObject.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 79 of file MFXBaseObject.h.

◆ anonymous enum

anonymous enum
Enumerator
ID_THREAD_EVENT 
ID_LAST 

Definition at line 112 of file MFXThreadEvent.h.

Constructor & Destructor Documentation

◆ MFXThreadEvent() [1/2]

FXEX::MFXThreadEvent::MFXThreadEvent ( const MFXThreadEvent )
protected

◆ MFXThreadEvent() [2/2]

FXEX::MFXThreadEvent::MFXThreadEvent ( FXObject *  tgt = NULL,
FXSelector  sel = 0 
)

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

Definition at line 66 of file MFXThreadEvent.cpp.

References ID_THREAD_EVENT, PIPE_READ, and UNUSED_PARAMETER.

◆ ~MFXThreadEvent()

FXEX::MFXThreadEvent::~MFXThreadEvent ( )
virtual

destructor

Definition at line 81 of file MFXThreadEvent.cpp.

References PIPE_READ, and PIPE_WRITE.

Member Function Documentation

◆ create()

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

create resource

Definition at line 181 of file MFXBaseObject.h.

◆ destroy()

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

destroy resource

Definition at line 187 of file MFXBaseObject.h.

◆ detach()

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

detach resource

Definition at line 184 of file MFXBaseObject.h.

◆ disable()

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

disable us

Definition at line 168 of file MFXBaseObject.h.

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

Here is the caller graph for this function:

◆ enable()

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

enable us

Definition at line 163 of file MFXBaseObject.h.

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

Here is the caller graph for this function:

◆ getApp()

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

application pointer

Definition at line 118 of file MFXBaseObject.cpp.

References FXEX::MFXBaseObject::app.

◆ getSelector()

FXSelector FXEX::MFXBaseObject::getSelector ( )
inlineinherited

get the message

Definition at line 128 of file MFXBaseObject.h.

◆ getTarget()

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

get the target

Definition at line 118 of file MFXBaseObject.h.

◆ getUserData()

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

get user data

Definition at line 138 of file MFXBaseObject.h.

◆ getUserDataLen()

FXuint FXEX::MFXBaseObject::getUserDataLen ( )
inlineinherited

get user daat length

Definition at line 148 of file MFXBaseObject.h.

◆ isEnabled()

FXbool FXEX::MFXBaseObject::isEnabled ( )
inlineinherited

are we enabled?

Definition at line 158 of file MFXBaseObject.h.

◆ isReadonly()

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

are we modifiable

Definition at line 173 of file MFXBaseObject.h.

◆ load()

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

◆ onCmdDisable()

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

Definition at line 141 of file MFXBaseObject.cpp.

References FXEX::MFXBaseObject::disable().

◆ onCmdEnable()

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

Definition at line 135 of file MFXBaseObject.cpp.

References FXEX::MFXBaseObject::enable().

◆ onThreadEvent()

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

Definition at line 134 of file MFXThreadEvent.cpp.

◆ onThreadSignal()

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

Definition at line 120 of file MFXThreadEvent.cpp.

References PIPE_READ, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

◆ onUpdate()

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

◆ operator=()

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

◆ save()

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

◆ setReadonly()

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

set modifiable mode

Definition at line 126 of file MFXBaseObject.cpp.

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

◆ setSelector()

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

set the selector

Definition at line 133 of file MFXBaseObject.h.

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

Here is the caller graph for this function:

◆ setTarget()

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

set the target

Definition at line 123 of file MFXBaseObject.h.

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

Here is the caller graph for this function:

◆ setUserData()

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

set user data

Definition at line 143 of file MFXBaseObject.h.

◆ setUserDataLen()

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

set the user data length

Definition at line 153 of file MFXBaseObject.h.

◆ signal() [1/2]

void FXEX::MFXThreadEvent::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 95 of file MFXThreadEvent.cpp.

References PIPE_WRITE, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

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

Here is the caller graph for this function:

◆ signal() [2/2]

void FXEX::MFXThreadEvent::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 107 of file MFXThreadEvent.cpp.

References PIPE_WRITE, and UNUSED_PARAMETER.

Field Documentation

◆ app

◆ data

void* FXEX::MFXBaseObject::data
protectedinherited

◆ datalen

FXuint FXEX::MFXBaseObject::datalen
protectedinherited

Definition at line 74 of file MFXBaseObject.h.

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

◆ event

MFXThreadEventHandle FXEX::MFXThreadEvent::event
private

Definition at line 105 of file MFXThreadEvent.h.

◆ flags

◆ message

FXSelector FXEX::MFXBaseObject::message
protectedinherited

◆ options

FXuint FXEX::MFXBaseObject::options
protectedinherited

Definition at line 76 of file MFXBaseObject.h.

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

◆ target

FXObject* FXEX::MFXBaseObject::target
protectedinherited

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