SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
AIFactories.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "IAIFactory.h"
8 #include <vector>
9 
10 namespace ai {
11 
16  std::string name;
17  std::string parameters;
18  ConditionPtr condition;
19  TreeNodeFactoryContext(const std::string& _name, const std::string& _parameters, const ConditionPtr& _condition) :
20  name(_name), parameters(_parameters), condition(_condition) {
21  }
22 };
23 
25  std::string name;
26  std::string parameters;
27  ConditionPtr condition;
28  movement::Steerings steerings;
29  SteerNodeFactoryContext(const std::string& _name, const std::string& _parameters, const ConditionPtr& _condition, const movement::Steerings& _steerings) :
30  name(_name), parameters(_parameters), condition(_condition), steerings(_steerings) {
31  }
32 };
33 
35  // Parameters for the filter - can get hand over to the ctor in your factory implementation.
36  std::string parameters;
37  Filters filters;
38  explicit FilterFactoryContext(const std::string& _parameters) :
39  parameters(_parameters) {
40  }
41 };
42 
44  // Parameters for the steering class - can get hand over to the ctor in your factory implementation.
45  std::string parameters;
46  explicit SteeringFactoryContext(const std::string& _parameters) :
47  parameters(_parameters) {
48  }
49 };
50 
52  // Parameters for the condition - can get hand over to the ctor in your factory implementation.
53  std::string parameters;
54  // Some conditions have child conditions
55  Conditions conditions;
56  // The filter condition also has filters
57  Filters filters;
58  bool filter;
59  explicit ConditionFactoryContext(const std::string& _parameters) :
60  parameters(_parameters), filter(false) {
61  }
62 };
63 
68 class ITreeNodeFactory: public IFactory<TreeNode, TreeNodeFactoryContext> {
69 public:
70  virtual ~ITreeNodeFactory() {
71  }
72  virtual TreeNodePtr create(const TreeNodeFactoryContext *ctx) const override = 0;
73 };
74 
75 class ISteeringFactory: public IFactory<movement::ISteering, SteeringFactoryContext> {
76 public:
77  virtual ~ISteeringFactory() {
78  }
79  virtual SteeringPtr create(const SteeringFactoryContext* ctx) const override = 0;
80 };
81 
82 class ISteerNodeFactory: public IFactory<TreeNode, SteerNodeFactoryContext> {
83 public:
84  virtual ~ISteerNodeFactory() {
85  }
86  virtual TreeNodePtr create(const SteerNodeFactoryContext *ctx) const override = 0;
87 };
88 
89 class IFilterFactory: public IFactory<IFilter, FilterFactoryContext> {
90 public:
91  virtual ~IFilterFactory() {
92  }
93  virtual FilterPtr create(const FilterFactoryContext *ctx) const override = 0;
94 };
95 
96 class IConditionFactory: public IFactory<ICondition, ConditionFactoryContext> {
97 public:
98  virtual ~IConditionFactory() {
99  }
100  virtual ConditionPtr create(const ConditionFactoryContext *ctx) const override = 0;
101 };
102 
103 }
This factory will create tree nodes. It uses the TreeNodeFactoryContext to collect all the needed dat...
Definition: AIFactories.h:68
Context for ITreeNodeFactory.
Definition: AIFactories.h:15
Definition: AIFactories.h:51
Definition: AIFactories.h:43
Definition: AIFactories.h:24
Definition: IFactoryRegistry.h:14
Definition: AIFactories.h:96
Definition: AIFactories.h:89
Definition: AIFactories.h:82
Definition: AIFactories.h:34
Definition: AIFactories.h:75