-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilereader.h
More file actions
57 lines (46 loc) · 1.03 KB
/
filereader.h
File metadata and controls
57 lines (46 loc) · 1.03 KB
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
#pragma once
#include <fstream>
#include <string>
#include <vector>
#include "geometry.h"
class FileReader
{
private:
std::string path;
std::ifstream infile;
std::string outputMessage;
std::vector<Vec3d> coordinateList;
public:
bool isSuccessful;
FileReader(const std::string& n_path) : path(n_path)
{
infile.open(path);
if (infile.fail())
{
outputMessage = "Failed to load : " + path;
isSuccessful = false;
}
else
{
while (!infile.eof())
{
Vec3d temp;
infile >> temp.x;
infile >> temp.y;
infile >> temp.z;
coordinateList.push_back(temp);
}
outputMessage = "File loaded : " + path;
isSuccessful = true;
}
infile.close();
}
std::vector<Vec3d> getCoordinates()
{
return coordinateList;
}
std::string getOutput()
{
return outputMessage;
}
};