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

Lets you construct a lightweight module by providing your own step() as an std::function. More...

#include <lambda.h>

Inherits cherrypi::Module.

Inherited by cherrypi::OnceModule.

Public Types

using StepFunctionState = std::function< void(State *)>
 
using StepFunctionStateModule = std::function< void(State *, Module *)>
 

Public Member Functions

 LambdaModule (StepFunctionState fn, std::string name=std::string())
 
 LambdaModule (StepFunctionStateModule fn, std::string name=std::string())
 
virtual ~LambdaModule ()=default
 
virtual void step (State *state) override
 
- Public Member Functions inherited from cherrypi::Module
virtual ~Module ()=default
 
virtual void setPlayer (BasePlayer *p)
 
void setName (std::string name)
 
std::string name ()
 
virtual void onGameStart (State *s)
 
virtual void onGameEnd (State *s)
 

Protected Attributes

mapbox::util::variant< StepFunctionState, StepFunctionStateModulefn_
 
- Protected Attributes inherited from cherrypi::Module
BasePlayerplayer_
 
std::string name_
 

Additional Inherited Members

- Static Public Member Functions inherited from cherrypi::Module
template<typename T , typename... Args>
static std::shared_ptr< T > make (Args &&...args)
 
static std::shared_ptr< Modulemake (std::string const &typeName)
 
static std::string makeName (std::type_index const &type)
 
- Protected Member Functions inherited from cherrypi::Module
 Module ()
 

Detailed Description

Lets you construct a lightweight module by providing your own step() as an std::function.

Member Typedef Documentation

using cherrypi::LambdaModule::StepFunctionState = std::function<void(State*)>

Constructor & Destructor Documentation

cherrypi::LambdaModule::LambdaModule ( StepFunctionState  fn,
std::string  name = std::string() 
)
cherrypi::LambdaModule::LambdaModule ( StepFunctionStateModule  fn,
std::string  name = std::string() 
)
virtual cherrypi::LambdaModule::~LambdaModule ( )
virtualdefault

Member Function Documentation

void cherrypi::LambdaModule::step ( State state)
overridevirtual

Reimplemented from cherrypi::Module.

Reimplemented in cherrypi::OnceModule.

Member Data Documentation

mapbox::util::variant<StepFunctionState, StepFunctionStateModule> cherrypi::LambdaModule::fn_
protected

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