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;
85 const AgentVector & members);
98 GroupBase (
const std::string & prefix =
"",
99 madara::knowledge::KnowledgeBase * knowledge = 0);
110 virtual void add_members (
const AgentVector & members) = 0;
115 virtual void clear_members (
void) = 0;
121 virtual void get_members (AgentVector & members)
const = 0;
129 virtual bool is_member (
const std::string &
id)
const = 0;
139 virtual void write (
const std::string & prefix =
"",
140 madara::knowledge::KnowledgeBase * knowledge = 0)
const = 0;
147 virtual void set_prefix (
const std::string & prefix,
148 madara::knowledge::KnowledgeBase * knowledge = 0);
154 virtual size_t size (
void) = 0;
159 virtual void sync (
void) = 0;
165 const std::string & get_prefix (
void)
const;
182 #include "GroupBase.inl" 184 #endif // _GAMS_GROUPS_GROUP_BASE_H_ std::vector< std::string > AgentVector
A vector of agent names.
std::map< std::string, madara::knowledge::KnowledgeRecord::Integer > AgentMap
A map of agent names.
madara::knowledge::KnowledgeBase * knowledge_
The knowledge base to use as a data plane.
std::string prefix_
the prefix for the group
Contains all GAMS-related tools, classes and code.
Base class for a group of agents.
Copyright (c) 2016 Carnegie Mellon University.
int find_member_index(const std::string &prefix, const AgentVector &members)
Finds the index of the member prefix in a member listing.