LuciadCPillar 2024.1.04
luciad::DataType Class Referencefinal

A representation of the type of a data object. More...

#include <luciad/datamodels/DataType.h>

Classes

class  Builder
 Builder that allows DataType instances to be created. More...
 

Public Member Functions

std::optional< DataPropertyfindDataProperty (const std::string &name) const
 Searches for a data property by name. More...
 
const std::vector< std::shared_ptr< DataAnnotation > > & getAnnotations () const
 Returns the list of annotations attached to this data type. More...
 
const std::vector< DataProperty > & getDataProperties () const
 Returns the list of properties of this data type. More...
 
size_t getHash () const
 Returns the hash code. More...
 
const std::string & getName () const
 Returns the name of this data type. More...
 
bool hasDataProperty (const DataProperty &property) const
 Returns if the given property is declared in this data type. More...
 
bool isPrimitive () const
 Returns whether this is a primitive type, i.e. More...
 
bool operator!= (const DataType &other) const
 
bool operator== (const DataType &other) const
 

Static Public Member Functions

static const DataTypegetBooleanType ()
 Returns the type that corresponds to bool values. More...
 
static const DataTypegetDoubleType ()
 Returns the type that corresponds to double values. More...
 
static const DataTypegetFloatType ()
 Returns the type that corresponds to float values. More...
 
static const DataTypegetGeometryType ()
 Returns the type that corresponds to Geometry values. More...
 
static const DataTypegetIntType ()
 Returns the type that corresponds to int32_t values. More...
 
static const DataTypegetLongType ()
 Returns the type that corresponds to int64_t values. More...
 
static const DataTypegetStringType ()
 Returns the type that corresponds to std::string values. More...
 
static Builder newBuilder ()
 Creates a new DataType builder. More...
 

Detailed Description

A representation of the type of a data object.

A type describes the structure of a data object as a list of properties. Each of these properties is itself of a certain type.

A type is either a primitive type or a data object type. Primitive types are types which have no internal structure (no properties) and typically represent simple object such as strings, numbers etc. All primitive types are accessible from this class (see e.g. getIntType(), getStringType() ...).

Application-specific metadata can be attached to a type in the form of a DataAnnotation.

New types can be defined using a DataType::Builder (see newBuilder()).

Instances of this class are thread safe. Once an instance has been created, there is no public API to modify it.

See also
DataProperty

Member Function Documentation

◆ findDataProperty()

std::optional< DataProperty > luciad::DataType::findDataProperty ( const std::string &  name) const

Searches for a data property by name.

Parameters
namethe name of a property
Returns
the data property with the given name, if available
See also
hasDataProperty

◆ getAnnotations()

const std::vector< std::shared_ptr< DataAnnotation > > & luciad::DataType::getAnnotations ( ) const

Returns the list of annotations attached to this data type.

Returns
the list of annotations attached to this data type.

◆ getBooleanType()

static const DataType & luciad::DataType::getBooleanType ( )
static

Returns the type that corresponds to bool values.

Returns
the type that corresponds to bool values.

◆ getDataProperties()

const std::vector< DataProperty > & luciad::DataType::getDataProperties ( ) const

Returns the list of properties of this data type.

Returns
the list of properties of this data type.

◆ getDoubleType()

static const DataType & luciad::DataType::getDoubleType ( )
static

Returns the type that corresponds to double values.

Returns
the type that corresponds to double values.

◆ getFloatType()

static const DataType & luciad::DataType::getFloatType ( )
static

Returns the type that corresponds to float values.

Returns
the type that corresponds to float values.

◆ getGeometryType()

static const DataType & luciad::DataType::getGeometryType ( )
static

Returns the type that corresponds to Geometry values.

Returns
the type that corresponds to Geometry values.

◆ getHash()

size_t luciad::DataType::getHash ( ) const

Returns the hash code.

Returns
the hash code.

◆ getIntType()

static const DataType & luciad::DataType::getIntType ( )
static

Returns the type that corresponds to int32_t values.

Returns
the type that corresponds to int32_t values.

◆ getLongType()

static const DataType & luciad::DataType::getLongType ( )
static

Returns the type that corresponds to int64_t values.

Returns
the type that corresponds to int64_t values.

◆ getName()

const std::string & luciad::DataType::getName ( ) const

Returns the name of this data type.

Returns
the name of this data type.

◆ getStringType()

static const DataType & luciad::DataType::getStringType ( )
static

Returns the type that corresponds to std::string values.

Returns
the type that corresponds to std::string values.

◆ hasDataProperty()

bool luciad::DataType::hasDataProperty ( const DataProperty property) const

Returns if the given property is declared in this data type.

Parameters
propertyData property.
Returns
if the given property is declared in this data type.
See also
findDataProperty

◆ isPrimitive()

bool luciad::DataType::isPrimitive ( ) const

Returns whether this is a primitive type, i.e.

a type without any properties.

Returns
whether this is a primitive type, i.e. a type without any properties.

◆ newBuilder()

static Builder luciad::DataType::newBuilder ( )
static

Creates a new DataType builder.

Returns
a new DataType builder.

◆ operator!=()

bool luciad::DataType::operator!= ( const DataType other) const

◆ operator==()

bool luciad::DataType::operator== ( const DataType other) const
Parameters
otheranother data type.
Returns
whether this type and other have the same name, properties and annotations.