RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
UEventsManager Class Reference

#include <UEventsManager.h>

Inheritance diagram for UEventsManager:
Collaboration diagram for UEventsManager:

Static Public Member Functions

static void addHandler (UEventsHandler *handler)
 
static void removeHandler (UEventsHandler *handler)
 
static void post (UEvent *event, bool async=true, const UEventsSender *sender=0)
 
static void createPipe (const UEventsSender *sender, const UEventsHandler *receiver, const std::string &eventName)
 
static void removePipe (const UEventsSender *sender, const UEventsHandler *receiver, const std::string &eventName)
 
static void removeAllPipes (const UEventsSender *sender)
 
static void removeNullPipes (const UEventsSender *sender)
 
- Static Public Member Functions inherited from UThread
static unsigned long currentThreadId ()
 
- Static Public Member Functions inherited from UThreadC< void >
static int Create (const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false)
 
static int Join (Handle H)
 
static int Kill (Handle H)
 
static int Detach (Handle H)
 
static int Create (const Handler &Function, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false)
 
static int Join (const Handle &H)
 
static int Kill (const Handle &H)
 
static int Detach (const Handle &H)
 

Protected Member Functions

virtual void mainLoop ()
 

Static Protected Member Functions

static UEventsManagergetInstance ()
 
- Static Protected Member Functions inherited from UThreadC< void >
static void Exit ()
 
static void TestCancel ()
 
static Handle Self ()
 
static void Exit ()
 
static void TestCancel ()
 
static int Self ()
 

Friends

class UDestroyer< UEventsManager >
 

Additional Inherited Members

- Public Types inherited from UThread
enum  Priority {
  kPLow , kPBelowNormal , kPNormal , kPAboveNormal ,
  kPRealTime
}
 
- Public Types inherited from UThreadC< void >
typedef THREAD_HANDLE Handle
 
typedef void(* Handler) ()
 
typedef THREAD_HANDLE Handle
 
typedef void(* Handler) ()
 
- Public Member Functions inherited from UThread
 UThread (Priority priority=kPNormal)
 
virtual ~UThread ()
 
void start ()
 
void kill ()
 
void join (bool killFirst=false)
 
void setPriority (Priority priority)
 
void setAffinity (int cpu=0)
 
bool isCreating () const
 
bool isRunning () const
 
bool isIdle () const
 
bool isKilled () const
 
Handle getThreadHandle () const
 
unsigned long getThreadId () const
 
- Public Member Functions inherited from UThreadC< void >
int Create (Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
 
int Create (unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
 
int Create (Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
 
int Create (unsigned long &ThreadId, Handle *const &H=0, const bool &CreateDetached=false, const unsigned int &StackSize=0, const bool &CancelEnable=false, const bool &CancelAsync=false) const
 

Detailed Description

This class is used to post events between threads in the application. It is Thread-Safe and the events are sent to receivers in the same order they are posted (FIFO). It works like the design pattern Mediator. It is also a Singleton, so it can be used anywhere in the application.

To send an event, use UEventsManager::post(). Events are automatically deleted after they are posted.

The EventsManager have a list of handlers to which it sends posted events. To add an handler, use UEventsManager::addHandler(). To remove, use UEventsManager::removeHandler().

// Anywhere in the code:
UEventsManager::post(new MyEvent()); // where MyEvent is an implemented UEvent
static void post(UEvent *event, bool async=true, const UEventsSender *sender=0)
See also
UEvent
UEventsHandler
post()
addHandler()
removeHandler()

Definition at line 78 of file UEventsManager.h.

Member Function Documentation

◆ addHandler()

static void UEventsManager::addHandler ( UEventsHandler handler)
static

This method is used to add an events handler to the list of handlers.

Parameters
handlerthe handler to be added.

◆ removeHandler()

static void UEventsManager::removeHandler ( UEventsHandler handler)
static

This method is used to remove an events handler from the list of handlers.

Parameters
handlerthe handler to be removed.

◆ post()

static void UEventsManager::post ( UEvent event,
bool  async = true,
const UEventsSender sender = 0 
)
static

This method is used to post an event to handlers.

Event can be posted asynchronously or not. In the first case, the event is dispatched by the UEventsManager's thread. In the second case, the event is handled immediately by event's receivers, thus in the sender thread.

Parameters
eventthe event to be posted.
asyncif true, the event is dispatched by the UEventsManager thread, otherwise it's in the caller thread (synchronous).

◆ mainLoop()

virtual void UEventsManager::mainLoop ( )
protectedvirtual

The UEventsManager's main loop.

Implements UThread.

Friends And Related Symbol Documentation

◆ UDestroyer< UEventsManager >

friend class UDestroyer< UEventsManager >
friend

Definition at line 147 of file UEventsManager.h.


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