Atoms Crowd  4.1.0
BehaviourTreeMaps.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/BehaviourTree.h>
12 #include <map>
13 #include <vector>
14 
15 namespace Atoms
16 {
18 
21  typedef AtomsPtr<AtomsCore::MapMetadata> BehaviourTreeMapPtr;
22 
23  class ATOMS_EXPORT BehaviourTreeMaps
24  {
25  public:
26 
29 
31 
35  BehaviourTreeMapPtr behaviourTreeMap(const std::string& name) const;
36 
38 
42  BehaviourTreeMapPtr behaviourTreeMap(const std::string& name);
43 
45 
49  BehaviourTreeMapPtr addBehaviourTreeMap(const std::string& name, const AtomsCore::MapMetadata &behaviourTreeMap, bool replace = true);
50 
52 
56  BehaviourTreeMapPtr addBehaviourTreeMap(const std::string& name, AtomsCore::MapMetadata &behaviourTreeMap, bool replace = true);
57 
59 
62  void removeBehaviourTreeMap(const std::string& name);
63 
65 
68  std::vector<std::string> behaviourTreeMapNames();
69 
71 
75  bool behaviourTreeMapExists(const std::string& name);
76 
78  unsigned int numBehaviourTreeMaps();
79 
81  void clear();
82 
84  bool buildBehaviourTree(const std::string &name, Atoms::BehaviourTree &behaviourTree);
85 
88 
90  void getAllBlackboardExposeKeys(const std::string &name, AtomsCore::MapMetadata &exposeKeys);
91 
92  private:
93 
96 
99 
102 
103  typedef std::map<std::string, BehaviourTreeMapPtr> BehaviourTreesMap;
104 
106 
109  BehaviourTreesMap m_behaviourTreesMap;
110  };
111 }
Atoms::BehaviourTreeMaps
Definition: BehaviourTreeMaps.h:24
Atoms::BehaviourTreeMaps::addBehaviourTreeMap
BehaviourTreeMapPtr addBehaviourTreeMap(const std::string &name, AtomsCore::MapMetadata &behaviourTreeMap, bool replace=true)
Add an behaviour tree to the map.
Atoms::BehaviourTreeMaps::numBehaviourTreeMaps
unsigned int numBehaviourTreeMaps()
Get number of behaviour trees.
Atoms::BehaviourTreeMaps::buildBehaviourTreeFromMap
bool buildBehaviourTreeFromMap(const BehaviourTreeMapPtr &map, Atoms::BehaviourTree &behaviourTree)
builds a behaviour tree from a behaviour tree map
Atoms::BehaviourTreeMaps::addBehaviourTreeMap
BehaviourTreeMapPtr addBehaviourTreeMap(const std::string &name, const AtomsCore::MapMetadata &behaviourTreeMap, bool replace=true)
Add an behaviour tree to the map.
Atoms::BehaviourTreeMaps::clear
void clear()
Remove all behaviour trees.
Atoms::BehaviourTreeMaps::behaviourTreeMap
BehaviourTreeMapPtr behaviourTreeMap(const std::string &name)
Return an behaviour trees.
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::BehaviourTreeMaps::buildBehaviourTree
bool buildBehaviourTree(const std::string &name, Atoms::BehaviourTree &behaviourTree)
builds a behaviour tree from the map name
Atoms::BehaviourTreeMaps::behaviourTreeMapNames
std::vector< std::string > behaviourTreeMapNames()
Get all behaviour tree names.
Atoms::BehaviourTreeMapPtr
AtomsPtr< AtomsCore::MapMetadata > BehaviourTreeMapPtr
behaviour trees manager
Definition: BehaviourTreeMaps.h:21
AtomsCore::MapMetadata
MapMetadata class.
Definition: MapMetadata.h:24
Atoms::BehaviourTreeMaps::removeBehaviourTreeMap
void removeBehaviourTreeMap(const std::string &name)
Remove an behaviour tree from the map.
Atoms::BehaviourTree
Definition: BehaviourTree.h:27
Atoms::BehaviourTreeMaps::instance
static BehaviourTreeMaps & instance()
Singleton access.
Atoms::BehaviourTreeMaps::behaviourTreeMap
BehaviourTreeMapPtr behaviourTreeMap(const std::string &name) const
Return an behaviour trees.
Atoms::BehaviourTreeMaps::getAllBlackboardExposeKeys
void getAllBlackboardExposeKeys(const std::string &name, AtomsCore::MapMetadata &exposeKeys)
gets all the blackboard keys to expose in the host app
Atoms::BehaviourTreeMaps::behaviourTreeMapExists
bool behaviourTreeMapExists(const std::string &name)
Check if an behaviour tree exists.