5#ifndef STREAMBASE_FIELD_H_
6#define STREAMBASE_FIELD_H_
8#include "StreamBase.hpp"
13#include "CompleteDataType.hpp"
16SB_INTERNAL_FWD(SchemaUtil);
50 Field(
const std::string &name,
DataType type,
size_t size = (
size_t)-1);
65#ifndef DOXYGEN_INTERNAL_ONLY
67 std::string as_xml()
const;
77 const std::string &
getName()
const {
return _name; }
93 const Schema& getArgumentSchema()
const {
99 return getType().getSize();
108 return _cdt == other._cdt;
111 const std::vector<Field> &getFieldPath()
const {
return _field_path; }
113#ifndef DOXYGEN_INTERNAL_ONLY
115 static const int VARLEN_HEADER_SIZE = 4;
118 static const int STRING_HEADER_SIZE = VARLEN_HEADER_SIZE;
121 static const int NESTED_TUPLE_HEADER_SIZE = VARLEN_HEADER_SIZE;
124 static const int LIST_HEADER_SIZE = VARLEN_HEADER_SIZE + 4;
128 Field(
const std::vector<Field>& field_path);
131 CompleteDataType _cdt;
134 std::vector<Field> _field_path;
136 std::string as_xml_helper(
const CompleteDataType& cdt, std::string tag, std::string name)
const;
139 friend class sb_internal::SchemaUtil;
140 friend class JavaQBox;
An object containing all the information about a data type – the primitive DataType; for DataType::TU...
Definition: CompleteDataType.hpp:29
const CompleteDataType & getReturnType() const
If this CompleteDataType is a function, return its return type.
Definition: CompleteDataType.hpp:197
const CompleteDataType & getElementCompleteType() const
If this CompleteDataType has an element type, returns the element CompleteDataType.
Definition: CompleteDataType.hpp:190
const Schema & getArgumentSchema() const
If this CompleteDataType is a function, return its argument schema.
Definition: CompleteDataType.hpp:205
A type of data in a tuple.
Definition: DataType.hpp:29
Information (name, type, and optionally size) about a field in a Schema.
Definition: Field.hpp:40
const DataType & getType() const
Returns the type of a field (e.g., DataType::INT).
Definition: Field.hpp:80
const CompleteDataType & getElementCompleteType() const
Returns the complete type of a field's elements (e.g., on a DataType::LIST of DataType::INTs,...
Definition: Field.hpp:87
const Schema getSchema() const
Returns the field's schema (valid only if the field's type is TUPLE)
Definition: Field.hpp:74
int getIndex() const
Returns the index of the field.
Definition: Field.hpp:103
Field & operator=(const Field &f)
Assignment operator.
Field(const std::string &name, const CompleteDataType &cdt)
Constructs a field.
Field(const Field &f)
Copy constructor.
Field(const std::string &name, DataType type, size_t size=(size_t) -1)
Constructs a field; deprecated.
Field()
Constructs a null (invalid) field.
std::string as_string() const
Returns a string representation of a field.
size_t getFixedSize() const
Returns the size of a field if it has a fixed size or -1.
Definition: Field.hpp:98
const CompleteDataType & getCompleteType() const
Returns the complete type of a field (e.g., DataType::LIST of DataType::INTs).
Definition: Field.hpp:83
const std::string & getName() const
Returns the name of a field.
Definition: Field.hpp:77
bool sameType(const Field &other) const
Return true if the fields are the same type (including size information)
Definition: Field.hpp:107
Field(const std::string &name, DataType type, const Schema &schema)
Constructs a field; deprecated.
A type of tuple, containing zero or more fields (each encapsulated as a Schema::Field object).
Definition: Schema.hpp:62