Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::evaluator::ConstantFunction< ContextType > Class Template Referencefinal

The ConstantFunction class - Constant function. More...

#include <ConstantFunction.hh>

Inheritance diagram for grail::evaluator::ConstantFunction< ContextType >:
Collaboration diagram for grail::evaluator::ConstantFunction< ContextType >:

Public Member Functions

 ConstantFunction (std::shared_ptr< Evaluator< ContextType >> childEvaluator, float constant)
 ConstantFunction - Constructor. More...
 
virtual float Sample (float) const override final
 Sample - Transforms argument into output value depending on the type of Curve. More...
 
float GetConstant () const
 GetConstant. More...
 
virtual data::EvaluatorType GetEvaluatorType () const override final
 
- Public Member Functions inherited from grail::evaluator::Curve< ContextType >
 Curve (std::shared_ptr< Evaluator< ContextType >> childEvaluator)
 Curve - Constructor. More...
 
 Curve (const Curve< ContextType > &other)=default
 
 Curve (Curve< ContextType > &&other)=default
 
virtual float Evaluate (const ContextType &context, data::UtilityEvaluatorSnapshot *const snapshot) const override final
 Evaluate - Called from EvaluateContext which also evaluates context, but without automatically filling snapshot with debug data. Should be overriden for each derived Evaluator. More...
 
virtual void GetDependentConsiderations (std::vector< Consideration< ContextType > * > &considerations) override
 
- Public Member Functions inherited from grail::evaluator::Evaluator< ContextType >
float EvaluateContext (const ContextType &context, data::UtilityEvaluatorSnapshot *const snapshot) const
 EvaluateContext - evaluates provided context and if provided snapshot is not empty, fills it with debug data describing this node. More...
 

Additional Inherited Members

- Protected Member Functions inherited from grail::evaluator::Curve< ContextType >
virtual void DebugDump (const std::map< const void *, unsigned int > &nodeMapping, data::EvaluationDebugData &debugData) const override final
 DebugDump - Called from EvaluateContext, which generates additional debug data for each evaluator. Should be overriden in each derived evaluator to better reflect debug tree topology. More...
 

Detailed Description

template<typename ContextType>
class grail::evaluator::ConstantFunction< ContextType >

The ConstantFunction class - Constant function.

Template Parameters
ContextType- Type of evaluated object. By default - ValueTuple(AIEntity, Blackboard).

Constructor & Destructor Documentation

◆ ConstantFunction()

template<typename ContextType >
grail::evaluator::ConstantFunction< ContextType >::ConstantFunction ( std::shared_ptr< Evaluator< ContextType >>  childEvaluator,
float  constant 
)
inline

ConstantFunction - Constructor.

Parameters
childEvaluator- Evaluator which output will be transformed by this curve.
constant- Value which will always be returned by this object's sample method.

Member Function Documentation

◆ GetConstant()

template<typename ContextType >
float grail::evaluator::ConstantFunction< ContextType >::GetConstant ( ) const
inline

GetConstant.

Returns
Value which will always be returned by this object's sample method.

◆ Sample()

template<typename ContextType >
virtual float grail::evaluator::ConstantFunction< ContextType >::Sample ( float  argument) const
inlinefinaloverridevirtual

Sample - Transforms argument into output value depending on the type of Curve.

Parameters
argument- Value of a curve argument belonging to its domain.
Returns
Transformed argument.

Implements grail::evaluator::Curve< ContextType >.


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