Public Member Functions | Private Member Functions | Private Attributes
UObjDeletionThread< T > Class Template Reference

#include <UObjDeletionThread.h>

Inheritance diagram for UObjDeletionThread< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

int id () const
void setObj (T *obj)
void startDeletion (int waitMs=0)
 UObjDeletionThread (T *obj, int id=0)
virtual ~UObjDeletionThread ()

Private Member Functions

virtual void mainLoop ()

Private Attributes

int id_
Tobj_
int waitMs_

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

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.

template<class T >
virtual UObjDeletionThread< T >::~UObjDeletionThread ( ) [inline, virtual]

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

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.

template<class T >
virtual void UObjDeletionThread< T >::mainLoop ( ) [inline, private, virtual]

Thread main loop...

Implements UThread.

Definition at line 108 of file UObjDeletionThread.h.

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.

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.


Member Data Documentation

template<class T >
int UObjDeletionThread< T >::id_ [private]

Definition at line 125 of file UObjDeletionThread.h.

template<class T >
T* UObjDeletionThread< T >::obj_ [private]

Definition at line 124 of file UObjDeletionThread.h.

template<class T >
int UObjDeletionThread< T >::waitMs_ [private]

Definition at line 126 of file UObjDeletionThread.h.


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


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jun 6 2019 21:59:39