StreamBase C++ API  10.6.2.5
sb::FieldValue Class Reference

A value a Field may take on. More...

#include <FieldValue.hpp>

Public Member Functions

 ~FieldValue ()
 Destructor. More...
 
 FieldValue (bool value)
 DataType::BOOL constructor. More...
 
 FieldValue (int value)
 DataType::INT constructor. More...
 
 FieldValue (double value)
 DataType::DOUBLE constructor. More...
 
 FieldValue (long long value)
 DataType::LONG constructor. More...
 
 FieldValue (const Timestamp &value)
 DataType::TIMESTAMP constructor. More...
 
 FieldValue (const char *value)
 DataType::STRING constructor. More...
 
 FieldValue (const std::string &value)
 DataType::STRING constructor. More...
 
 FieldValue (const DataType &type, const std::string &value)
 DataType::STRING, DataType::BLOB, and DataType::CAPTURE constructor. More...
 
 FieldValue (const Tuple &value)
 DataType::TUPLE constructor. More...
 
 FieldValue (const Function &value)
 DataType::FUNCTION constructor. More...
 
 FieldValue (const std::vector< FieldValue > &value)
 DataType::LIST constructor. More...
 
 FieldValue (const DataType &type, const CompleteDataType &elemType)
 Create an empty list of the specified element type. More...
 
 FieldValue (const FieldValue &fv)
 Copy constructor. More...
 
const FieldValueoperator= (const FieldValue &fv)
 Assignment operator. More...
 
bool operator== (const FieldValue &t) const
 
bool operator!= (const FieldValue &t) const
 
bool operator< (const FieldValue &t) const
 
bool operator> (const FieldValue &t) const
 
bool operator<= (const FieldValue &t) const
 
bool operator>= (const FieldValue &t) const
 
int compare (const FieldValue &fv) const
 Compare the current FieldValue against the provided FieldValue. More...
 
const CompleteDataTypegetCompleteType () const
 Get the CompleteDataType of this FieldValue. More...
 
const DataTypegetType () const
 Get the primitive DataType of this FieldValue. More...
 
bool sameType (const FieldValue &fv) const
 Returns true if this FieldValue and the provided FieldValue are of the same type. More...
 
std::string as_string () const
 Return a string representation of this FieldValue. More...
 
bool isNull () const
 Return true if this FieldValue represents a null value. More...
 
bool getBool () const
 Return the value of a boolean FieldValue. More...
 
int getInt () const
 Return the value of an integer FieldValue. More...
 
double getDouble () const
 Return the value of a double FieldValue. More...
 
long long getLong () const
 Return the value of a long FieldValue. More...
 
Timestamp getTimestamp () const
 Return the value of a Timestamp FieldValue as a Timestamp. More...
 
const std::string & getString () const
 Return the value of a string FieldValue. More...
 
const std::string & getBlob () const
 Return the value of a blob FieldValue as a string. More...
 
const TuplegetTuple () const
 Return the value of a Tuple FieldValue. More...
 
const std::string & getCapture () const
 Return the value of a Capture FieldValue, as a string Will throw an exception if this FieldValue is not of type DataType::CAPTURE. More...
 
const Function & getFunction () const
 Return the value of a Function FieldValue Will throw an exception if this FieldValue is not of type DataType::FUNCTION. More...
 
TuplegetTuple ()
 Return the value of a Tuple FieldValue as a mutable Tuple. More...
 
const std::vector< FieldValue > & getList () const
 Return the value of a List FieldValue. More...
 

Detailed Description

A value a Field may take on.

Also possibly a list element. Has a type and some information of said type.

FieldValues are immutable. Calling an inappropriate getter will cause an error.

FieldValue fv(5); // this creates a FieldValue of DataType::INT
cout << fv.getInt() << "\n";
cout << fv.getBool() << "\n";

The first cout line will succeed; the second will throw an exception.

Constructor & Destructor Documentation

sb::FieldValue::~FieldValue ( )

Destructor.

sb::FieldValue::FieldValue ( bool  value)

DataType::BOOL constructor.

sb::FieldValue::FieldValue ( int  value)

DataType::INT constructor.

sb::FieldValue::FieldValue ( double  value)

DataType::DOUBLE constructor.

sb::FieldValue::FieldValue ( long long  value)

DataType::LONG constructor.

sb::FieldValue::FieldValue ( const Timestamp value)

DataType::TIMESTAMP constructor.

sb::FieldValue::FieldValue ( const char *  value)

DataType::STRING constructor.

sb::FieldValue::FieldValue ( const std::string &  value)

DataType::STRING constructor.

sb::FieldValue::FieldValue ( const DataType type,
const std::string &  value 
)

DataType::STRING, DataType::BLOB, and DataType::CAPTURE constructor.

sb::FieldValue::FieldValue ( const Tuple value)

DataType::TUPLE constructor.

sb::FieldValue::FieldValue ( const Function &  value)

DataType::FUNCTION constructor.

sb::FieldValue::FieldValue ( const std::vector< FieldValue > &  value)

DataType::LIST constructor.

sb::FieldValue::FieldValue ( const DataType type,
const CompleteDataType elemType 
)

Create an empty list of the specified element type.

sb::FieldValue::FieldValue ( const FieldValue fv)

Copy constructor.

Member Function Documentation

std::string sb::FieldValue::as_string ( ) const

Return a string representation of this FieldValue.

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

Compare the current FieldValue against the provided FieldValue.

Null FieldValues are less than non-null FieldValues. Provides a total ordering over the set of possible FieldValues, so does not check types. Ordering of FieldValues of heterogeneous types is not guaranteed but is consistent.

Returns
-1 if the current FieldValue is less than the provided FieldValue, 0 if the current is equal to the provided FieldValue, and 1 if the current is greater than the provided FieldValue.
const std::string& sb::FieldValue::getBlob ( ) const

Return the value of a blob FieldValue as a string.

Will throw an exception if this FieldValue is not of type DataType::BLOB.

bool sb::FieldValue::getBool ( ) const

Return the value of a boolean FieldValue.

Will throw an exception if this FieldValue is not of type DataType::BOOL.

const std::string& sb::FieldValue::getCapture ( ) const

Return the value of a Capture FieldValue, as a string Will throw an exception if this FieldValue is not of type DataType::CAPTURE.

const CompleteDataType& sb::FieldValue::getCompleteType ( ) const

Get the CompleteDataType of this FieldValue.

double sb::FieldValue::getDouble ( ) const

Return the value of a double FieldValue.

Will throw an exception if this FieldValue is not of type DataType::DOUBLE.

const Function& sb::FieldValue::getFunction ( ) const

Return the value of a Function FieldValue Will throw an exception if this FieldValue is not of type DataType::FUNCTION.

int sb::FieldValue::getInt ( ) const

Return the value of an integer FieldValue.

Will throw an exception if this FieldValue is not of type DataType::INT.

const std::vector<FieldValue>& sb::FieldValue::getList ( ) const

Return the value of a List FieldValue.

Will throw an exception if this FieldValue is not of type DataType::LIST.

long long sb::FieldValue::getLong ( ) const

Return the value of a long FieldValue.

Will throw an exception if this FieldValue is not of type DataType::LONG.

const std::string& sb::FieldValue::getString ( ) const

Return the value of a string FieldValue.

Will throw an exception if this FieldValue is not of type DataType::STRING.

Timestamp sb::FieldValue::getTimestamp ( ) const

Return the value of a Timestamp FieldValue as a Timestamp.

Will throw an exception if this FieldValue is not of type DataType::TIMESTAMP.

const Tuple& sb::FieldValue::getTuple ( ) const

Return the value of a Tuple FieldValue.

Will throw an exception if this FieldValue is not of type DataType::TUPLE.

Tuple& sb::FieldValue::getTuple ( )

Return the value of a Tuple FieldValue as a mutable Tuple.

Will throw an exception if this FieldValue is not of type DataType::TUPLE.

The caller takes on itself the responsibility of managing all concurrency.

const DataType& sb::FieldValue::getType ( ) const

Get the primitive DataType of this FieldValue.

bool sb::FieldValue::isNull ( ) const

Return true if this FieldValue represents a null value.

const FieldValue& sb::FieldValue::operator= ( const FieldValue fv)

Assignment operator.

bool sb::FieldValue::sameType ( const FieldValue fv) const

Returns true if this FieldValue and the provided FieldValue are of the same type.

"Of the same type" is defined as their CompleteDataType members being equivalent.


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