SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ai::Filter Class Reference

The filter condition executes some selection filters (IFilter) and evaluates to true if the resulting set of all filter executions is non-empty. Use AI::getFilteredEntities to access the result set and work with it in a TreeNode that is executed when this condition evaluated to true. More...

#include <Filter.h>

Inheritance diagram for ai::Filter:
[legend]
Collaboration diagram for ai::Filter:
[legend]

Public Member Functions

 Filter (const Filters &filters)
 
bool evaluate (const AIPtr &entity) override
 Executes the attached filters and wiped the last filter results for the given AI entity. More...
 
- Public Member Functions inherited from ai::ICondition
 ICondition (const std::string &name, const std::string &parameters)
 
const std::string & getName () const
 Returns the short name of the condition - without any related conditions or results.
 
const std::string & getParameters () const
 Returns the raw parameters of the condition.
 
std::string getNameWithConditions (const AIPtr &entity)
 Returns the full condition string with all related conditions and results of the evaluation method. More...
 
- Public Member Functions inherited from ai::_MemObject< AllocatorClass >
void * operator new (size_t size)
 
void * operator new (size_t, void *ptr)
 
void * operator new[] (size_t size)
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 

Protected Member Functions

void getConditionNameWithValue (std::stringstream &s, const AIPtr &entity) override
 Override this method to get a more detailed result in getNameWithConditions() More...
 

Protected Attributes

Filters _filters
 
- Protected Attributes inherited from ai::ICondition
int _id
 Every node has an id to identify it. It's unique per type.
 
const std::string _name
 
const std::string _parameters
 

Additional Inherited Members

- Static Protected Member Functions inherited from ai::ICondition
static int getNextId ()
 

Detailed Description

The filter condition executes some selection filters (IFilter) and evaluates to true if the resulting set of all filter executions is non-empty. Use AI::getFilteredEntities to access the result set and work with it in a TreeNode that is executed when this condition evaluated to true.

Member Function Documentation

bool ai::Filter::evaluate ( const AIPtr &  entity)
inlineoverridevirtual

Executes the attached filters and wiped the last filter results for the given AI entity.

Returns
true if the attached filters lead to a non-empty set, false otherwise

Implements ai::ICondition.

void ai::Filter::getConditionNameWithValue ( std::stringstream &  s,
const AIPtr &  entity 
)
inlineoverrideprotectedvirtual

Override this method to get a more detailed result in getNameWithConditions()

Parameters
[out]sThe string stream to write your details to
[in,out]entityThe entity that is used to evaluate a condition
See Also
getNameWithConditions()

Reimplemented from ai::ICondition.


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