43#include "threadsafe/aithreadsafe.h"
44#include "threadsafe/ConditionVariable.h"
46#include "utils/FuzzyBool.h"
50#include <boost/intrusive_ptr.hpp>
112 struct QueueElementComp;
115 boost::intrusive_ptr<AIStatefulTask> mStatefulTask;
118 QueueElement(
AIStatefulTask* stateful_task) : mStatefulTask(stateful_task) { }
119 friend bool operator==(QueueElement
const& e1, QueueElement
const& e2) {
return e1.mStatefulTask == e2.mStatefulTask; }
120 friend bool operator!=(QueueElement
const& e1, QueueElement
const& e2) {
return e1.mStatefulTask != e2.mStatefulTask; }
121 friend struct QueueElementComp;
123 AIStatefulTask const& stateful_task()
const {
return *mStatefulTask; }
126 struct QueueElementComp {
127 inline bool operator()(QueueElement
const& e1, QueueElement
const& e2)
const;
130 using queued_type = std::list<QueueElement>;
132 struct engine_state_st
136 engine_state_st() : waiting(
false) { }
139 using engine_state_type = aithreadsafe::Wrapper<engine_state_st, aithreadsafe::policy::Primitive<aithreadsafe::ConditionVariable>>;
143 using clock_type = AIStatefulTask::clock_type;
144 using duration_type = AIStatefulTask::duration_type;
148 engine_state_type mEngineState;
150 duration_type mMaxDuration;
151 bool mHasMaxDuration;
211 char const*
name()
const {
return mName; }
Declaration of base class AIStatefulTask.
Definition: AIEngine.h:110
bool hasMaxDuration() const
Definition: AIEngine.h:229
void add(AIStatefulTask *stateful_task)
Definition: AIEngine.cxx:44
char const * name() const
Definition: AIEngine.h:211
void setMaxDuration(float max_duration)
Definition: AIEngine.cxx:176
void flush()
Definition: AIEngine.cxx:163
utils::FuzzyBool mainloop()
Definition: AIEngine.cxx:67
AIEngine(char const *name, float max_duration=0.0f)
Definition: AIEngine.h:165
void wake_up()
Wake up a sleeping engine.
Definition: AIEngine.cxx:186
Definition: AIStatefulTask.h:96