GHS
Leader Election Based on GHS Minimum Spanning Tree
include
graph
local_graph.h
Go to the documentation of this file.
1
40
#ifndef LOCAL_GRAPH_H
41
#define LOCAL_GRAPH_H
42
43
namespace
le
{
44
45
template
<
unsigned
int
SZ>
46
class
LocalGraph
{
47
public
:
48
49
LocalGraph
()
50
:sz_(0){}
51
52
struct
LocalEdge
53
{
54
unsigned
int
to;
55
unsigned
int
status;
56
unsigned
int
weight;
57
};
58
59
enum class
Errno{
60
OK
=0,
61
DOES_NOT_EXIST,
62
ALREADY_EXISTS
63
};
64
65
unsigned
int
size(){
return
sz_;}
66
unsigned
int
max_size(){
return
SZ; }
67
68
Errno set(
const
unsigned
int
to,
const
unsigned
int
status,
const
unsigned
int
weight);
69
Errno get(
unsigned
int
& to,
unsigned
int
& status,
unsigned
int
& weight)
const
;
70
71
Errno set(
unsigned
int
to,
const
LocalEdge e);
72
Errno get(
unsigned
int
to, LocalEdge &out_e)
const
;
73
74
Errno set_weight(
const
unsigned
int
to,
const
unsigned
int
wt);
75
Errno set_status(
const
unsigned
int
to,
const
unsigned
int
status);
76
77
Errno get_weight(
const
unsigned
int
to,
unsigned
int
&out_wt)
const
;
78
Errno get_status(
const
unsigned
int
to,
unsigned
int
&out_status)
const
;
79
80
static
const
char
* strerror(
const
Errno e);
81
82
private
:
83
84
unsigned
int
sz_;
85
LocalEdge links[SZ];
86
87
};
88
}
89
90
#endif
91
le
Definition:
agent.h:43
le::LocalGraph
Definition:
local_graph.h:46
le::LocalGraph::LocalEdge
Definition:
local_graph.h:52
le::OK
@ OK
The operation was successful.
Definition:
errno.h:50
Generated by
1.8.17