GAMS  1.4.0
gams::elections::ElectionFactoryRepository Class Reference

A repository for election factories. More...

#include <ElectionFactoryRepository.h>

Public Member Functions

 ElectionFactoryRepository (const std::string &agent_prefix, madara::knowledge::KnowledgeBase *knowledge=0)
 Constructor. More...
 
virtual ~ElectionFactoryRepository ()
 Destructor. More...
 
void add (ElectionType type, ElectionFactory *factory)
 Adds an algorithm factory. More...
 
ElectionBasecreate (const std::string &election_prefix)
 Creates an election based on type. More...
 
ElectionBasecreate (ElectionType type)
 Creates an election based on type. More...
 
void set_agent_prefix (const std::string &prefix)
 Sets the prefix for the current voting agent. More...
 
void set_knowledge (madara::knowledge::KnowledgeBase *knowledge)
 Sets the knowledge base. More...
 

Protected Member Functions

void init (void)
 Initializes factories for all supported GAMS elections. More...
 

Protected Attributes

std::string agent_prefix_
 self prefix of the agent More...
 
ElectionFactoryMap factory_map_
 a mapping of types to election factories More...
 
madara::knowledge::KnowledgeBase * knowledge_
 knowledge base containing variables More...
 

Detailed Description

A repository for election factories.

Definition at line 76 of file ElectionFactoryRepository.h.

Constructor & Destructor Documentation

◆ ElectionFactoryRepository()

gams::elections::ElectionFactoryRepository::ElectionFactoryRepository ( const std::string &  agent_prefix,
madara::knowledge::KnowledgeBase *  knowledge = 0 
)

Constructor.

Parameters
agent_prefixthe name of this voter (e.g. agent.0)
knowledgea knowledge base where election info is

◆ ~ElectionFactoryRepository()

virtual gams::elections::ElectionFactoryRepository::~ElectionFactoryRepository ( )
virtual

Destructor.

Member Function Documentation

◆ add()

void gams::elections::ElectionFactoryRepository::add ( ElectionType  type,
ElectionFactory factory 
)

Adds an algorithm factory.

Parameters
typethe type for this factory
factorythe factory for creating an algorithm
Returns
the new algorithm

◆ create() [1/2]

ElectionBase* gams::elections::ElectionFactoryRepository::create ( const std::string &  election_prefix)

Creates an election based on type.

Parameters
election_prefixthe name of the election (e.g. election.position)
Returns
the new election

◆ create() [2/2]

ElectionBase* gams::elections::ElectionFactoryRepository::create ( ElectionType  type)

Creates an election based on type.

Parameters
typethe type of the election (
See also
ElectionTypes)
Returns
the new election

◆ init()

void gams::elections::ElectionFactoryRepository::init ( void  )
protected

Initializes factories for all supported GAMS elections.

◆ set_agent_prefix()

void gams::elections::ElectionFactoryRepository::set_agent_prefix ( const std::string &  prefix)

Sets the prefix for the current voting agent.

Parameters
prefixthe name of the agent (e.g. agent.0)

◆ set_knowledge()

void gams::elections::ElectionFactoryRepository::set_knowledge ( madara::knowledge::KnowledgeBase *  knowledge)

Sets the knowledge base.

Parameters
knowledgethe knowledge base to use

Member Data Documentation

◆ agent_prefix_

std::string gams::elections::ElectionFactoryRepository::agent_prefix_
protected

self prefix of the agent

Definition at line 141 of file ElectionFactoryRepository.h.

◆ factory_map_

ElectionFactoryMap gams::elections::ElectionFactoryRepository::factory_map_
protected

a mapping of types to election factories

Definition at line 144 of file ElectionFactoryRepository.h.

◆ knowledge_

madara::knowledge::KnowledgeBase* gams::elections::ElectionFactoryRepository::knowledge_
protected

knowledge base containing variables

Definition at line 136 of file ElectionFactoryRepository.h.


The documentation for this class was generated from the following file: