-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogfile.hpp
39 lines (32 loc) · 1.13 KB
/
logfile.hpp
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
//===============================================================================//
// Name : logfile.hpp
// Author(s) : Barbara Bruno
// Affiliation : University of Genova, Italy - dept. DIBRIS
// Version : 1.0
// Description : Interface for the log file
//===============================================================================//
#include <fstream>
#include "publisher.hpp"
using namespace std;
#ifndef LOGFILE_HPP_
#define LOGFILE_HPP_
//! derivate class "LogFile", interface for the log file
class LogFile: public Publisher
{
public:
//! constructor
//! (call to Publisher::Publisher constructor)
//! @param[in] n name of the publisher
LogFile(string n): Publisher(n){}
//! publish information
//! @param[in] key key of the information to be published
//! @param[in] value value of the information to be published
void publish(const string key, const string value)
{
ofstream outputFile;
outputFile.open(name.c_str(), ios_base::app);
outputFile<<key <<" " <<value <<endl;
outputFile.close();
}
};
#endif