Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
FXEX::MFXThreadEvent Class Reference

#include <MFXThreadEvent.h>

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

Public Types

enum  { ID_THREAD_EVENT = MFXBaseObject::ID_LAST , ID_LAST }
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
}

Public Member Functions

virtual void create ()
 create resource
virtual void destroy ()
 destroy resource
virtual void detach ()
 detach resource
virtual void disable ()
 disable us
virtual void enable ()
 enable us
FXApp * getApp ()
 application pointer
FXSelector getSelector ()
 get the message
FXObject * getTarget ()
 get the target
void * getUserData ()
 get user data
FXuint getUserDataLen ()
 get user daat length
FXbool isEnabled ()
 are we enabled?
virtual FXbool isReadonly ()
 are we modifiable
virtual void load (FXStream &store)
 load object from stream
 MFXThreadEvent (FXObject *tgt=NULL, FXSelector sel=0)
 Construct an object capable of signaling the main FOX event loop.
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
virtual void setReadonly (FXbool mode=TRUE)
 set modifiable mode
void setSelector (FXSelector sel)
 set the selector
void setTarget (FXObject *tgt)
 set the target
void setUserData (void *d)
 set user data
void setUserDataLen (FXuint len)
 set the user data length
void signal ()
void signal (FXuint seltype)
virtual ~MFXThreadEvent ()
 destructor

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
Enumerator
ID_THREAD_EVENT 
ID_LAST 

Definition at line 112 of file MFXThreadEvent.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
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.

Constructor & Destructor Documentation

◆ MFXThreadEvent() [1/2]

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

References MFXThreadEvent().

Referenced by MFXThreadEvent(), MFXThreadEvent(), and operator=().

Here is the caller graph for this function:

◆ 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 event, FXEX::MFXBaseObject::getApp(), ID_THREAD_EVENT, FXEX::MFXBaseObject::MFXBaseObject(), MFXThreadEvent(), PIPE_READ, and UNUSED_PARAMETER.

◆ ~MFXThreadEvent()

FXEX::MFXThreadEvent::~MFXThreadEvent ( )
virtual

destructor

Definition at line 81 of file MFXThreadEvent.cpp.

References event, FXEX::MFXBaseObject::getApp(), 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.

References FLAG_ENABLED, and flags.

Referenced by 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.

References FLAG_ENABLED, and flags.

Referenced by 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 app.

Referenced by FXEX::MFXThreadEvent::MFXThreadEvent(), and FXEX::MFXThreadEvent::~MFXThreadEvent().

Here is the caller graph for this function:

◆ getSelector()

FXSelector FXEX::MFXBaseObject::getSelector ( )
inlineinherited

get the message

Definition at line 128 of file MFXBaseObject.h.

References message.

◆ getTarget()

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

get the target

Definition at line 118 of file MFXBaseObject.h.

References target.

◆ getUserData()

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

get user data

Definition at line 138 of file MFXBaseObject.h.

References data.

◆ getUserDataLen()

FXuint FXEX::MFXBaseObject::getUserDataLen ( )
inlineinherited

get user daat length

Definition at line 148 of file MFXBaseObject.h.

References datalen.

◆ isEnabled()

FXbool FXEX::MFXBaseObject::isEnabled ( )
inlineinherited

are we enabled?

Definition at line 158 of file MFXBaseObject.h.

References FLAG_ENABLED, and flags.

◆ isReadonly()

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

are we modifiable

Definition at line 173 of file MFXBaseObject.h.

References FLAG_READONLY, and flags.

◆ load()

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

load object from stream

Definition at line 106 of file MFXBaseObject.cpp.

References app, data, datalen, flags, message, options, and target.

◆ onCmdDisable()

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

Definition at line 141 of file MFXBaseObject.cpp.

References disable().

Referenced by FXEX::FXDEFMAP().

Here is the caller graph for this function:

◆ onCmdEnable()

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

Definition at line 135 of file MFXBaseObject.cpp.

References enable().

Referenced by FXEX::FXDEFMAP().

Here is the caller graph for this function:

◆ onThreadEvent()

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

Definition at line 134 of file MFXThreadEvent.cpp.

References FXEX::MFXBaseObject::message, and FXEX::MFXBaseObject::target.

Referenced by FXEX::FXDEFMAP().

Here is the caller graph for this function:

◆ onThreadSignal()

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

Definition at line 120 of file MFXThreadEvent.cpp.

References event, PIPE_READ, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

Referenced by FXEX::FXDEFMAP().

Here is the caller graph for this function:

◆ onUpdate()

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

Definition at line 147 of file MFXBaseObject.cpp.

References FLAG_ENABLED, and flags.

Referenced by FXEX::FXDEFMAP().

Here is the caller graph for this function:

◆ operator=()

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

References MFXThreadEvent().

◆ save()

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

save object to stream

Definition at line 94 of file MFXBaseObject.cpp.

References app, data, datalen, flags, message, options, and target.

◆ setReadonly()

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

set modifiable mode

Definition at line 126 of file MFXBaseObject.cpp.

References FLAG_READONLY, and flags.

◆ setSelector()

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

set the selector

Definition at line 133 of file MFXBaseObject.h.

References message.

◆ setTarget()

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

set the target

Definition at line 123 of file MFXBaseObject.h.

References target.

◆ setUserData()

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

set user data

Definition at line 143 of file MFXBaseObject.h.

References data.

◆ setUserDataLen()

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

set the user data length

Definition at line 153 of file MFXBaseObject.h.

References datalen.

◆ 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 event, PIPE_WRITE, FXEX::SEL_THREAD, and UNUSED_PARAMETER.

◆ 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 event, PIPE_WRITE, and UNUSED_PARAMETER.

Field Documentation

◆ app

FXApp* FXEX::MFXBaseObject::app
privateinherited

Definition at line 68 of file MFXBaseObject.h.

Referenced by getApp(), load(), MFXBaseObject(), MFXBaseObject(), save(), and ~MFXBaseObject().

◆ data

void* FXEX::MFXBaseObject::data
protectedinherited

◆ datalen

FXuint FXEX::MFXBaseObject::datalen
protectedinherited

Definition at line 74 of file MFXBaseObject.h.

Referenced by getUserDataLen(), load(), save(), and setUserDataLen().

◆ event

MFXThreadEventHandle FXEX::MFXThreadEvent::event
private

Definition at line 105 of file MFXThreadEvent.h.

Referenced by MFXThreadEvent(), onThreadSignal(), signal(), signal(), and ~MFXThreadEvent().

◆ flags

FXuint FXEX::MFXBaseObject::flags
protectedinherited

◆ message

FXSelector FXEX::MFXBaseObject::message
protectedinherited

◆ options

FXuint FXEX::MFXBaseObject::options
protectedinherited

Definition at line 76 of file MFXBaseObject.h.

Referenced by load(), and save().

◆ target

FXObject* FXEX::MFXBaseObject::target
protectedinherited

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