Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Domain.hh
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_DOMAIN_H
4 #define GRAIL_DOMAIN_H
5 
6 #include "Action/ActionTemplate.hh"
7 #include "WorldState/WorldObject.hh"
8 #include "WorldState/WorldObjectType.hh"
9 
10 #include <string>
11 #include <unordered_map>
12 #include <vector>
13 
14 namespace grail
15 {
16 namespace planner
17 {
22  struct Domain
23  {
26  Domain(const std::vector<WorldObjectType>& types);
27  Domain(const Domain& other) = delete;
28 
29  Domain(Domain&& other) = delete;
30 
31  virtual ~Domain() = default;
32 
33  Domain& operator=(Domain&& other) = delete;
34 
35  Domain& operator =(const Domain&) = delete;
36 
43  void AddActionTemplate(const std::string& name, const std::vector<std::string>& paramNames,
44  PreconditionFunction preconditionFunction, EffectFunction effectFunction, CostFunction costFunction);
45 
47  WorldObject CreateObjectOfType(const std::string& name) const;
48 
50  unsigned int GetTypeIndex(const std::string& typeName) const;
51 
52  std::vector<std::string> objectTypes{};
53  std::vector<WorldObjectType> types{};
54  std::map<std::string, unsigned int> typemap{};
55  std::vector<ActionTemplate> actionTemplates{};
56  };
57 }
58 }
59 
60 #endif //GRAIL_PLAN_DOMAIN_H
grail::planner::Domain::CreateObjectOfType
WorldObject CreateObjectOfType(const std::string &name) const
Creates and object of a type identified by name parameter.
Definition: Domain.cpp:75
grail::planner::WorldObject
Definition: WorldObject.hh:20
grail::planner::Domain::GetTypeIndex
unsigned int GetTypeIndex(const std::string &typeName) const
Definition: Domain.cpp:80
grail::planner::Domain
Definition: Domain.hh:22
grail::planner::Domain::Domain
Domain(const std::vector< WorldObjectType > &types)
Definition: Domain.cpp:11
grail::planner::Domain::AddActionTemplate
void AddActionTemplate(const std::string &name, const std::vector< std::string > &paramNames, PreconditionFunction preconditionFunction, EffectFunction effectFunction, CostFunction costFunction)
Definition: Domain.cpp:62