Skip to content

ChoiceElement

class ChoiceElement : public GenericElement<ChoiceElement>

@brief An element allowing choice-access to a list of factorized classes

The ChoiceElement can be configured to allow a choice between factorized class registered with it. Two methods exist for adding classes to the list of choices the ChoiceElement knows of:

  • ChoiceElement::appendNodesOfConfigurationBase is used if another class of a type known to the factory system is to be added

  • ChoiceElement::appendAsNode is used to append the entries of a NodeElement defined in the same expectedParameter function as the choice element

In either case, the user can select from the options during configuration

Functions

Name Description
appendNodesOfConfigurationBase Append the expected parameters of another class of type ConfigurationBase.
appendAsNode Append the entries found underneath a NodeElement identified by key.
assignmentMandatory The assignmentMandatory method serves for setting up a mode that requires the value of the element always being specified.
assignmentOptional The assignmentOptional method is used to indicate that this element can optionally be configured.
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.

Function Details

appendAsNode

template <class T> ChoiceElement& appendAsNode(const std::string& nodeName = "")

Append the entries found underneath a NodeElement identified by key. The node element needs to be defined prior to and in the same expected parameter function as the ChoiceElement.

nodeName : identifying the node, i.e. the key of the node.

Return :

appendNodesOfConfigurationBase

template <class ConfigurationBase> ChoiceElement& appendNodesOfConfigurationBase()

Append the expected parameters of another class of type ConfigurationBase. The class needs to be known by the factory system. It will be identified by its Karabo ClassId in the list of options.

Return :

assignmentMandatory

virtual ChoiceElement& 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 DefaultValue<ChoiceElement, std::string>& assignmentOptional()

The assignmentOptional method is used to indicate that this element can optionally be configured. It is followed by either specifying that noDefaulValue() exists, or the defaultValue() is a classId or node key registered in the list of choices using either ChoiceElement::appendAsNode or ChoiceElement::appendNodesOfConfigurationBase.

Return :

init

virtual ChoiceElement& 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 ChoiceElement& 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)