-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotresult.h
More file actions
90 lines (77 loc) · 2.74 KB
/
plotresult.h
File metadata and controls
90 lines (77 loc) · 2.74 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
82
83
84
85
86
87
88
89
90
/*
This file is part of the ParsePlot library
ParsePlot is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ParsePlot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser Public License for more details.
You should have received a copy of the GNU Lesser Public License
along with ParsePlot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _PLOTRESULT_H_
#define _PLOTRESULT_H_
#include <string>
using std::string;
namespace ParsePlot{
/**
* @file plotresult.h
* @brief Contains the PlotResult class
*
* @class PlotResult
* @brief Holds information about a single value entry from plotting data
* @author Eric Lavesson
* @date 2011-02-05
* @version 1.0.0-a
*
* An instance of PlotResult can be used to flag for NaN and to store a message
* (usually an error message)
*/
template <typename T>
class PlotResult
{
public:
/**
* @fn PlotResult(bool aDefined, T aValue, string aMore)
* @brief Constructor
* @arg @c aDefined Set the defined flag of the result
* @arg @c aValue Set the value of the result
* @arg @c aMore Set a message with result information */
PlotResult(bool aDefined, T aValue, string aMore)
: defined(aDefined), value(aValue), more(aMore) {}
/**
* @fn PlotResult(bool aDefined, T aValue)
* @brief Constructor
* @arg @c aDefined Set the defined flag of the result
* @arg @c aValue Set the value of the result */
PlotResult(bool aDefined, T aValue)
: defined(aDefined), value(aValue) {}
/**
* @fn Defined()
* @brief Flag whether the number is defined or undefined (NaN)
* @return True if this is defined, otherwise false */
bool Defined() { return defined; }
/**
* @fn Value(T& aValue)
* @brief Flag whether the number is defined or undefined (NaN)
* @arg @c aValue Reference to get the value stored in this instance
* @warning Value is undefined if !Defined() */
void Value(T& aValue) { aValue = value; }
/**
* @fn More()
* @brief Contains a message which can be embedded with the numerical entry
* @return String with information message
*
* There is no specified use of this message more than that you can bundle a
* text message with the class instance. This can be general information, or
* this could be an error message when the number is undefined. */
string More() { return more; }
private:
bool defined;
T value;
string more;
};
}
#endif