-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.h
More file actions
81 lines (64 loc) · 1.68 KB
/
util.h
File metadata and controls
81 lines (64 loc) · 1.68 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <chrono>
#include <thread>
#ifndef BACKPROJECT_UTIL_H
#define BACKPROJECT_UTIL_H
#ifdef __cplusplus__
#include <cstdlib>
#else
#include <stdlib.h>
#endif
#include <vector>
#include <array>
#include <iostream>
#include <iomanip>
/**
* Represents a 2 dimensional coordinate in an as yet unspecified unit (e.g. pixels or meters)
*/
struct Point
{
/**
* the x ordinate of the point
*/
double x;
/**
* the y ordinate of the point.
*/
double y;
/**
* Creates an instance of a point assigning the x and y ordinates
* @param x the x ordinate
* @param y the y ordinate
*/
Point(double x, double y);
/**
* the default constructor, necessary since a non-default constructor has been specified; the compiler won't generate this by itself,
* and it would be very annoying if it were absent; since it would mean users would be forced to specify default values.
*/
Point();
};
/**
* Reads a value of class T, and then returns the result, forcing the user to enter a correct value.
* @tparam T
* @return a valid value of T.
*/
template<class T>
T ReadAndValidate();
#include "util.hpp"
/**
* Clears the screen through an OS call.
*/
void clearScreen();
/**
* Sleeps for the given amount of seconds.
* @param seconds
*/
void sleep(double seconds);
/**
* Method which uses std::cout and std::cin to ask the user to press the enter key, returns immediately afterward.
*/
void PressEnterToContinue();
/**
* Method which uses the specified input and output stream to ask the user to press the enter key, returns immediately afterward.
*/
void PressEnterToContinue(std::ostream &os,std::istream &is);
#endif //BACKPROJECT_UTIL_H