Streaming C++ API
sb::CompleteDataType Class Reference

An object containing all the information about a data type – the primitive DataType; for DataType::TUPLEs, the Tuple's Schema; and for DataType::LISTs, the List elements' own CompleteDataType. More...

#include <CompleteDataType.hpp>

Public Member Functions

 CompleteDataType (const CompleteDataType &cdt)
 Copy constructor. More...
 
CompleteDataTypeoperator= (const CompleteDataType &cdt)
 Assignment operator. More...
 
 ~CompleteDataType ()
 Destructor. More...
 
bool operator== (const CompleteDataType &t) const
 
bool operator!= (const CompleteDataType &t) const
 
bool operator< (const CompleteDataType &t) const
 
bool operator> (const CompleteDataType &t) const
 
bool operator<= (const CompleteDataType &t) const
 
bool operator>= (const CompleteDataType &t) const
 
 operator const void * () const
 
int compare (const CompleteDataType &fv) const
 Compare the current CompleteDataType against the provided CompleteDataType by base type (eg DataType::BOOL, INT, ::TUPLE, etc). More...
 
const DataTypegetType () const
 Return the primitive DataType of the CompleteDataType. More...
 
bool hasSchema ()
 Returns true if this CompleteDataType contains a Schema (eg it is a DataType::TUPLE). More...
 
const Schema getSchema () const
 If this CompleteDataType has a nested tuple, return its Schema. More...
 
bool hasElementType () const
 Returns true if this CompleteDataType has an element CompleteDataType (eg it is a DataType::LIST of DataType::INTs, the latter being its element type). More...
 
const CompleteDataTypegetElementCompleteType () const
 If this CompleteDataType has an element type, returns the element CompleteDataType. More...
 
const CompleteDataTypegetReturnType () const
 If this CompleteDataType is a function, return its return type. More...
 
const SchemagetArgumentSchema () const
 If this CompleteDataType is a function, return its argument schema. More...
 
std::string getCaptureTypeName () const
 
std::string as_string () const
 Returns a string representation of this CompleteDataType. More...
 

Static Public Member Functions

static const CompleteDataTypeforBool ()
 Return a CompleteDataType of type DataType::BOOL. More...
 
static const CompleteDataTypeforInt ()
 Return a CompleteDataType of type DataType::INT. More...
 
static const CompleteDataTypeforLong ()
 Return a CompleteDataType of type DataType::LONG. More...
 
static const CompleteDataTypeforDouble ()
 Return a CompleteDataType of type DataType::DOUBLE. More...
 
static const CompleteDataTypeforTimestamp ()
 Return a CompleteDataType of type DataType::TIMESTAMP. More...
 
static const CompleteDataTypeforString ()
 Return a CompleteDataType of type DataType::STRING. More...
 
static const CompleteDataTypeforBlob ()
 Return a CompleteDataType of type DataType::BLOB. More...
 
static const CompleteDataType forTuple (const Schema &s)
 Return a CompleteDataType of type DataType::TUPLE with the given Schema. More...
 
static const CompleteDataType forList (const CompleteDataType &elemType)
 Return a CompleteDataType of type DataType::LIST with the given CompleteDataType as the type of its elements. More...
 
static const CompleteDataType forCapture (const std::string &captureName)
 Return a CompleteDataType of type DataType::CAPTURE with the given capture type name. More...
 
static const CompleteDataType forFunction (const Schema &argumentSchema, const CompleteDataType &returnType)
 Return a CompleteDataType of type DataType::FUNCTION with the given argument schema and return type. More...
 
static const CompleteDataType forSimpleType (const DataType &type)
 Convenience method. More...
 

Detailed Description

An object containing all the information about a data type – the primitive DataType; for DataType::TUPLEs, the Tuple's Schema; and for DataType::LISTs, the List elements' own CompleteDataType.

To get a CompleteDataType object, call the type-appropriate static method, eg. for a Boolean CompleteDatatType object, call CompleteDataType::forBool(); for a Tuple CompleteDataType, call CompleteDataType::forTuple(s) with some Schema s; for a List CompleteDataType, call CompleteDataType::forList(cdt) with some CompleteDataType cdt; and so on.

CompleteDataTypes are immutable; once created they may not be changed.

Constructor & Destructor Documentation

◆ CompleteDataType()

sb::CompleteDataType::CompleteDataType ( const CompleteDataType cdt)
inline

Copy constructor.

◆ ~CompleteDataType()

sb::CompleteDataType::~CompleteDataType ( )
inline

Destructor.

Member Function Documentation

◆ as_string()

std::string sb::CompleteDataType::as_string ( ) const
inline

Returns a string representation of this CompleteDataType.

◆ compare()

int sb::CompleteDataType::compare ( const CompleteDataType fv) const

Compare the current CompleteDataType against the provided CompleteDataType by base type (eg DataType::BOOL, INT, ::TUPLE, etc).

Therefore, for example a LIST of type INT and a LIST of type TUPLE are equal.

Returns
-1 if the current CompleteDataType is less than the provided CompleteDataType, 0 if the current is equal to the provided CompleteDataType, and 1 if the current is greater than the provided CompleteDataType.

◆ forBlob()

static const CompleteDataType & sb::CompleteDataType::forBlob ( )
inlinestatic

Return a CompleteDataType of type DataType::BLOB.

◆ forBool()

static const CompleteDataType & sb::CompleteDataType::forBool ( )
inlinestatic

Return a CompleteDataType of type DataType::BOOL.

◆ forCapture()

static const CompleteDataType sb::CompleteDataType::forCapture ( const std::string &  captureName)
inlinestatic

Return a CompleteDataType of type DataType::CAPTURE with the given capture type name.

◆ forDouble()

static const CompleteDataType & sb::CompleteDataType::forDouble ( )
inlinestatic

Return a CompleteDataType of type DataType::DOUBLE.

◆ forFunction()

static const CompleteDataType sb::CompleteDataType::forFunction ( const Schema argumentSchema,
const CompleteDataType returnType 
)
inlinestatic

Return a CompleteDataType of type DataType::FUNCTION with the given argument schema and return type.

◆ forInt()

static const CompleteDataType & sb::CompleteDataType::forInt ( )
inlinestatic

Return a CompleteDataType of type DataType::INT.

◆ forList()

static const CompleteDataType sb::CompleteDataType::forList ( const CompleteDataType elemType)
inlinestatic

Return a CompleteDataType of type DataType::LIST with the given CompleteDataType as the type of its elements.

◆ forLong()

static const CompleteDataType & sb::CompleteDataType::forLong ( )
inlinestatic

Return a CompleteDataType of type DataType::LONG.

◆ forSimpleType()

static const CompleteDataType sb::CompleteDataType::forSimpleType ( const DataType type)
static

Convenience method.

Return the CompleteDataType appropriate to the given DataType. Invalid on DataType::TUPLE and DataType::LIST, since they require extra information to fully specify their CompleteDataType.

◆ forString()

static const CompleteDataType & sb::CompleteDataType::forString ( )
inlinestatic

Return a CompleteDataType of type DataType::STRING.

◆ forTimestamp()

static const CompleteDataType & sb::CompleteDataType::forTimestamp ( )
inlinestatic

Return a CompleteDataType of type DataType::TIMESTAMP.

◆ forTuple()

static const CompleteDataType sb::CompleteDataType::forTuple ( const Schema s)
inlinestatic

Return a CompleteDataType of type DataType::TUPLE with the given Schema.

◆ getArgumentSchema()

const Schema & sb::CompleteDataType::getArgumentSchema ( ) const
inline

If this CompleteDataType is a function, return its argument schema.

◆ getElementCompleteType()

const CompleteDataType & sb::CompleteDataType::getElementCompleteType ( ) const
inline

If this CompleteDataType has an element type, returns the element CompleteDataType.

For all other types, returns a null CompleteDataType.

Referenced by sb::Field::getElementCompleteType().

◆ getReturnType()

const CompleteDataType & sb::CompleteDataType::getReturnType ( ) const
inline

If this CompleteDataType is a function, return its return type.

◆ getSchema()

const Schema sb::CompleteDataType::getSchema ( ) const
inline

If this CompleteDataType has a nested tuple, return its Schema.

For all other types, return a null Schema.

◆ getType()

const DataType & sb::CompleteDataType::getType ( ) const
inline

Return the primitive DataType of the CompleteDataType.

◆ hasElementType()

bool sb::CompleteDataType::hasElementType ( ) const
inline

Returns true if this CompleteDataType has an element CompleteDataType (eg it is a DataType::LIST of DataType::INTs, the latter being its element type).

◆ hasSchema()

bool sb::CompleteDataType::hasSchema ( )
inline

Returns true if this CompleteDataType contains a Schema (eg it is a DataType::TUPLE).

◆ operator=()

CompleteDataType & sb::CompleteDataType::operator= ( const CompleteDataType cdt)

Assignment operator.


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