-
Notifications
You must be signed in to change notification settings - Fork 0
/
Protocol.h
75 lines (60 loc) · 1.72 KB
/
Protocol.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
/*
* File: Protocol.h
* Author: RM
*
* Created on 17. August 2013, 22:53
*/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include <iostream>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <chrono>
#include <string>
#include <sstream>
#include "Definitions.h"
using namespace std;
typedef unsigned int uint;
class Protocol
{
public:
Protocol();
Protocol(const Protocol& orig);
virtual ~Protocol();
/**
* Inits Protocol class.
* @param filepath
*/
static void init(string filepath = "", string subdirectory = "", bool printToConsole = false);
/**
* Finalizes Protocol class.
*/
static void finalize();
/**
* Returns reference to protocol ofstream instance.
* @return Reference to protocol file.
*/
static ofstream& protocol();
/**
* Decides if protocol output should be printed on console too.
* @return Reference to described internal variable.
*/
static bool& printToConsole();
/**
* Prints header for new phase.
* @param phase Name/title of phase.
*/
static void introducePhase(const string phase);
/**
* Prints footer for current phase.
*/
static void concludePhase(chrono::milliseconds duration);
private:
static ofstream _protocol;
static string _currentPhase;
static uint _currentPhaseCounter;
static bool _printToConsole;
static const string FILEPATH_BASE;
} ;
#endif /* PROTOCOL_H */