IOSS 2.0
Loading...
Searching...
No Matches
Ioss::Property Class Reference

A named value that has a known type. More...

#include <Ioss_Property.h>

Public Types

enum  BasicType {
  INVALID = -1 , REAL , INTEGER , POINTER ,
  STRING , VEC_INTEGER , VEC_DOUBLE
}
 
enum  Origin { INTERNAL = -1 , IMPLICIT , EXTERNAL , ATTRIBUTE }
 

Public Member Functions

 Property (std::string name, int64_t value, Origin origin=INTERNAL)
 Create an INTEGER type property using an int64_t variable.
 
 Property (std::string name, int value, Origin origin=INTERNAL)
 Create an INTEGER type property.
 
 Property (std::string name, double value, Origin origin=INTERNAL)
 Create a REAL type property.
 
 Property (std::string name, const std::string &value, Origin origin=INTERNAL)
 Create a STRING type property.
 
 Property (std::string name, const char *value, Origin origin=INTERNAL)
 Create a STRING type property from const char* argument.
 
 Property (std::string name, void *value, Origin origin=INTERNAL)
 Create a POINTER type property.
 
 Property (std::string name, const std::vector< int > &value, Origin origin=INTERNAL)
 Create a VEC_INTEGER type property.
 
 Property (std::string name, const std::vector< double > &value, Origin origin=INTERNAL)
 Create a VEC_DOUBLE type property.
 
 Property (const GroupingEntity *ge, std::string name, BasicType type)
 Set implicit property with a specified type.
 
IOSS_NODISCARD std::string get_string () const
 Get the property value if it is of type STRING.
 
IOSS_NODISCARD int64_t get_int () const
 Get the property value if it is of type INTEGER.
 
IOSS_NODISCARD double get_real () const
 Get the property value if it is of type REAL.
 
IOSS_NODISCARD void * get_pointer () const
 Get the property value if it is of type POINTER.
 
IOSS_NODISCARD std::vector< double > get_vec_double () const
 Get the property value if it is of type VEC_DOUBLE.
 
IOSS_NODISCARD std::vector< int > get_vec_int () const
 Get the property value if it is of type VEC_INT.
 
void set_origin (Origin origin)
 
IOSS_NODISCARD Origin get_origin () const
 
IOSS_NODISCARD bool is_implicit () const
 Tells whether the property is calculated, rather than stored.
 
IOSS_NODISCARD bool is_explicit () const
 Tells whether the property is stored, rather than calculated.
 
IOSS_NODISCARD bool is_valid () const
 
IOSS_NODISCARD bool is_invalid () const
 
IOSS_NODISCARD std::string get_name () const
 Get the property name.
 
IOSS_NODISCARD BasicType get_type () const
 Get the property type.
 
IOSS_NODISCARD bool operator!= (const Ioss::Property &rhs) const
 
IOSS_NODISCARD bool operator== (const Ioss::Property &rhs) const
 

Private Member Functions

bool get_value (int64_t *value) const
 
bool get_value (double *value) const
 
bool get_value (std::string *value) const
 
bool get_value (void *&value) const
 
bool get_value (std::vector< double > *value) const
 
bool get_value (std::vector< int > *value) const
 

Private Attributes

std::string name_ {}
 
BasicType type_ {INVALID}
 
Origin origin_ {INTERNAL}
 
std::variant< std::string, const Ioss::GroupingEntity *, double, int64_t, std::vector< double >, std::vector< int >, void * > data_
 

Detailed Description

A named value that has a known type.

Member Enumeration Documentation

◆ BasicType

Enumerator
INVALID 
REAL 
INTEGER 
POINTER 
STRING 
VEC_INTEGER 
VEC_DOUBLE 

◆ Origin

Enumerator
INTERNAL 

Property is for internal use.

IMPLICIT 

Property is calculated on the fly based on current state of entity containing.

EXTERNAL 

Property was created by client.

ATTRIBUTE 

Property created from an Exodus or Database Attribute.

Constructor & Destructor Documentation

◆ Property() [1/9]

Ioss::Property::Property ( std::string name,
int64_t value,
Origin origin = INTERNAL )

Create an INTEGER type property using an int64_t variable.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [2/9]

Ioss::Property::Property ( std::string name,
int value,
Origin origin = INTERNAL )

Create an INTEGER type property.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [3/9]

Ioss::Property::Property ( std::string name,
double value,
Origin origin = INTERNAL )

Create a REAL type property.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [4/9]

Ioss::Property::Property ( std::string name,
const std::string & value,
Origin origin = INTERNAL )

Create a STRING type property.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [5/9]

Ioss::Property::Property ( std::string name,
const char * value,
Origin origin = INTERNAL )

Create a STRING type property from const char* argument.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [6/9]

Ioss::Property::Property ( std::string name,
void * value,
Origin origin = INTERNAL )

Create a POINTER type property.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [7/9]

Ioss::Property::Property ( std::string name,
const std::vector< int > & value,
Origin origin = INTERNAL )

Create a VEC_INTEGER type property.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [8/9]

Ioss::Property::Property ( std::string name,
const std::vector< double > & value,
Origin origin = INTERNAL )

Create a VEC_DOUBLE type property.

Parameters
[in]nameThe property name.
[in]valueThe property value.
[in]originThe origin of the property - IMPLICIT, or EXTERNAL, or ATTRIBUTE

◆ Property() [9/9]

Ioss::Property::Property ( const GroupingEntity * ge,
std::string name,
BasicType type )

Set implicit property with a specified type.

Parameters
[in]geThe property value.
[in]nameThe property name.
[in]typeThe property type.

Member Function Documentation

◆ get_int()

int64_t Ioss::Property::get_int ( ) const

Get the property value if it is of type INTEGER.

Returns
The INTEGER-type property value

◆ get_name()

IOSS_NODISCARD std::string Ioss::Property::get_name ( ) const
inline

Get the property name.

Returns
The property name.

◆ get_origin()

IOSS_NODISCARD Origin Ioss::Property::get_origin ( ) const
inline

◆ get_pointer()

void * Ioss::Property::get_pointer ( ) const

Get the property value if it is of type POINTER.

Returns
The POINTER-type property value.

◆ get_real()

double Ioss::Property::get_real ( ) const

Get the property value if it is of type REAL.

Returns
The REAL-type property value.

◆ get_string()

std::string Ioss::Property::get_string ( ) const

Get the property value if it is of type STRING.

Returns
The STRING-type property value

◆ get_type()

IOSS_NODISCARD BasicType Ioss::Property::get_type ( ) const
inline

Get the property type.

Returns
The property type.

◆ get_value() [1/6]

bool Ioss::Property::get_value ( double * value) const
private

◆ get_value() [2/6]

bool Ioss::Property::get_value ( int64_t * value) const
private

◆ get_value() [3/6]

bool Ioss::Property::get_value ( std::string * value) const
private

◆ get_value() [4/6]

bool Ioss::Property::get_value ( std::vector< double > * value) const
private

◆ get_value() [5/6]

bool Ioss::Property::get_value ( std::vector< int > * value) const
private

◆ get_value() [6/6]

bool Ioss::Property::get_value ( void *& value) const
private

◆ get_vec_double()

std::vector< double > Ioss::Property::get_vec_double ( ) const

Get the property value if it is of type VEC_DOUBLE.

Returns
The VEC_DOUBLE-type property value

◆ get_vec_int()

std::vector< int > Ioss::Property::get_vec_int ( ) const

Get the property value if it is of type VEC_INT.

Returns
The VEC_INT-type property value

◆ is_explicit()

IOSS_NODISCARD bool Ioss::Property::is_explicit ( ) const
inline

Tells whether the property is stored, rather than calculated.

Returns
True if property is stored directly; False if it is calculated.

◆ is_implicit()

IOSS_NODISCARD bool Ioss::Property::is_implicit ( ) const
inline

Tells whether the property is calculated, rather than stored.

Returns
True if property is calculated; False if it is stored directly.

◆ is_invalid()

IOSS_NODISCARD bool Ioss::Property::is_invalid ( ) const
inline

Tells whether the property has an invalid type (currently not one of REAL, INTEGER, POINTER, or STRING)

Returns
True if the property type is invalid.

◆ is_valid()

IOSS_NODISCARD bool Ioss::Property::is_valid ( ) const
inline

Tells whether the property has a valid type (currently REAL, INTEGER, POINTER, or STRING)

Returns
True if the property type is valid.

◆ operator!=()

bool Ioss::Property::operator!= ( const Ioss::Property & rhs) const

◆ operator==()

bool Ioss::Property::operator== ( const Ioss::Property & rhs) const

◆ set_origin()

void Ioss::Property::set_origin ( Origin origin)
inline

Member Data Documentation

◆ data_

std::variant<std::string, const Ioss::GroupingEntity *, double, int64_t, std::vector<double>, std::vector<int>, void *> Ioss::Property::data_
private

The actual value of the property. Use 'type_' to discriminate the actual type of the property.

◆ name_

std::string Ioss::Property::name_ {}
private

◆ origin_

Origin Ioss::Property::origin_ {INTERNAL}
private

True if property is calculated rather than stored. False if property is stored in 'data_'

◆ type_

BasicType Ioss::Property::type_ {INVALID}
private

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