StreamBase C++ API
7.6.2dev
|
Information (name, type, and optionally size) about a field in a Schema. More...
#include <Field.hpp>
Public Member Functions | |
Field () | |
Constructs a null (invalid) field. More... | |
Field (const std::string &name, DataType type, size_t size=(size_t)-1) | |
Constructs a field; deprecated. More... | |
Field (const std::string &name, DataType type, const Schema &schema) | |
Constructs a field; deprecated. More... | |
Field (const std::string &name, const CompleteDataType &cdt) | |
Constructs a field. More... | |
Field (const Field &f) | |
Copy constructor. More... | |
Field & | operator= (const Field &f) |
Assignment operator. More... | |
std::string | as_string () const |
Returns a string representation of a field. More... | |
const Schema | getSchema () const |
Returns the field's schema (valid only if the field's type is TUPLE) More... | |
const std::string & | getName () const |
Returns the name of a field. More... | |
const DataType & | getType () const |
Returns the type of a field (e.g., DataType::INT). More... | |
const CompleteDataType & | getCompleteType () const |
Returns the complete type of a field (e.g., DataType::LIST of DataType::INTs). More... | |
const CompleteDataType & | getElementCompleteType () const |
Returns the complete type of a field's elements (e.g., on a DataType::LIST of DataType::INTs, returns a CompleteDataType of DataType::INT). More... | |
const CompleteDataType & | getReturnType () const |
const Schema & | getArgumentSchema () const |
size_t | getFixedSize () const |
Returns the size of a field if it has a fixed size or -1. More... | |
int | getIndex () const |
Returns the index of the field. More... | |
bool | sameType (const Field &other) const |
Return true if the fields are the same type (including size information) More... | |
const std::vector< Field > & | getFieldPath () const |
Information (name, type, and optionally size) about a field in a Schema.
A field can be looked up within a schema in three ways:
A Field object can be used to obtain the value of a field in a tuple. However, there are rules that must be obeyed in doing so. For example, one must obtain the Field object from a Schema object that describes the schema of the tuple (i.e., as opposed to directly from a Field constructor).
See the "client" StreamBase sample (streambase-install-dir/sample/client) for examples of proper use of Field objects.
sb::Field::Field | ( | ) |
Constructs a null (invalid) field.
sb::Field::Field | ( | const std::string & | name, |
DataType | type, | ||
size_t | size = (size_t)-1 |
||
) |
Constructs a field; deprecated.
Constructs a field; deprecated.
sb::Field::Field | ( | const std::string & | name, |
const CompleteDataType & | cdt | ||
) |
Constructs a field.
sb::Field::Field | ( | const Field & | f | ) |
Copy constructor.
std::string sb::Field::as_string | ( | ) | const |
Returns a string representation of a field.
|
inline |
Returns the complete type of a field (e.g., DataType::LIST of DataType::INTs).
|
inline |
Returns the complete type of a field's elements (e.g., on a DataType::LIST of DataType::INTs, returns a CompleteDataType of DataType::INT).
References sb::CompleteDataType::getElementCompleteType().
|
inline |
Returns the size of a field if it has a fixed size or -1.
|
inline |
Returns the index of the field.
|
inline |
Returns the name of a field.
|
inline |
Returns the field's schema (valid only if the field's type is TUPLE)
|
inline |
Returns the type of a field (e.g., DataType::INT).
|
inline |
Return true if the fields are the same type (including size information)