-
Notifications
You must be signed in to change notification settings - Fork 0
/
vertex.h
60 lines (43 loc) · 2.13 KB
/
vertex.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
56
57
58
59
60
#ifndef __VERTEX_H__
#define __VERTEX_H__
#include<iostream>
#include<vector>
using namespace std;
// class that represents a graph vertex
// each vertex have :
// - Name
// - Connected Vertex Weight(Distance)
// - Value that will be used in path finding algorithm
// - Name of previous vertex
class Vertex
{
public:
//=================================================//
//Class members
//=================================================//
int VertexName;
int ConnectedVertexName;
int ConnectedVertexWeight;
int VertexValue;
int PreviousVertex;
//=================================================//
//Class constructors
//=================================================//
//default void constructor
Vertex();
//complete arguments constructor
//complete arguments constructor
template<class T>
Vertex(T VertexName,T ConnectedVertexName, T ConnectedVertexWeight,T VertexValue, T PreviousVertex): VertexName( static_cast<T>(VertexName) ),ConnectedVertexName( static_cast<T>(ConnectedVertexName) ),ConnectedVertexWeight( static_cast<T>(ConnectedVertexWeight) ),VertexValue( static_cast<T>(VertexValue) ), PreviousVertex( static_cast<T>(PreviousVertex) ){}
//3 arguments constructor
template<class T>
Vertex(T VertexName,T ConnectedVertexName, T ConnectedVertexWeight): VertexName( static_cast<T>(VertexName) ),ConnectedVertexName( static_cast<T>(ConnectedVertexName) ),ConnectedVertexWeight( static_cast<T>(ConnectedVertexWeight) ),VertexValue( static_cast<T>(0) ), PreviousVertex( static_cast<T>(0) ) {}
//VertexName argument constructor
template<class T>
Vertex(T VertexName): VertexName( static_cast<T>(VertexName) ), ConnectedVertexName( static_cast<T>(0) ),ConnectedVertexWeight( static_cast<T>(0) ),VertexValue( static_cast<T>(0)), PreviousVertex( static_cast<T>(0)) {}
};//end of Vertex class
//Vertex Vector << operator overload (Output stream of Vertex vector)
ostream& operator << (ostream &out, const vector<Vertex> &V);
//Vertex << operator overload (Output stream of Vertex type)
ostream& operator << (ostream &out, const Vertex &V);
#endif // __VERTEX_H__