GAMS  1.4.0
AuctionFactoryRepository.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_AUCTIONS_AUCTION_FACTORY_REPOSITORY_H_
55 #define _GAMS_AUCTIONS_AUCTION_FACTORY_REPOSITORY_H_
56 
57 #include <vector>
58 #include <string>
59 #include <map>
60 
61 #include "madara/knowledge/KnowledgeBase.h"
62 #include "AuctionFactory.h"
63 
64 namespace gams
65 {
66  namespace auctions
67  {
71  typedef std::map <AuctionType, AuctionFactory *> AuctionFactoryMap;
72 
77  {
78  public:
85  const std::string & agent_prefix,
86  madara::knowledge::KnowledgeBase * knowledge = 0);
87 
92 
99  void add(AuctionType type,
100  AuctionFactory * factory);
101 
107  AuctionBase * create(const std::string & auction_prefix);
108 
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 
145 
146  };
147  }
148 }
149 
150 #include "AuctionFactoryRepository.inl"
151 
152 #endif // _GAMS_AUCTIONS_AUCTION_FACTORY_REPOSITORY_H_
Copyright(c) 2016 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Base class for an auction.
Definition: AuctionBase.h:79
A repository for auction factories.
void set_knowledge(madara::knowledge::KnowledgeBase *knowledge)
Sets the knowledge base.
AuctionBase * create(AuctionType type)
Creates an auction based on type.
virtual ~AuctionFactoryRepository()
Destructor.
AuctionFactoryMap factory_map_
a mapping of types to auction factories
AuctionFactoryRepository(const std::string &agent_prefix, madara::knowledge::KnowledgeBase *knowledge=0)
Constructor.
std::string agent_prefix_
self prefix of the agent
madara::knowledge::KnowledgeBase * knowledge_
knowledge base containing variables
void init(void)
Initializes factories for all supported GAMS auctions.
void add(AuctionType type, AuctionFactory *factory)
Adds an algorithm factory.
AuctionBase * create(const std::string &auction_prefix)
Creates an auction based on type.
void set_agent_prefix(const std::string &prefix)
Sets the prefix for the current bidding agent.
Base class for an auction factory.
madara::knowledge::KnowledgeRecord::Integer AuctionType
convenience typedef for AuctionType
std::map< AuctionType, AuctionFactory * > AuctionFactoryMap
Convenience typedef for a map of types to factories.
Contains all GAMS-related tools, classes and code.