Skip to content

TableElement

class TableElement : public GenericElement<TableElement>

@brief The TableElement represents a vector<Hash> with fixed entries and types

The TableElement represents a vector with fixed entries and types. This means that each entry in the vector is expected to be a Hash with the same keys and same types, except for those which are set to assignment optional and have a default value.

Tables are defined by assigning a rowSchema to them, hence specifying how the Hash entries in the vector should look like. The Schema::Validator is aware of these specifications and will perform validation on these elements.

Functions

Name Description
allowedStates The allowedStates method serves for setting up allowed states for the element states : A string describing list of possible states. sep : A separator symbol used for parsing previous argument for list of states Return : reference to the Element (to allow method's chaining)
assignmentMandatory The assignmentMandatory method serves for setting up a mode that requires the value of the element always being specified.
assignmentOptional The assignmentOptional method serves for setting up a mode that allows the value of element be optional, so it can be omitted in configuration.
assignmentInternal The assignmentInternal method serves for setting up the element to be internal.
init The init method serves for setting up an access type property that allows the element to be included in initial schema.
reconfigurable The reconfigurable method serves for setting up an access type property that allows the element to be included in initial, reconfiguration and monitoring schemas.
setNodeSchema This method is deprecated.
setColumns This method establishes content of the table, i.e. table columns and their types schema : Return : reference to the Element (chaining)
addColumns This method appends additional columns to the right side of the table.
addColumnsFromClass This method appends additional columns to the table taken from some class.
sanitizeRowSchema @brief Controlling method for row schema sanitization.
sanitizeColumnsAccessModes @brief Turns reconfigurable and init columns into read-only columns when the hosting table is read-only.
sanitizeNoDefaultColumns @brief Makes sure that every non read-only column in a non read-only table has a default value set.
findUnsupportedColumnType @brief Finds, in the TableElement rowSchema, a column of an unsupported type - the TableElement supports a subset of the Leaf types for valid column types.

Function Details

addColumns

TableElement& addColumns(const Schema& schema)

This method appends additional columns to the right side of the table.

schema :

Return : reference to the Element (chaining)

addColumnsFromClass

template <class T> TableElement& addColumnsFromClass()

This method appends additional columns to the table taken from some class. The class is template parameter.

Return : reference to the Element (chaining)

allowedStates

TableElement& allowedStates(const std::vector<karabo::data::State>& value)

The allowedStates method serves for setting up allowed states for the element

states : A string describing list of possible states.

sep : A separator symbol used for parsing previous argument for list of states

Return : reference to the Element (to allow method's chaining)

assignmentInternal

virtual TableDefaultValue<TableElement>& assignmentInternal()

The assignmentInternal method serves for setting up the element to be internal. In the code it behaves like optional parameter but it is not exposed to the user. It is omitted when the schema is serialized to XSD. The value of this parameter should be defined programmatically. Conceptually, internal parameter with internal flag can be treated as an argument to the constructor.

Return : reference to DefaultValue (to allow method's chaining)

assignmentMandatory

virtual TableElement& assignmentMandatory()

The assignmentMandatory method serves for setting up a mode that requires the value of the element always being specified. No default value is possible.

Return : reference to the Element (to allow method's chaining)

assignmentOptional

virtual TableDefaultValue<TableElement>& assignmentOptional()

The assignmentOptional method serves for setting up a mode that allows the value of element be optional, so it can be omitted in configuration. Default value is injected if defined. If you chain functions for definition of expected parameters the next function may be only defaultValue or noDefaultValue. When the default value is not specified (noDefaultValue) you must always check if the parameter has a value set in delivered User configuration.

Return : reference to DefaultValue object allowing proper defaultValue method chaining.

Example:

SOME_ELEMENT(expected)
        ...
        .assignmentOptional().defaultValue("client")
        ...
        .commit();

findUnsupportedColumnType

std::pair<std::string, karabo::data::Types::ReferenceType> findUnsupportedColumnType( const karabo::data::Schema& rowSchema)

@brief Finds, in the TableElement rowSchema, a column of an unsupported type - the TableElement supports a subset of the Leaf types for valid column types.

Return : std::pair 'first' is the name of the column of the invalid type (empty string if all columns are of supported types) and 'second' is the type of the column with the invalid type (UNKNOWN if there is no column of an invalid type).

init

virtual TableElement& init()

The init method serves for setting up an access type property that allows the element to be included in initial schema.

Return : reference to the Element (to allow method's chaining)

reconfigurable

virtual TableElement& reconfigurable()

The reconfigurable method serves for setting up an access type property that allows the element to be included in initial, reconfiguration and monitoring schemas.

Return : reference to the Element (to allow method's chaining)

sanitizeColumnsAccessModes

void sanitizeColumnsAccessModes(karabo::data::Schema& rowSchema)

@brief Turns reconfigurable and init columns into read-only columns when the hosting table is read-only. When the hosting table is init or reconfigurable, turns every init column into a reconfigurable column.

sanitizeNoDefaultColumns

void sanitizeNoDefaultColumns(karabo::data::Schema& rowSchema)

@brief Makes sure that every non read-only column in a non read-only table has a default value set.

Default values are synthesized for the columns that don't have a default value. The synthesized values correspond to the default initializer of the column type (e.g. 0 for int columns, false for bool columns and empty vectors for vector<..> columns).

Throw : karabo::data::ParameterException if the synthesized column default values are incompatible with any attribute that already existed in the schema, like 'minInc' or 'minSize' or if the type of the column lacking a default value is not supported for table columns.

sanitizeRowSchema

void sanitizeRowSchema(karabo::data::Schema& rowSchema)

@brief Controlling method for row schema sanitization.

@throws karabo::data::ParameterException can be throw by some specific sanitization methods.

setColumns

TableElement& setColumns(const Schema& schema)

This method establishes content of the table, i.e. table columns and their types

schema :

Return : reference to the Element (chaining)

setNodeSchema

KARABO_DEPRECATED TableElement& setNodeSchema(const Schema& schema)

This method is deprecated. Use setColumns instead.

schema :

Return : reference to the Element (chaining)