Atoms Crowd  4.1.0
BehaviourTree.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <Atoms/Globals.h>
11 #include <Atoms/BehaviourTree/Behaviour.h>
12 #include <Atoms/BehaviourTree/Blackboard.h>
13 #include <vector>
14 #include <string>
15 #include <map>
16 
17 namespace Atoms
18 {
19  class Behaviour;
20  class BehaviourTree;
21 
22  typedef AtomsPtr<BehaviourTree> BehaviourTreePtr;
23 
24  typedef AtomsPtr<const BehaviourTree> BehaviourTreeCPtr;
25 
26  class ATOMS_EXPORT BehaviourTree
27  {
28  public:
29 
30  BehaviourTree();
31 
32  ~BehaviourTree();
33 
34  void clear();
35 
36  bool addBehaviour(
37  const std::string& name,
38  const std::string& parentName,
39  const std::string& behaviourType,
40  const AtomsCore::MapMetadata* attributes=nullptr
41  );
42 
43  bool addBehaviour(
44  const std::string& name,
45  const std::string& parentName,
46  Atoms::Behaviour* behaviour,
47  const AtomsCore::MapMetadata* attributes = nullptr
48  );
49 
50  bool loadFromFile(const std::string& filePath);
51  bool saveToFile(const std::string& filePath);
52 
53  bool loadFromMemory(const AtomsCore::MapMetadata* data);
54  bool saveToMemory(AtomsCore::MapMetadata* data);
55 
56 
57  std::vector<Behaviour*> behaviours;
58 
59  std::map<unsigned int, std::string> names;
60 
61  std::map<std::string, std::string> niceNames;
62 
63  std::map<std::string, unsigned int> ids;
64 
65  Blackboard blackboard;
66  };
67 
68 }
Atoms::Blackboard
Definition: Blackboard.h:35
Atoms::BehaviourTreePtr
AtomsPtr< BehaviourTree > BehaviourTreePtr
behaviour tree pointer
Definition: BehaviourTree.h:20
Atoms::BehaviourTreeCPtr
AtomsPtr< const BehaviourTree > BehaviourTreeCPtr
behaviour tree const pointer
Definition: BehaviourTree.h:24
Atoms
Atoms namespace.
Definition: Agent.h:28
AtomsCore::MapMetadata
MapMetadata class.
Definition: MapMetadata.h:24
Atoms::BehaviourTree
Definition: BehaviourTree.h:27
Atoms::Behaviour
Definition: Behaviour.h:21