GAMS  1.4.0
gams::groups::GroupTransient Class Reference

A fixed list of agent members. More...

#include <GroupTransient.h>

Inheritance diagram for gams::groups::GroupTransient:
gams::groups::GroupBase

Public Member Functions

 GroupTransient (const std::string &prefix="", madara::knowledge::KnowledgeBase *knowledge=0)
 Constructor. More...
 
virtual ~GroupTransient ()
 Constructor. More...
 
virtual void add_members (const AgentVector &members)
 Adds the members to the group. More...
 
virtual void clear_members (void)
 Clears the member list. More...
 
virtual void get_members (AgentVector &members) const
 Retrieves the members from the group. More...
 
const std::string & get_prefix (void) const
 Gets the prefix for the group in the knowledge base. More...
 
virtual bool is_member (const std::string &id) const
 Checks if the agent is a member of the formation. More...
 
virtual void remove_members (const AgentVector &members)
 Removes members from the group. More...
 
virtual void set_prefix (const std::string &prefix, madara::knowledge::KnowledgeBase *knowledge=0)
 Sets the prefix for the group in the knowledge base. More...
 
virtual size_t size (void)
 Returns the number of members in the group. More...
 
virtual void sync (void)
 Syncs the list to the knowledge base. More...
 
virtual void write (const std::string &prefix="", madara::knowledge::KnowledgeBase *knowledge=0) const
 Writes the group information to a specified prefix in a knowledge base. More...
 

Protected Attributes

AgentMap fast_members_
 member list for fast access More...
 
madara::knowledge::KnowledgeBase * knowledge_
 The knowledge base to use as a data plane. More...
 
madara::knowledge::containers::Map members_
 The source member list in the knowledge base. More...
 
std::string prefix_
 the prefix for the group More...
 

Detailed Description

A fixed list of agent members.

Definition at line 75 of file GroupTransient.h.

Constructor & Destructor Documentation

◆ GroupTransient()

gams::groups::GroupTransient::GroupTransient ( const std::string &  prefix = "",
madara::knowledge::KnowledgeBase *  knowledge = 0 
)

Constructor.

Note that if you do not specify prefix and knowledge base, then you are essentially just working with a local group with no connection to other agents.

Parameters
prefixthe name of the group(e.g. group.protectors)
knowledgethe knowledge base to use for syncing

◆ ~GroupTransient()

virtual gams::groups::GroupTransient::~GroupTransient ( )
virtual

Constructor.

Member Function Documentation

◆ add_members()

virtual void gams::groups::GroupTransient::add_members ( const AgentVector members)
virtual

Adds the members to the group.

Parameters
memberslist of members to add to formation

Implements gams::groups::GroupBase.

◆ clear_members()

virtual void gams::groups::GroupTransient::clear_members ( void  )
virtual

Clears the member list.

Implements gams::groups::GroupBase.

◆ get_members()

virtual void gams::groups::GroupTransient::get_members ( AgentVector members) const
virtual

Retrieves the members from the group.

Parameters
membersa list of the members currently in the group

Implements gams::groups::GroupBase.

◆ get_prefix()

const std::string& gams::groups::GroupBase::get_prefix ( void  ) const
inherited

Gets the prefix for the group in the knowledge base.

Returns
the name of the group(e.g. group.protectors)

◆ is_member()

virtual bool gams::groups::GroupTransient::is_member ( const std::string &  id) const
virtual

Checks if the agent is a member of the formation.

Parameters
idthe agent id(e.g. agent.0 or agent.leader). If null, uses the current agent's id
Returns
true if the agent is a member of the group

Implements gams::groups::GroupBase.

◆ remove_members()

virtual void gams::groups::GroupTransient::remove_members ( const AgentVector members)
virtual

Removes members from the group.

Parameters
memberslist of members to remove if they exist

Implements gams::groups::GroupBase.

◆ set_prefix()

virtual void gams::groups::GroupTransient::set_prefix ( const std::string &  prefix,
madara::knowledge::KnowledgeBase *  knowledge = 0 
)
virtual

Sets the prefix for the group in the knowledge base.

Parameters
prefixthe name of the group(e.g. group.protectors)
knowledgethe knowledge base to use for syncing

Reimplemented from gams::groups::GroupBase.

◆ size()

virtual size_t gams::groups::GroupTransient::size ( void  )
virtual

Returns the number of members in the group.

Returns
the number of members

Implements gams::groups::GroupBase.

◆ sync()

virtual void gams::groups::GroupTransient::sync ( void  )
virtual

Syncs the list to the knowledge base.

Implements gams::groups::GroupBase.

◆ write()

virtual void gams::groups::GroupTransient::write ( const std::string &  prefix = "",
madara::knowledge::KnowledgeBase *  knowledge = 0 
) const
virtual

Writes the group information to a specified prefix in a knowledge base.

If no knowledge base is specified, then saves in the original knowledge base. If no prefix is specified, then saves in the original prefix location

Parameters
prefixthe name of the group(e.g. group.protectors)
knowledgethe knowledge base to save into

Implements gams::groups::GroupBase.

Member Data Documentation

◆ fast_members_

AgentMap gams::groups::GroupTransient::fast_members_
protected

member list for fast access

Definition at line 164 of file GroupTransient.h.

◆ knowledge_

madara::knowledge::KnowledgeBase* gams::groups::GroupBase::knowledge_
mutableprotectedinherited

The knowledge base to use as a data plane.

Definition at line 178 of file GroupBase.h.

◆ members_

madara::knowledge::containers::Map gams::groups::GroupTransient::members_
protected

The source member list in the knowledge base.

Definition at line 159 of file GroupTransient.h.

◆ prefix_

std::string gams::groups::GroupBase::prefix_
protectedinherited

the prefix for the group

Definition at line 183 of file GroupBase.h.


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