54 #ifndef _GAMS_GROUPS_GROUP_BASE_H_
55 #define _GAMS_GROUPS_GROUP_BASE_H_
61 #include "madara/knowledge/KnowledgeBase.h"
74 typedef std::map <std::string,
75 madara::knowledge::KnowledgeRecord::Integer>
AgentMap;
99 madara::knowledge::KnowledgeBase * knowledge = 0);
129 virtual bool is_member(
const std::string &
id)
const = 0;
145 virtual void write(
const std::string & prefix =
"",
146 madara::knowledge::KnowledgeBase * knowledge = 0)
const = 0;
154 madara::knowledge::KnowledgeBase * knowledge = 0);
188 #include "GroupBase.inl"
Copyright (c) 2016 Carnegie Mellon University.
Base class for a group of agents.
GroupBase(const std::string &prefix="", madara::knowledge::KnowledgeBase *knowledge=0)
Constructor.
virtual void remove_members(const AgentVector &members)=0
Removes members from the group.
madara::knowledge::KnowledgeBase * knowledge_
The knowledge base to use as a data plane.
virtual void clear_members(void)=0
Clears the member list.
virtual void sync(void)=0
Syncs the list to the knowledge base.
virtual bool is_member(const std::string &id) const =0
Checks if the agent is a member of the formation.
virtual void set_prefix(const std::string &prefix, madara::knowledge::KnowledgeBase *knowledge=0)
Sets the prefix for the group in the knowledge base.
virtual size_t size(void)=0
Returns the number of members in the group.
virtual ~GroupBase()
Constructor.
std::string prefix_
the prefix for the group
virtual void get_members(AgentVector &members) const =0
Retrieves the members from the group.
virtual void write(const std::string &prefix="", madara::knowledge::KnowledgeBase *knowledge=0) const =0
Writes the group information to a specified prefix in a knowledge base.
const std::string & get_prefix(void) const
Gets the prefix for the group in the knowledge base.
virtual void add_members(const AgentVector &members)=0
Adds the members to the group.
int find_member_index(const std::string &prefix, const AgentVector &members)
Finds the index of the member prefix in a member listing.
std::vector< std::string > AgentVector
A vector of agent names.
std::map< std::string, madara::knowledge::KnowledgeRecord::Integer > AgentMap
A map of agent names.
Contains all GAMS-related tools, classes and code.