GHS
Leader Election Based on GHS Minimum Spanning Tree
Public Member Functions | List of all members
le::ghs::Msg Class Reference

An aggregate type containing all the data to exchange with to/from information. More...

#include <msg.h>

Public Member Functions

 Msg (agent_t to, agent_t from, msg::NoopPayload p)
 A type-specific constructor for each payload type.
 
 Msg (agent_t to, agent_t from, msg::SrchPayload p)
 
 Msg (agent_t to, agent_t from, msg::SrchRetPayload p)
 
 Msg (agent_t to, agent_t from, msg::InPartPayload p)
 
 Msg (agent_t to, agent_t from, msg::AckPartPayload p)
 
 Msg (agent_t to, agent_t from, msg::NackPartPayload p)
 
 Msg (agent_t to, agent_t from, msg::JoinUsPayload p)
 
 Msg (agent_t to, agent_t from, const Msg &other)
 
 Msg (agent_t to, agent_t from, msg::Type t, msg::Data d)
 
agent_t to () const
 
agent_t from () const
 
msg::Type type () const
 
msg::Data data () const
 

Detailed Description

An aggregate type containing all the data to exchange with to/from information.

The Msg struct contains all the data which is passed between GhsState objects operating on different systems to coordinate the construction of an MST.

The usual way to construct a Msg is to construct the payload from a struct of type Msg::Data, then to call to_msg() on that payload.

In the example case, the field other_guy is used twice, but that may not be the case always. to_msg takes the extra step of setting the to/from fields appropriately and seperate from the payload fields. I specifically made this design design to defend myself from myself after messing up the data fields far too often.

Constructor & Destructor Documentation

◆ Msg() [1/2]

le::ghs::Msg::Msg ( agent_t  to,
agent_t  from,
const Msg other 
)

A 'redirect' constructor that perserves type and payload, but allows new to/from fields

◆ Msg() [2/2]

le::ghs::Msg::Msg ( agent_t  to,
agent_t  from,
msg::Type  t,
msg::Data  d 
)

A generic constructor for generic data, and known type


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