RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
UObjDeletionThread< T > Class Template Reference

#include <UObjDeletionThread.h>

Inheritance diagram for UObjDeletionThread< T >:
Collaboration diagram for UObjDeletionThread< T >:

Public Member Functions

 UObjDeletionThread (T *obj, int id=0)
 
virtual ~UObjDeletionThread ()
 
void startDeletion (int waitMs=0)
 
int id () const
 
void setObj (T *obj)
 
- 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
 

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) ()
 
- 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)
 
- 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 ()
 

Detailed Description

template<class T>
class UObjDeletionThread< T >

This class can be used to delete a dynamically created object in another thread. Give the dynamic reference to object to it and it will notify with a UObjDeletedEvent when the object is deleted. The deletion can be delayed on startDeletion(), the thread will wait the time given before deleting the object.

Definition at line 48 of file UObjDeletionThread.h.

Constructor & Destructor Documentation

◆ UObjDeletionThread()

template<class T >
UObjDeletionThread< T >::UObjDeletionThread ( T *  obj,
int  id = 0 
)
inline

The constructor.

Parameters
objthe object to delete
idthe custom id which will be sent in a event UObjDeletedEvent after the object is deleted

Definition at line 56 of file UObjDeletionThread.h.

◆ ~UObjDeletionThread()

template<class T >
virtual UObjDeletionThread< T >::~UObjDeletionThread ( )
inlinevirtual

The destructor. If this thread is not started but with an object set, the object is deleted. If the thread has not finished to delete the object, the calling thread will wait (on a UThreadNode::join()) until the object is deleted.

Parameters
objthe object to delete
idthe custom id which will be sent in a event UObjDeletedEvent after the object is deleted

Definition at line 68 of file UObjDeletionThread.h.

Member Function Documentation

◆ startDeletion()

template<class T >
void UObjDeletionThread< T >::startDeletion ( int  waitMs = 0)
inline

Start the thread after optional delay.

Parameters
waitMsthe delay before deletion

Definition at line 81 of file UObjDeletionThread.h.

◆ id()

template<class T >
int UObjDeletionThread< T >::id ( ) const
inline

Get id of the deleted object.

Returns
the id

Definition at line 87 of file UObjDeletionThread.h.

◆ setObj()

template<class T >
void UObjDeletionThread< T >::setObj ( T *  obj)
inline

Set a new object, if one was already set, the old one is deleted.

Parameters
objthe object to delete

Definition at line 93 of file UObjDeletionThread.h.


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