GAMS  1.4.0
GroupFactoryRepository.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_GROUPS_GROUP_FACTORY_REPOSITORY_H_
55 #define _GAMS_GROUPS_GROUP_FACTORY_REPOSITORY_H_
56 
57 #include <vector>
58 #include <string>
59 #include <map>
60 
61 #include "madara/knowledge/KnowledgeBase.h"
62 #include "GroupFactory.h"
63 
64 namespace gams
65 {
66  namespace groups
67  {
71  typedef std::map <GroupType, GroupFactory *> GroupFactoryMap;
72 
77  {
78  public:
83  GroupFactoryRepository(madara::knowledge::KnowledgeBase * knowledge = 0);
84 
89 
96  void add(GroupType type,
97  GroupFactory * factory);
98 
104  GroupBase * create(const std::string & prefix);
105 
112 
117  void set_knowledge(madara::knowledge::KnowledgeBase * knowledge);
118 
119  protected:
120 
124  void init(void);
125 
127  madara::knowledge::KnowledgeBase * knowledge_;
128 
131  };
132  }
133 }
134 
135 #include "GroupFactoryRepository.inl"
136 
137 #endif // _GAMS_GROUPS_GROUP_FACTORY_REPOSITORY_H_
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright(c) 2016 Carnegie Mellon University.
Base class for a group of agents.
Definition: GroupBase.h:91
A repository for group factories.
void set_knowledge(madara::knowledge::KnowledgeBase *knowledge)
Sets the knowledge base.
GroupBase * create(GroupType type)
Creates a group based on type.
void init(void)
Initializes factories for all supported GAMS groups.
virtual ~GroupFactoryRepository()
Destructor.
GroupBase * create(const std::string &prefix)
Creates a group based on group prefix in the knowledge base.
GroupFactoryMap factory_map_
a mapping of types to group factories
void add(GroupType type, GroupFactory *factory)
Adds an algorithm factory.
GroupFactoryRepository(madara::knowledge::KnowledgeBase *knowledge=0)
Constructor.
madara::knowledge::KnowledgeBase * knowledge_
knowledge base containing variables
Base class for a group factory.
Definition: GroupFactory.h:72
std::map< GroupType, GroupFactory * > GroupFactoryMap
Convenience typedef for a map of types to factories.
madara::knowledge::KnowledgeRecord::Integer GroupType
convenience typedef for GroupType
Contains all GAMS-related tools, classes and code.