GAMS  1.2.2
ElectionFactoryRepository.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ELECTIONS_ELECTION_FACTORY_REPOSITORY_H_
55 #define _GAMS_ELECTIONS_ELECTION_FACTORY_REPOSITORY_H_
56 
57 #include <vector>
58 #include <string>
59 #include <map>
60 
61 #include "madara/knowledge/KnowledgeBase.h"
62 #include "ElectionFactory.h"
63 
64 namespace gams
65 {
66  namespace elections
67  {
71  typedef std::map <ElectionType, ElectionFactory *> ElectionFactoryMap;
72 
77  {
78  public:
85  const std::string & agent_prefix,
86  madara::knowledge::KnowledgeBase * knowledge = 0);
87 
91  virtual ~ElectionFactoryRepository ();
92 
99  void add (ElectionType type,
100  ElectionFactory * factory);
101 
107  ElectionBase * create (const std::string & election_prefix);
108 
114  ElectionBase * create (ElectionType type);
115 
120  void set_knowledge (madara::knowledge::KnowledgeBase * knowledge);
121 
126  void set_agent_prefix (const std::string & prefix);
127 
128  protected:
129 
133  void init (void);
134 
136  madara::knowledge::KnowledgeBase * knowledge_;
137 
141  std::string agent_prefix_;
142 
144  ElectionFactoryMap factory_map_;
145 
146  };
147  }
148 }
149 
150 #include "ElectionFactoryRepository.inl"
151 
152 #endif // _GAMS_ELECTIONS_ELECTION_FACTORY_REPOSITORY_H_
std::string agent_prefix_
self prefix of the agent
A repository for election factories.
madara::knowledge::KnowledgeBase * knowledge_
knowledge base containing variables
madara::knowledge::KnowledgeRecord::Integer ElectionType
convenience typedef for ElectionType
std::map< ElectionType, ElectionFactory * > ElectionFactoryMap
Convenience typedef for a map of types to factories.
Contains all GAMS-related tools, classes and code.
Base class for an auction factory.
ElectionFactoryMap factory_map_
a mapping of types to election factories
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright (c) 2016 Carnegie Mellon University.
Base class for an election.
Definition: ElectionBase.h:82