GHS
Leader Election Based on GHS Minimum Spanning Tree
edge.h
Go to the documentation of this file.
1 
39 #ifndef GHS_EDGE
40 #define GHS_EDGE
41 
42 #include "ghs/agent.h"
43 #include <limits>
44 
48 namespace le{
52  namespace ghs{
53 
63  typedef unsigned long metric_t;
64 
74  const metric_t WORST_METRIC=std::numeric_limits<metric_t>::max();
75 
80 
82  enum status_t {
84  UNKNOWN = 0,
86  MST = 1,
90  DELETED =-1,
91  };
92 
98  struct Edge
99  {
100  Edge(){}
101  Edge(agent_t pe, agent_t ro, status_t st, metric_t me)
102  : peer(pe), root(ro), status(st), metric_val(me) {}
111  };
112 
116  Edge worst_edge();
117 
122  bool is_valid(const Edge e);
123 
128  bool is_valid(const metric_t m);
129  }
130 }
131 #endif
le::ghs::agent_t
int agent_t
problems for GhsState
Definition: agent.h:51
le::ghs::MST
@ MST
We have added this edge as an MST link.
Definition: edge.h:86
le::ghs::MST_PARENT
@ MST_PARENT
We have added this edge as parent MST link.
Definition: edge.h:88
le::ghs::metric_t
unsigned long metric_t
Definition: edge.h:63
le::ghs::status_t
status_t
A status enumeration, for the ghs edges.
Definition: edge.h:82
le::ghs::DELETED
@ DELETED
We have decided not to further consider this edge, either it was "bad", or it is already part of our ...
Definition: edge.h:90
le::ghs::Edge::root
agent_t root
The root is the "from" side of the edge.
Definition: edge.h:106
le
Definition: agent.h:43
le::ghs::is_valid
bool is_valid(const agent_t a)
Definition: agent.cpp:43
le::ghs::worst_edge
Edge worst_edge()
Definition: edge.cpp:45
le::ghs::Edge::peer
agent_t peer
The peer is the "to" side of the edge.
Definition: edge.h:104
le::ghs::UNKNOWN
@ UNKNOWN
We have not probed this edge for information yet, or have not recieved a reponse.
Definition: edge.h:84
le::ghs::Edge::status
status_t status
The status of this edge, starting with UNKNOWN.
Definition: edge.h:108
agent.h
provides le::ghs::agent_t defintion
le::ghs::NO_AGENT
const agent_t NO_AGENT
Definition: agent.h:56
le::ghs::Edge::metric_val
metric_t metric_val
By default, this edge has metric_val = WORST_METRIC.
Definition: edge.h:110
le::ghs::METRIC_NOT_SET
const metric_t METRIC_NOT_SET
Definition: edge.h:79
le::ghs::WORST_METRIC
const metric_t WORST_METRIC
Definition: edge.h:74
le::ghs::Edge
A struct to hold all the communication edge information.
Definition: edge.h:98