AIStatefulTask ‐ Asynchronous, Stateful Task Scheduler library.

Threads-like task objects evolving through user-defined states.

Classes | Functions
statefultask Namespace Reference

Tasks defined by the library project are put into this namespace. More...

Classes

class  AdoptLock
 
class  BrokerKey
 
struct  BrokerKeyEqual
 
struct  BrokerKeyHash
 
class  DefaultMemoryPagePool
 
class  ResourceFactory
 
class  ResourcePool
 
class  RunningTasksTracker
 
class  TaskCounterGate
 
class  TaskEvent
 

Functions

template<task::TaskType TaskType, typename... ARGS>
boost::intrusive_ptr< TaskType > create (ARGS &&... args)
 Convenience function to create tasks. More...
 
template<task::TaskType TaskType, typename... ARGS>
boost::intrusive_ptr< TaskType > create_from_tuple (std::tuple< ARGS... > &&args)
 

Detailed Description

Tasks defined by the library project are put into this namespace.

Function Documentation

◆ create()

template<task::TaskType TaskType, typename... ARGS>
boost::intrusive_ptr< TaskType > statefultask::create ( ARGS &&...  args)

Convenience function to create tasks.

Typical usage,

class ATask : public AIStatefulTask {
...
public:
void init(...);
};
class SomeClass
{
boost::intrusive_ptr<ATask> m_task;
public:
SomeClass() : m_task(statefultask::create<ATask>(/* constructor arguments of ATask */)) { }
void initial_run(...)
{
m_task->init(...);
m_task->run(...);
}
};
Definition: AIStatefulTask.h:96
Tasks defined by the library project are put into this namespace.
Definition: AIStatefulTask.h:857
boost::intrusive_ptr< TaskType > create(ARGS &&... args)
Convenience function to create tasks.
Definition: AIStatefulTask.h:894

Or, for a one-shot task

auto task = statefultask::create<ATask>(/* constructor arguments of ATask */);
task->init(...);
task->run(...);