forked from npshub/mantid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnvironmentHistory.cpp
56 lines (51 loc) · 1.98 KB
/
EnvironmentHistory.cpp
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
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidKernel/EnvironmentHistory.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/MantidVersion.h"
#include <ostream>
namespace Mantid {
namespace Kernel {
/**
* Returns the framework version
* @returns A string containing the Mantid version
*/
std::string EnvironmentHistory::frameworkVersion() const { return MantidVersion::version(); }
/**
* Returns the OS name
* @returns A string containing the OS name
*/
std::string EnvironmentHistory::osName() const { return ConfigService::Instance().getOSName(); }
/**
* Returns the OS version
* @returns A string containing the OS version
*/
std::string EnvironmentHistory::osVersion() const { return ConfigService::Instance().getOSVersion(); }
/** Prints a text representation of itself
* @param os :: The ouput stream to write to
* @param indent :: an indentation value to make pretty printing of object and
* sub-objects
*/
void EnvironmentHistory::printSelf(std::ostream &os, const int indent) const {
os << std::string(indent, ' ') << "Framework Version: " << frameworkVersion() << '\n';
os << std::string(indent, ' ') << "OS name: " << osName() << '\n';
os << std::string(indent, ' ') << "OS version: " << osVersion() << '\n';
}
/** Prints a text representation
* @param os :: The ouput stream to write to
* @param EH :: The EnvironmentHistory to output
* @returns The ouput stream
*/
std::ostream &operator<<(std::ostream &os, const EnvironmentHistory &EH) {
EH.printSelf(os);
return os;
}
} // namespace Kernel
} // namespace Mantid