-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlink.h
55 lines (45 loc) · 1.29 KB
/
link.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* @file link.h
* @brief Link class definition
*
* Defines the Link class and implements a few inline methods
*/
# ifndef LINK_H
# define LINK_H
/**
* @class Link
* Represents a link between two Nodes
* Holds two Nodes and the distance between them
*/
class Link
{
private:
float distance_; // Distance between the two Nodes
shared_ptr<Node> A_; // Shared pointer to the first Node
shared_ptr<Node> B_; // Shared pointer to the second Node
public:
/**
* Constructor
* @param distance Distance between the two Nodes in the link
* @param A Shared pointer to the first Node
* @param B Shared pointer to the second Node
*/
Link(shared_ptr<Node> const& A, shared_ptr<Node> const& B,
float distance) : distance_(distance), A_(A), B_(B){};
/**
* Return the distance between the link Nodes
* @return distance
*/
float getDistance() { return distance_; };
/**
* Return a shared pointer to the first Node
* @return A
*/
shared_ptr<Node> getNodeA() { return A_; }
/**
* Return a shared pointer to the second Node
* @return B
*/
shared_ptr<Node> getNodeB() { return B_; }
};
# endif