-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetworkFile.h
115 lines (92 loc) · 3.37 KB
/
NetworkFile.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//
// Created by luise on 5/5/2020.
//
#ifndef ALGORITHMS_NETWORKFILE_H
#define ALGORITHMS_NETWORKFILE_H
#include <string>
#include <iostream>
#include "Algorithm.h"
using std::cout;
using std::endl;
using std::string;
template<class T>
class NetworkFile : public Algorithm<T>{
private:
// network_file holds the file path of the network data file
T network_file;
// trivial_file holds the file path of the Trivial output file
T trivial_file;
// bellman_ford_file holds the file path of the Bellman-Ford output file
T bellman_ford_file;
// floyd_warshall_file holds the file path of the Floyd-Warshall output file
T floyd_warshall_file;
public:
// Default constructor
NetworkFile();
// Constructor that declares input file and 3 output files (w/ path)
explicit NetworkFile(T,T,T,T);
// Copy constructor
NetworkFile(const NetworkFile<T>&);
// Returns file path according to current location
T get_Network_file();
T get_Trivial_file();
T get_Bellman_Ford_file();
T get_Floyd_Warshall_file();
// Prints each filepath + filename
void print();
~NetworkFile();
};
// Default Constructor
template<class T>
NetworkFile<T>::NetworkFile()= default;
// Constructor - Uses base initializers to declare and add the appropriate path for input and output file/s
template<class T>
NetworkFile<T>::NetworkFile(T network, T trivial, T bellman_ford,T floyd_warshall) :
network_file("InputFiles/" + network),
trivial_file("OutputFiles/" + trivial),
bellman_ford_file("OutputFiles/" + bellman_ford),
floyd_warshall_file("OutputFiles/" + floyd_warshall){}
// Copy Constructor w/ base initializers
template<class T>
NetworkFile<T>::NetworkFile(const NetworkFile<T>& originalFiles) :
network_file(originalFiles.get_Network_file()),
trivial_file(originalFiles.get_Trivial_file()),
bellman_ford_file(originalFiles.get_Bellman_Ford_file()),
floyd_warshall_file(originalFiles.get_Floyd_Warshall_file()){
this->network_file = originalFiles.get_Network_file();
this->trivial_file = originalFiles.get_Trivial_file();
this->bellman_ford_file = originalFiles.get_Bellman_Ford_file();
this->floyd_warshall_file = originalFiles.get_Floyd_Warshall_file();
}
// Returns name of input file containing all network data
template<class T>
T NetworkFile<T>::get_Network_file() {
return this->network_file;
}
// Returns name of Trivial output file
template<class T>
T NetworkFile<T>::get_Trivial_file(){
return this->trivial_file;
}
// Returns name of Bellman-Ford output file
template<class T>
T NetworkFile<T>::get_Bellman_Ford_file(){
return this->bellman_ford_file;
}
// Returns name of Floyd-Warshall output file
template<class T>
T NetworkFile<T>::get_Floyd_Warshall_file(){
return this->floyd_warshall_file;
}
// Prints the location of each of the files defined within the object
template<class T>
void NetworkFile<T>::print(){
cout << "--------------------------------------------------------------" << endl;
cout << get_Network_file() << endl;
cout << get_Trivial_file() << endl;
cout << get_Bellman_Ford_file() << endl;
cout << get_Floyd_Warshall_file() << endl;
}
template<class T>
NetworkFile<T>::~NetworkFile<T>() = default;
#endif //ALGORITHMS_NETWORKFILE_H