Value.h
Go to the documentation of this file.
#pragma once
#include "DataType.h"
#include <ostream>
#include <vector>
namespace Hazelnp
{
class Value
{
public:
virtual ~Value() {};
virtual Value* Deepcopy() const = 0;
virtual std::string GetAsOsString() const = 0;
DATA_TYPE GetDataType() const;
friend std::ostream& operator<< (std::ostream& os, const Value& v)
{
return os << v.GetAsOsString();
}
virtual long long int GetInt64() const = 0;
virtual int GetInt32() const = 0;
virtual long double GetFloat64() const = 0;
virtual double GetFloat32() const = 0;
virtual std::string GetString() const = 0;
virtual const std::vector<Value*>& GetList() const = 0;
protected:
Value(DATA_TYPE type);
DATA_TYPE type;
};
}
Hazelnp
Definition: DataType.h:3
DataType.h
Hazelnp::Value::GetFloat32
virtual double GetFloat32() const =0
Will attempt to return the floating-point data (double)
Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::Value::GetInt32
virtual int GetInt32() const =0
Will attempt to return the integer data (int)
Hazelnp::Value::GetString
virtual std::string GetString() const =0
Will attempt to return the string-data.
Hazelnp::Value::~Value
virtual ~Value()
Definition: Value.h:13
Hazelnp::Value::Value
Value(DATA_TYPE type)
Definition: Value.cpp:5
Hazelnp::Value::GetDataType
DATA_TYPE GetDataType() const
Will return the data type of this value.
Definition: Value.cpp:12
Hazelnp::Value::GetInt64
virtual long long int GetInt64() const =0
Will attempt to return the integer data (long long)
Hazelnp::Value::GetAsOsString
virtual std::string GetAsOsString() const =0
Will return a string suitable for an std::ostream.
Hazelnp::Value::GetList
virtual const std::vector< Value * > & GetList() const =0
Will attempt to return the list-data.
Hazelnp::Value::operator<<
friend std::ostream & operator<<(std::ostream &os, const Value &v)
Definition: Value.h:24
Hazelnp::DATA_TYPE
DATA_TYPE
The different data types a paramater can be.
Definition: DataType.h:7
Hazelnp::Value::type
DATA_TYPE type
Definition: Value.h:48
Hazelnp::Value::Deepcopy
virtual Value * Deepcopy() const =0
Will return a deeopopy of this object.
Hazelnp::Value::GetFloat64
virtual long double GetFloat64() const =0
Will attempt to return the floating-point data (long double)