LuciadCPillar 2023.1.04
luciad::ExpressionValue Class Referencefinal

Value object to store the value of an Expression and its DataType. More...

#include <luciad/expressions/ExpressionValue.h>

Public Member Functions

 ExpressionValue (bool value)
 Constructs the value object for a boolean value. More...
 
 ExpressionValue (const char *value)
 Constructs the value object for a text value. More...
 
 ExpressionValue (const ExpressionValue &other)
 Constructs a copy of other. More...
 
 ExpressionValue (double value)
 Constructs the value object for a number value. More...
 
 ExpressionValue (ExpressionValue &&other) noexcept
 Move-constructs a ExpressionValue instance, making it point at the same object that other was pointing to. More...
 
 ExpressionValue (float value)
 Constructs the value object for a number value. More...
 
 ExpressionValue (int32_t value)
 Constructs the value object for an integer value. More...
 
 ExpressionValue (int64_t value)
 Constructs the value object for a long integer (64 bit) value. More...
 
 ExpressionValue (std::shared_ptr< Geometry > value)
 Constructs the value object for a Geometry value. More...
 
 ExpressionValue (std::string value)
 Constructs the value object for a text value. More...
 
 ~ExpressionValue ()
 
std::optional< double > asDouble () const
 Returns the double value, if the value object can be converted to a double. More...
 
bool getBoolValue () const
 Returns the boolean value, if the value object contains a boolean. More...
 
const DataTypegetDataType () const
 Returns the type of the value stored within this value object. More...
 
double getDoubleValue () const
 Returns the double value, if the value object contains a double. More...
 
float getFloatValue () const
 Returns the float value, if the value object contains a float. More...
 
const std::shared_ptr< Geometry > & getGeometryValue () const
 Returns the geometry value, if the value object contains a geometry. More...
 
int32_t getIntValue () const
 Returns the int value, if the value object contains an int. More...
 
int64_t getLongValue () const
 Returns the long integer value, if the value object contains a long int. More...
 
const std::string & getStringValue () const
 Returns the string value, if the value object contains a string. More...
 
ExpressionValueoperator= (const ExpressionValue &other)
 
ExpressionValueoperator= (ExpressionValue &&other) noexcept
 
bool operator== (const ExpressionValue &other) const
 

Detailed Description

Value object to store the value of an Expression and its DataType.

Users of this value object always must check the type of value stored and then call the appropriate method to retrieve the actual value.

Constructor & Destructor Documentation

◆ ExpressionValue() [1/10]

luciad::ExpressionValue::ExpressionValue ( bool  value)

Constructs the value object for a boolean value.

The type of the value is luciad::DataType::getBooleanType().

Parameters
valuethe boolean.

◆ ExpressionValue() [2/10]

luciad::ExpressionValue::ExpressionValue ( float  value)

Constructs the value object for a number value.

The type of the value is luciad::DataType::getFloatType().

Parameters
valuethe number.

◆ ExpressionValue() [3/10]

luciad::ExpressionValue::ExpressionValue ( double  value)

Constructs the value object for a number value.

The type of the value is luciad::DataType::getDoubleType().

Parameters
valuethe number.

◆ ExpressionValue() [4/10]

luciad::ExpressionValue::ExpressionValue ( int32_t  value)

Constructs the value object for an integer value.

The type of the value is luciad::DataType::getIntType().

Parameters
valuethe number.

◆ ExpressionValue() [5/10]

luciad::ExpressionValue::ExpressionValue ( int64_t  value)

Constructs the value object for a long integer (64 bit) value.

The type of the value is luciad::DataType::getLongType().

Parameters
valuethe number.

◆ ExpressionValue() [6/10]

luciad::ExpressionValue::ExpressionValue ( std::string  value)

Constructs the value object for a text value.

The type of the value is luciad::DataType::getStringType().

Parameters
valuethe text.

◆ ExpressionValue() [7/10]

luciad::ExpressionValue::ExpressionValue ( const char *  value)

Constructs the value object for a text value.

The type of the value is luciad::DataType::getStringType().

Parameters
valuethe text.
Remarks
Enables the instantiation with the string literals like ExpressionValue{"My string"}.

◆ ExpressionValue() [8/10]

luciad::ExpressionValue::ExpressionValue ( std::shared_ptr< Geometry value)

Constructs the value object for a Geometry value.

The type of the value is luciad::DataType::getGeometryType().

Parameters
valueGeometry, cannot be nullptr.

◆ ExpressionValue() [9/10]

luciad::ExpressionValue::ExpressionValue ( const ExpressionValue other)

Constructs a copy of other.

Parameters
otherInstance of the ExpressionValue.

◆ ExpressionValue() [10/10]

luciad::ExpressionValue::ExpressionValue ( ExpressionValue &&  other)
noexcept

Move-constructs a ExpressionValue instance, making it point at the same object that other was pointing to.

Parameters
otherInstance of the ExpressionValue.

◆ ~ExpressionValue()

luciad::ExpressionValue::~ExpressionValue ( )

Member Function Documentation

◆ asDouble()

std::optional< double > luciad::ExpressionValue::asDouble ( ) const

Returns the double value, if the value object can be converted to a double.

Returns
the double value, if the value object can be converted to a double.

◆ getBoolValue()

bool luciad::ExpressionValue::getBoolValue ( ) const

Returns the boolean value, if the value object contains a boolean.

Returns
the boolean value, if the value object contains a boolean.
Exceptions
luciad::LogicExceptionwhen the object does not contain a boolean.

◆ getDataType()

const DataType & luciad::ExpressionValue::getDataType ( ) const

Returns the type of the value stored within this value object.

Returns
the type of the value stored within this value object.

◆ getDoubleValue()

double luciad::ExpressionValue::getDoubleValue ( ) const

Returns the double value, if the value object contains a double.

Returns
the double value, if the value object contains a double.
Exceptions
luciad::LogicExceptionwhen the object does not contain a double.

◆ getFloatValue()

float luciad::ExpressionValue::getFloatValue ( ) const

Returns the float value, if the value object contains a float.

Returns
the float value, if the value object contains a float.
Exceptions
luciad::LogicExceptionwhen the object does not contain a float.

◆ getGeometryValue()

const std::shared_ptr< Geometry > & luciad::ExpressionValue::getGeometryValue ( ) const

Returns the geometry value, if the value object contains a geometry.

Returns
the geometry value, if the value object contains a geometry.
Exceptions
luciad::LogicExceptionwhen the object does not contain a geometry.

◆ getIntValue()

int32_t luciad::ExpressionValue::getIntValue ( ) const

Returns the int value, if the value object contains an int.

Returns
the int value, if the value object contains an int.
Exceptions
luciad::LogicExceptionwhen the object does not contain an int.

◆ getLongValue()

int64_t luciad::ExpressionValue::getLongValue ( ) const

Returns the long integer value, if the value object contains a long int.

Returns
the long integer value, if the value object contains a long int.
Exceptions
luciad::LogicExceptionwhen the object does not contain a long int.

◆ getStringValue()

const std::string & luciad::ExpressionValue::getStringValue ( ) const

Returns the string value, if the value object contains a string.

Returns
the string value, if the value object contains a string.
Exceptions
luciad::LogicExceptionwhen the object does not contain a string.

◆ operator=() [1/2]

ExpressionValue & luciad::ExpressionValue::operator= ( const ExpressionValue other)

◆ operator=() [2/2]

ExpressionValue & luciad::ExpressionValue::operator= ( ExpressionValue &&  other)
noexcept

◆ operator==()

bool luciad::ExpressionValue::operator== ( const ExpressionValue other) const