Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cartographer::common::Task Class Referenceabstract

#include <task.h>

Public Types

enum  State {
  NEW, DISPATCHED, DEPENDENCIES_COMPLETED, RUNNING,
  COMPLETED
}
 
using WorkItem = std::function< void()>
 

Public Member Functions

void AddDependency (std::weak_ptr< Task > dependency) EXCLUDES(mutex_)
 
State GetState () EXCLUDES(mutex_)
 
void SetWorkItem (const WorkItem &work_item) EXCLUDES(mutex_)
 
 Task ()=default
 
 ~Task ()
 

Private Member Functions

void AddDependentTask (Task *dependent_task)
 
void Execute () EXCLUDES(mutex_)
 
WorkItem work_item_ GUARDED_BY (mutex_)
 
ThreadPoolInterface *thread_pool_to_notify_ GUARDED_BY (mutex_)
 
State state_ GUARDED_BY (mutex_)
 
unsigned int uncompleted_dependencies_ GUARDED_BY (mutex_)=0
 
std::set< Task * > dependent_tasks_ GUARDED_BY (mutex_)
 
void OnDependenyCompleted ()
 
void SetThreadPool (ThreadPoolInterface *thread_pool) EXCLUDES(mutex_)
 

Private Attributes

Mutex mutex_
 

Friends

class ThreadPoolInterface
 

Detailed Description

Definition at line 31 of file task.h.

Member Typedef Documentation

◆ WorkItem

using cartographer::common::Task::WorkItem = std::function<void()>

Definition at line 35 of file task.h.

Member Enumeration Documentation

◆ State

Enumerator
NEW 
DISPATCHED 
DEPENDENCIES_COMPLETED 
RUNNING 
COMPLETED 

Definition at line 36 of file task.h.

Constructor & Destructor Documentation

◆ Task()

cartographer::common::Task::Task ( )
default

◆ ~Task()

cartographer::common::Task::~Task ( )

Definition at line 22 of file task.cc.

Member Function Documentation

◆ AddDependency()

void cartographer::common::Task::AddDependency ( std::weak_ptr< Task dependency)

Definition at line 40 of file task.cc.

◆ AddDependentTask()

void cartographer::common::Task::AddDependentTask ( Task dependent_task)
private

Definition at line 66 of file task.cc.

◆ Execute()

void cartographer::common::Task::Execute ( )
private

Definition at line 87 of file task.cc.

◆ GetState()

Task::State cartographer::common::Task::GetState ( )

Definition at line 29 of file task.cc.

◆ GUARDED_BY() [1/5]

WorkItem work_item_ cartographer::common::Task::GUARDED_BY ( mutex_  )
private

◆ GUARDED_BY() [2/5]

ThreadPoolInterface* thread_pool_to_notify_ cartographer::common::Task::GUARDED_BY ( mutex_  )
private

◆ GUARDED_BY() [3/5]

State state_ cartographer::common::Task::GUARDED_BY ( mutex_  )
private

◆ GUARDED_BY() [4/5]

unsigned int uncompleted_dependencies_ cartographer::common::Task::GUARDED_BY ( mutex_  )
privatepure virtual

◆ GUARDED_BY() [5/5]

std::set<Task*> dependent_tasks_ cartographer::common::Task::GUARDED_BY ( mutex_  )
private

◆ OnDependenyCompleted()

void cartographer::common::Task::OnDependenyCompleted ( )
private

Definition at line 76 of file task.cc.

◆ SetThreadPool()

void cartographer::common::Task::SetThreadPool ( ThreadPoolInterface thread_pool)
private

Definition at line 54 of file task.cc.

◆ SetWorkItem()

void cartographer::common::Task::SetWorkItem ( const WorkItem work_item)

Definition at line 34 of file task.cc.

Friends And Related Function Documentation

◆ ThreadPoolInterface

friend class ThreadPoolInterface
friend

Definition at line 33 of file task.h.

Member Data Documentation

◆ mutex_

Mutex cartographer::common::Task::mutex_
private

Definition at line 70 of file task.h.


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


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:59