| Leonetienne/Hazelnupp Simple, easy to use, command line parameter interface

Public Member Functions | List of all members
Hazelnp::FloatValue Class Reference

Specializations for floating point values (uses long double) More...

`#include <FloatValue.h>`

Inheritance diagram for Hazelnp::FloatValue:
[legend]
Collaboration diagram for Hazelnp::FloatValue:
[legend]

## Public Member Functions
| FloatValue (const long double &value)
| ~FloatValue () override
Value * | Deepcopy () const override
| Will return a deeopopy of this object. More...
std::string | GetAsOsString () const override
| Will return a string suitable for an std::ostream;. More...
const long double & | GetValue () const
| Will return the raw value. More...
| operator long double () const
| operator double () const
long long int | GetInt64 () const override
| Will return the data as a long long int. More...
int | GetInt32 () const override
| Will return the data as an int. More...
long double | GetFloat64 () const override
| Will return the data as a long double. More...
double | GetFloat32 () const override
| Will return the data as a double. More...
std::string | GetString () const override
| Will return the data as a string. More...
const std::vector< Value * > & | GetList () const override
| Throws HazelnuppValueNotConvertibleException. More...
Public Member Functions inherited from Hazelnp::Value
virtual | ~Value ()
DATA_TYPE | GetDataType () const
| Will return the data type of this value. More...

## Additional Inherited Members
Protected Member Functions inherited from Hazelnp::Value
| Value (DATA_TYPE type)
Protected Attributes inherited from Hazelnp::Value
DATA_TYPE | type

## Detailed Description

Specializations for floating point values (uses long double)

Definition at line 9 of file FloatValue.h.

## Constructor & Destructor Documentation

## ◆ FloatValue()

FloatValue::FloatValue | ( | const long double & | value | ) |

Definition at line 7 of file FloatValue.cpp.

8 :
9 Value(DATA_TYPE::FLOAT),
10 value { value }
11 {
12 return;
13 }

## ◆ ~FloatValue()

Hazelnp::FloatValue::~FloatValue | ( |  | ) |
| inline override

Definition at line 13 of file FloatValue.h.

13 {};

## Member Function Documentation

## ◆ Deepcopy()

Value * FloatValue::Deepcopy | ( |  | ) | const
| override virtual

Will return a deeopopy of this object.

Implements Hazelnp::Value.

Definition at line 15 of file FloatValue.cpp.

16 {
17 return new FloatValue(value);
18 }

## ◆ GetAsOsString()

std::string FloatValue::GetAsOsString | ( |  | ) | const
| override virtual

Will return a string suitable for an std::ostream;.

Implements Hazelnp::Value.

Definition at line 20 of file FloatValue.cpp.

21 {
22 std::stringstream ss;
23 ss << "FloatValue: " << value;
24 return ss.str();
25 }

## ◆ GetFloat32()

double FloatValue::GetFloat32 | ( |  | ) | const
| override virtual

Will return the data as a double.

Implements Hazelnp::Value.

Definition at line 59 of file FloatValue.cpp.

60 {
61 return (double)value;
62 }

## ◆ GetFloat64()

long double FloatValue::GetFloat64 | ( |  | ) | const
| override virtual

Will return the data as a long double.

Implements Hazelnp::Value.

Definition at line 54 of file FloatValue.cpp.

55 {
56 return value;
57 }

## ◆ GetInt32()

int FloatValue::GetInt32 | ( |  | ) | const
| override virtual

Will return the data as an int.

Implements Hazelnp::Value.

Definition at line 49 of file FloatValue.cpp.

50 {
51 return (int)value;
52 }

## ◆ GetInt64()

long long int FloatValue::GetInt64 | ( |  | ) | const
| override virtual

Will return the data as a long long int.

Implements Hazelnp::Value.

Definition at line 44 of file FloatValue.cpp.

45 {
46 return (long long int)value;
47 }

## ◆ GetList()

const std::vector< Value * > & FloatValue::GetList | ( |  | ) | const
| override virtual

Throws HazelnuppValueNotConvertibleException.

Implements Hazelnp::Value.

Definition at line 72 of file FloatValue.cpp.

73 {
74 throw HazelnuppValueNotConvertibleException();
75 }

## ◆ GetString()

std::string FloatValue::GetString | ( |  | ) | const
| override virtual

Will return the data as a string.

Implements Hazelnp::Value.

Definition at line 64 of file FloatValue.cpp.

65 {
66 std::stringstream ss;
67 ss << value;
68
69 return ss.str();
70 }

## ◆ GetValue()

const long double & FloatValue::GetValue | ( |  | ) | const

Will return the raw value.

Definition at line 27 of file FloatValue.cpp.

28 {
29 return value;
30 }

## ◆ operator double()

FloatValue::operator double | ( |  | ) | const

Definition at line 37 of file FloatValue.cpp.

38 {
39 return (double)value;
40 }

## ◆ operator long double()

FloatValue::operator long double | ( |  | ) | const

Definition at line 32 of file FloatValue.cpp.

33 {
34 return value;
35 }

The documentation for this class was generated from the following files:

- Hazelnupp/FloatValue.h
- Hazelnupp/FloatValue.cpp

Hazelnp::Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:5
Hazelnp::DATA_TYPE::FLOAT
@ FLOAT
Hazelnp::FloatValue::FloatValue
FloatValue(const long double &value)
Definition: FloatValue.cpp:7
Hazelnp::HazelnuppValueNotConvertibleException
Gets thrown when an attempt is made to retrieve the wrong data type from a value, when the value not ...
Definition: HazelnuppException.h:38