TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Attributes | List of all members
cherrypi::SharedControllerTask Class Reference

Generic Task for SharedController. More...

#include <controller.h>

Inherits cherrypi::Task.

Public Member Functions

 SharedControllerTask (UpcId upcId, std::unordered_set< Unit * > units, State *state, std::shared_ptr< SharedController > controller)
 
virtual ~SharedControllerTask ()=default
 
virtual void update (State *state) override
 
virtual void cancel (State *state) override
 
std::shared_ptr< SharedControllercontroller () const
 
- Public Member Functions inherited from cherrypi::Task
 Task (UpcId upcId, std::unordered_set< Unit * > units={})
 
virtual ~Task ()
 
TaskStatus status () const
 
void setStatus (TaskStatus status)
 
bool finished () const
 
UpcId upcId () const
 UPC id in Blackboard that caused this Task to be spawned. More...
 
std::unordered_set< Unit * > const & units () const
 A set of units occupied performing this task. More...
 
void removeUnit (Unit *unit)
 
virtual std::unordered_set< Unit * > const & proxiedUnits () const
 A set of units occupied performing this task. More...
 
virtual const char * getName () const
 A name for this task, for debugging purposes. More...
 

Protected Attributes

std::shared_ptr< SharedControllercontroller_
 

Additional Inherited Members

- Protected Member Functions inherited from cherrypi::Task
std::unordered_set< Unit * > & units ()
 
virtual void removeDeadOrReassignedUnits (State *state)
 Remove units that have been assigned to another task and units that have died. More...
 

Detailed Description

Generic Task for SharedController.

Please see Controller for further details and a usage example.

This task will enter failure state if there are no more units allocated to it. In contrast to Controller, SharedController does not report any success or failure status and the sole responsibility of this task is to keep track of unit allocations. If there are no more units, this task's job is done.

Constructor & Destructor Documentation

cherrypi::SharedControllerTask::SharedControllerTask ( UpcId  upcId,
std::unordered_set< Unit * >  units,
State state,
std::shared_ptr< SharedController controller 
)
virtual cherrypi::SharedControllerTask::~SharedControllerTask ( )
virtualdefault

Member Function Documentation

void cherrypi::SharedControllerTask::cancel ( State state)
overridevirtual

Reimplemented from cherrypi::Task.

std::shared_ptr< SharedController > cherrypi::SharedControllerTask::controller ( ) const
void cherrypi::SharedControllerTask::update ( State state)
overridevirtual

Reimplemented from cherrypi::Task.

Member Data Documentation

std::shared_ptr<SharedController> cherrypi::SharedControllerTask::controller_
protected

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