data
Namespace for package util Namespace for package devices Namespace for package io Namespace for package io
details :
Types
| Name | Description |
|---|---|
| AbstractInput | @bried The AbstractInput class is the base for input classes in Karabo Their specific implementation defines how the input acquires data. |
| AccessLevel | An enum specifying the access-level needed to view or alter elements. |
| AlarmCondition | @brief A unified alarm condition class, which holds the alarm conditions known to Karabo |
| AlarmConditionElement | The AlarmConditionElement represents a leaf and needs to be of type AlarmCondition |
| ArchivePolicy | An enum specifying the archiving interval for updates to elements |
| AssemblyRules | The AssemblyRules specify how the karabo::data::Configurator assembles the configuration |
| AssignmentType | An enum specifying assignment restrictions for elements |
| BinaryFileInput | @brief The binary file input specializes the Input class to read data from a binary file types T have been serialized to. |
| BinaryFileOutput | @brief The binary file output specializes the Output class to write data of type T to a binary file. |
| BinarySerializer | |
| BufferSet | |
| CastException | The CastException handles exceptions that are raised due to illegal type castings |
| 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. |
| Configurator | @brief The Configurator provides for creating and configuring factorized classes. |
| CudaException | The CudaException handles exceptions that are caused by the NVIDIA CUDA runtime |
| CustomNodeElement | Helper class to construct custom NODE_ELEMENTs for schemas. |
| DAQPolicy | An enum specifying the DAQ storage policy |
| DateTimeString | This class expresses a valid date and time information in the form of a char string. |
| DefaultValue | The DefaultValue class defines a default value for element. |
| Dims | @brief A class describing array dimensions |
| DoocsException | DoocsException |
| Element | @brief Class representing leaf elements in a Hash which may have attributes |
| Epochstamp | This class expresses a point in time and holds its value in the form of two unsigned 64bit. |
| Factory | @brief A factory for managing Karabo classes The factory uses something like a hidden (private) Singleton-Pattern. |
| FileNotFoundIOException | FileNotFoundIOException |
| FromType | @brief Returns a karabo::data::Types::ReferenceType from an alternate representation as specified by the template parameter, e.g. FromType |
| GenericElement | The GenericElement class is a base class for various element types: simple, vector, choice, list and single. |
| HardwareException | The HardwareException handles exceptions that are caused by any connected hardware |
| HashBinarySerializer | @brief The HashBinarySerializer provides an implementation of BinarySerializer for the karabo::data::Hash While a karabo::data::Hash can in principle hold arbitrary data types, Hash serialization is limited to data types known to the karabo::data::Types type system. Hashes containing other data types will lead to exceptions during serialization. |
| HashFilter | @brief This class provides methods to filter a configuration Hash by properties of the Schema describing it |
| HashXmlSerializer | @brief The HashXmlSerializer provides an implementation of TextSerializer for the karabo::data::Hash While a karabo::data::Hash can in principle hold arbitrary data types, Hash serialization is limited to data types known to the karabo::data::Types type system. Hashes containing other data types will lead to exceptions during serialization. |
| IOException | The IOException handles exceptions raised related to Input/Output routines |
| ImageDimensionException | The ImageDimensionException handles exceptions raised due to illegal image dimensions |
| ImageException | The ImageException handles an generic image exception |
| ImageFormatException | The ImageFormatException handles exceptions raised due to unsupported image formats |
| ImageTypeException | The ImageTypeException handles exceptions raised due to imcompatible image types |
| InitException | The InitException handles exceptions raised during any initialization procedures |
| Input | @brief The Input class provides a datatype T specific base for inputs in the Karabo system. |
| InputHandler | @brief The InputHandler class is the base class for registering and accessing I/O and end of stream input handlers |
| KARABO_DECLSPEC | The Schema class correlates to the Hash class like an XML Schema document correlates to an XML document. |
| KARABO_DECLSPEC | @brief ClassInfo holds meta-data to a factorized class |
| KARABO_DECLSPEC | @brief A generic key value container that supports ordering and attributes. |
| KARABO_DECLSPEC | @brief Karabo's main exception class. |
| LeafElement | The LeafElement represents a leaf and can be of any (supported) type |
| LeafType | An enum specifying the type of Leaf-like elements |
| LockException | The LockException handles exceptions that result from not being able to acquire a lock |
| LogicException | The LogicException handles exceptions that are raised by any unexpected logical behaviour |
| MemoryInitException | The MemoryInitException handles exceptions raised during any memory initializations |
| MessageException | The MessageException handles exceptions that are caused during messaging |
| NDArray | @brief A class representing multi-dimensional data in Karabo that seaminglessy converts to numpy.ndarray The NDArray class is intended to store any multidimensional data occurring in Karabo. Internally it holds the data in a ByteArray. It is a Hash-derived structure, which means it serializes into a karabo::data::Hash. Its meta-data is chosen such that it can be seamlessly converted into a numpy.ndarray Internally (i.e. relevant only for serialisation), it holds the following keys: - "data": a ByteArray - "shape": a vector |
| NetworkException | The NetworkException handles exceptions that are caused by network protocol related libraries (BoostAsio, SNMP, ...) |
| NodeElement | @brief The NodeElement groups other elements into a hierarchy The NodeElement can be used to create hierarchies in the expected parameter section of a device. |
| NodeType | An enum specifying the type of Node-like elements (NodeElement, ChoiceElement) |
| NotImplementedException | The NotImplementedException handles exceptions that are raised due to unimplemented functions/class calls |
| NotSupportedException | The NotImplementedException handles exceptions that are raised by requesting unsupported features |
| OrderedMap | @brief a associative key-value container maintaining insertion order The OrderedMap provides for an insertion-order aware key-value container which has similar access, modification and query methods as std::map. The differences are that knowledge of insertion order is maintained, values may be of different and any type and iterator for both key and insertion order are provided. |
| Output | @brief The Output class provides a base for outputs in the Karabo system. |
| OverwriteElement | @brief The OverwriteElement allows to overwrite/redefine Element properties of an existing Element of a base class in a derived class. |
| ParameterException | The ParameterException handles exceptions that result from missing or out-of-bounds parameter |
| PropagatedException | The PropagatedException handles exceptions that reflect anonymous nodes within a exception trace |
| PythonException | PythonException |
| ReadOnlySpecific | The ReadOnlySpecific class defines specific values for 'readOnly'-element. |
| ReconfigureException | The HardwareException handles exceptions that are caused by any connected hardware |
| RemoteException | The RemoteException represents an exception originating in a different device. |
| SchemaBinarySerializer | @brief The SchemaBinarySerializer provides an implementation of BinarySerializer for the karabo::data::Schema |
| SchemaException | The SchemaException handles exceptions that are raised whilst constructing a Schema |
| SchemaXmlSerializer | @brief The SchemaXmlSerializer provides an implementation of TextSerializer for the karabo::data::Hash |
| SignalSlotException | The HardwareException handles exceptions that are caused by any connected hardware |
| SimpleElement | @brief The SimpleElement represents a leaf and can be of any (supported) type |
| State | @brief A class representing unified states accross the Karabo system. |
| StateElement | @brief The StateElement represents a leaf and needs to be of type State |
| StateSignifier | @brief The StateSignifier is used to evaluate the most significant State from a set of States |
| SystemException | The SystemException handles exceptions raised related to Input/Output routines |
| TableDefaultValue | @brief The TableDefaultValue class defines a default value for the TableElement. |
| TableElement | @brief The TableElement represents a vector |
| TextFileInput | @brief The text file input specializes the Input class to read data from a text file types T have been serialized to. |
| TextFileOutput | @brief The text file output specializes the Output class to write data of type T to a text file. |
| TextSerializer | |
| TimeDuration | This class represents the time duration (length) between two time points The value is hold in form of two unsigned 64bit values. |
| TimePeriod | This class models a time period expressed by two time points, i.e. start and stop. The default constructor create a time period of length zero, i.e. start=stop. |
| TimeoutException | The TimeoutException handles exceptions that are caused by time out events |
| Timestamp | This class expresses a time point and holds it in form of an Epochstamp and Trainstamp |
| Trainstamp | This class expresses a time point and holds it in form of one unsigned 64bit value. |
| Types | @brief This class contains the types knonw to the Karabo framework as members and conversion tools for these |
| Validator | @brief The Validator valididates configurations against Schemata The Validator class validates configurations stored in a Hash against a Schema describing the Hash. |
| VectorElement | @brief The VectorElement can be used to hold a sequence of SimpleElements |
| Widen | This class is taken from http://www.c-plusplus.de/forum/168607 |
Macros
| Name | Description |
|---|---|
| KARABO_REGISTER_CONFIGURATION_BASE_CLASS | If we are importing symbols from a dll in windows, we have to tell the compiler that he should use a single "version" of our templated factory only. |
| KARABO_REGISTER_FACTORY_BASE_CLASS | If we are importing symbols from a dll in windows, we have to tell the compiler that he should use a single "version" of our templated factory only. |
Variables
| Name | Description |
|---|---|
| tableValidationRules | Validation rules to be used when table elements in Hash are merged. |
Operators
| Name | Description |
|---|---|
| operator+= | Destructor Copy constructor Assignment of "lvalue" Move constructor Assignment of "rvalue" Merge the current hash with another one other : Hash object |
| operator-= | Subtract another hash from the current one other : Hash object |
| operator<< | Default output using help function key : Return : |
| operator<< | Serialize a hash to standard std::ostream object visitor : |
| operator<< | Automatic output using the << operator |
| operator== | Checks if this Hash is similar to other. |
Functions
| Name | Description |
|---|---|
| Hash | Default constructor creates an empty hash Example: Hash hash; Use this constructor to create a hash with one key/value pair where value is just an empty hash key : Name of empty child Example: The code like this ... Hash hash(myKey); ... is equivalent to ... Hash hash(myKey, Hash()); Constructor for different numbers of key-value pairs as arguments Create and initialize a hash with multiple key-value pairs in a single call, supporting also move semantics key1 : A string hash key value1 : Any object as (r- or l-)value key2 : Optionally another key value2 : Optionally another object as (r- or l-)value ... Example: Hash hash("firstKey", 1, "secondKey", 2, "thirdKey", 3, "fourthKey", 4, "fifthKey", 5, "sixthKey", 6); |
| addToTrace | Adds exception information to trace for current thread |
| aliasHasKey | Check if a key with alias exists alias : Return : |
| base64Decode | Base64 decode a string in : out : vector of bytes |
| base64Encode | Base64 encode bytes bytes_to_encode : len : Return : |
| begin | Insertion order iterator (i.e. list iterator) |
| bindPointer | Bind a (newly created) object in the map into and external variable Optimization: This is useful in order to avoid the later copy of the value into std::any, in the hash::set(key, value). This function provides a pointer to the object in the map where you can build your data directly. key : A string hash key Return : A pointer to the internal object Example: int* value = set<int>("key"); *value = 10; |
| bindReference | Bind a (newly created) object in the map into and external variable Optimization: This is useful in order to avoid the later copy of the value into std::any, in the hash::set(key, value). This function provides a reference to the object in the map where you can build your data directly. key : A string hash key Return : A reference to the internal object !!! example vector<string>& vec = set<vector<string> >("key"); vec.resize(20); vec[1] = "a string"; |
| clear | Remove all the keys from the hash Return : No |
| clearTrace | Clears the trace of memorized messages for current thread |
| createCastFailureMessage | Create a cast failure message for a Hash key when trying to cast to a different value type key : the message pertains to src : typeinfo of source type, i.e. type of the value in the Hash tgt : typeinfo of target type, i.e. type to which the cast failed Return : the failure message |
| createTypeMismatchMessage | @brief Creates a type mismatch message for an attempt to get a Hash node value with a type different from the current type of the node. |
| detailedMsg | This function returns the full error stack with all information. |
| details | The details of the exception - without trace. |
| empty | Check if the Schema is empty Return : |
| empty | Check if the hash contains any keys or not. |
| erase | Remove the element identified by 'path' if it exists. |
| erase | Remove element identified by map_iterator of this Hash. |
| erasePath | Remove the element identified by 'path' if it exists. |
| find | Lookup for the hash element identified by "path". |
| flatten | Flattens a hierarchical Hash into "one-level", flat Hash object Return : A Hash having keys that are all leaves |
| format | Formats the exception content os : Any output stream to that the exception content will be added exceptionInfo : Content of an exception, See : ExceptionInfo stuct |
| fromString | The generic fromString method tries to obtain a value of type T using a boost::lexical_cast of the passed value. value : Return : |
| fromString | For integer return values the lowever overhead method strtol is used value : Return : |
| fromString | A string "None" can be cast to karabo::data::CppNone. Any other string representation may not! value : Return : |
| fromString | Bytearrays can be constructed from strings where each character in the string represents a byte (char) in the array value : Return : |
| fromString | Sequence type elements can be constructed from strings of the form [ value1, value2, ..., valueN ] where the enclosing brackets ([]) are optional and other separators may be specified. The sequence elements must have a StringTools:fromString method for their type T and each element must be castable to T using this method. value : separator : if separator other than the comma (,) is used Return : |
| fromString | Vectors of unsigned char elements can be constructed directly from strings where character of the string represents a byte of the vector. |
| fromString | Vectors of char elements can be constructed directly from strings where character of the string represents a byte of the vector. |
| fromStringForSchemaOptions | XXX: This function is working around the surprising behavior of fromstring |
| fullyEquals | Checks if this Hash is equal to other. |
| get | Retrieve a constant reference to the value of element identified by 'key' key : A string key Return : The associated value !!! note Differently from Hash::getAs, Hash::get (and its overloads) doesn't perform any conversion while retrieving a node value. If the node type specified on the get call doesn't match the actual node type, a cast exception will be thrown. |
| get | Retrieve a (non-const) reference to the stored value of a given key key : A string key Return : The associated value |
| get | Retrieve (non-const) reference to the stored value into second parameter key : A string key value : Any object that will be filled by reference Return : void |
| getAccessMode | Get the access mode for the element identified by path path : Return : maps to the Schema::AccessMode enum |
| getAliasAsString | Get the alias for path as string. |
| getAliasFromKey | Get the alias mapping to the key at path. |
| getAllowedActions | Get allowed actions of given element if available. |
| getAllowedStates | Get the allowed states set for the element identified by path path : Return : |
| getArchivePolicy | Get the archive policy for the element identified by path. |
| getAs | Casts the the value of element identified by "path" from its original type to another different target type. |
| getAssemblyRules | Get the assembly rules of this schema Return : |
| getAssignment | Get the assignment type for the element identified by path path : Return : |
| getAttribute | Return the value of the attribute called "attribute" of the element identified by "path" path : attribute : separator : Return : bool |
| getAttributeAs | Casts the value of the attribute called "attribute" of the element identified by "path" from its original type to another different target type. |
| getAttributeAsAny | Return the value of the attribute called "attribute" of the element identified as std::any. path : attribute : separator : Return : std::any |
| getAttributes | Return the list of attributes of the element identified by "path" path : separator : Return : Hash::Attributes |
| getClassId | Get the classId for the element identified by path path : Return : |
| getClassId | Return the Karabo ClassId of this class Return : |
| getClassName | Return the C++ class name of this class Return : |
| getCustomNodeClass | Get the class name for a given custom node element Result is undefined if path does not point to a custom node element (may e.g. throw or not), so better check isCustomNode before. path : of custom node element |
| getDAQPolicy | Get the DAQ policy for the element identified by path. |
| getDaqDataType | Get the DAQ data type for a given node element path : |
| getDeepPaths | Returns all root-to-leaves paths in hash in the provided container (vector, list, ...) In contrast to getPaths, inserted data of C++ objects with protected inheritance from Hash (NDarray, ImageData) ar not treated as atomic, but as another Hash level result : container to which paths get appended (it is not cleared before) separator : to glue keys of the hierarchy levels |
| getDeepPaths | Returns all root-to-leaves paths in hash in the provided set In contrast to getPaths, inserted data of C++ objects with protected inheritance from Hash (NDarray, ImageData) ar not treated as atomic, but as another Hash level result : container to which paths get appended (it is not cleared before) separator : to glue keys of the hierarchy levels |
| getDeepPaths | Returns all root-to-leaves paths in hash in the provided set In contrast to getPaths, inserted data of C++ objects with protected inheritance from Hash (NDarray, ImageData) ar not treated as atomic, but as another Hash level separator : to glue keys of the hierarchy levels Return : vector of all deep paths |
| getDefaultDAQPolicy | Get the default DAQ policy to use if not specified per element |
| getDefaultValue | Get the default value set for the element identified by path. |
| getDefaultValueAs | Get the default value set for the element identified by path. |
| getDefaultValueAs | Get the default value set for the element identified by path. |
| getDescription | Get the description for the element identified by path path : Return : |
| getDisplayType | Get the display type for the element identified by path path : Return : |
| getDisplayedName | Set the displayed name for the element identified by path path : Return : |
| getIODataType | Get the I/O datatype for type T in terms of the Karabo class id Return : |
| getKeyFromAlias | Get the key the alias maps to. |
| getKeys | Returns all keys in the schema (no recursion) Keys in inner-structures are not provided level : from which to start the traversal Return : array of strings |
| getKeys | Returns all first level keys of the hash in the provided container (vector, list, ...) No recursion, i.e. keys in inner hashes are not included container : that the keys are appended to (it is not cleared before) |
| getKeys | Returns all first level keys of the hash in the provided set No recursion, i.e. keys in inner hashes are not included result : that the keys are inserted into (it is not cleared before!)) |
| getKeys | Returns all first level keys of the hash as a vector |
| getLogCategory | Return the LogCategory for this class Return : |
| getMax | Set the maximum number of nodes needed in a list element path : value : |
| getMaxExc | Get the maximum exclusive restriction for setting values to the element identified by path. |
| getMaxExcAs | Get the maximum exclusive restriction for setting values to the element identified by path. |
| getMaxInc | Get the maximum inclusive restriction for setting values to the element identified by path. |
| getMaxIncAs | Get the maximum inclusive restriction for setting values to the element identified by path. |
| getMaxSize | Get the maximum size restriction for setting sequence values to the element identified by path. |
| getMetricPrefix | Get the metric prefix set for the element identified by path. |
| getMetricPrefixName | Get the metric prefix name for the element identified by path. |
| getMetricPrefixSymbol | Get the metric prefix symbol for the element identified by path. |
| getMin | Get the minimum number of nodes needed for the element identified by path path : Return : |
| getMinExc | Get the minimum exclusive restriction for setting values to the element identified by path. |
| getMinExcAs | Get the minimum exclusive restriction for setting values to the element identified by path. |
| getMinInc | Get the minimum inclusive restriction for setting values to the element identified by path. |
| getMinIncAs | Get the minimum inclusive restriction for setting values to the element identified by path. |
| getMinSize | Get the minimum size restriction for setting sequence values to the element identified by path. |
| getNamespace | Return the C++ name space of this class Return : |
| getNode | Return the internal Hash node element designated by "path" path : separator : Return : Hash::Node element |
| getNodeType | Get the node type of the element identified by path. |
| getOptions | Get the options set for the element identified by path path : Return : |
| getParameterHash | Get a Hash representation of this Schema. |
| getPaths | Returns all root-to-leaves paths of the schema Return : array of strings |
| getPaths | Returns all root-to-leaves paths in hash in the provided container (vector, list, ...) This function goes recursively through the whole hash and the returned paths are their keys "glued" together via the given separator result : container to which paths get appended (it is not cleared before) separator : to glue keys of the hierarchy levels |
| getPaths | Returns all root-to-leaves paths in hash in the provided set This function goes recursively through the whole hash and the returned paths are their keys "glued" together via the given separator result : set into which paths get inserted (it is not cleared before) separator : to glue keys of the hierarchy levels |
| getPaths | Returns all root-to-leaves paths in hash as vectorseparator : to glue keys of the hierarchy levels Return : vector of all paths |
| getRequiredAccessLevel | Get the required access level for the element identified by path path : Return : maps to the Schema::AccessLevel enum |
| getRootName | Get the schema's root element's name Return : |
| getSkipValidation | Check if the element identified by path is set to skip validation path : Return : |
| getTags | Get the tags for the element identified by path path : Return : |
| getType | Function to obtain value type information key : The key to the value of which type information should be returned Return : The typeId as defined in See : Types.hh |
| getUnit | Get the unit set for the element identified by path. |
| getUnitName | Get the unit name for the element identified by path. |
| getUnitSymbol | Get the unit symbol for the element identified by path. |
| getValueType | Get the valuetype of the element at path. |
| getVersion | Return the version number of this class - currently does not convey much meaning. |
| has | Check if a given path exists in the Schema path : Return : |
| has | Check if the key 'key' exist in hash key : A string hash key Return : true if key exists, false otherwise |
| hasAccessMode | Check if the element identified by path has an access mode set path : Return : |
| hasAllowedActions | Check if given element has allowed actions. |
| hasAllowedStates | Check if the element identified by path has allowed states set path : Return : |
| hasArchivePolicy | Check if the element identified by path has an archive policy set path : Return : |
| hasAssignment | Check if the element identified by path has a assignment type set path : Return : |
| hasAttribute | ********* Attributes manipulation ********* Check if the element identified by "path" has an attribute called "attribute" path : attribute : separator : Return : bool |
| hasClassId | Check if the element identified by path has a classId path : Return : |
| hasDAQPolicy | Check if the element identified by path has an DAQ policy set path : Return : |
| hasDaqDataType | Check if a DAQ data type has been set for a given element. |
| hasDefaultValue | Check if the element identified by path has a default value set `` : |
| hasDescription | Check if the element identified by path has a description set path : Return : |
| hasDisplayType | Check if the element identified by path has a display type set path : Return : |
| hasDisplayedName | Check if the element identified by path has a displayed name set path : Return : |
| hasMax | Check if the element identified by path has a maximum number of Nodes set path : Return : |
| hasMaxExc | Check if a maximum exclusive restriction for setting values to the element identified by path has been set path : Return : |
| hasMaxInc | Check if a maximum inclusive restriction for setting values to the element identified by path has been set path : Return : |
| hasMaxSize | Check if a maximum size restriction for setting sequence values to the element identified by path has been set path : Return : |
| hasMetricPrefix | Check if the element identified by path has an metric prefix set path : Return : |
| hasMin | Check if the element identified by path has a minimum number of Nodes set path : Return : |
| hasMinExc | Check if a minimum exclusive restriction for setting values to the element identified by path has been set path : Return : |
| hasMinInc | Check if a minimum inclusive restriction for setting values to the element identified by path has been set path : Return : |
| hasMinSize | Check if a minimum size restriction for setting sequence values to the element identified by path has been set path : Return : |
| hasNodeType | Check if the element at path has one of the node element types (NodeElement, ChoiceElement) path : Return : |
| hasOptions | Check if the element identified by path has options set path : Return : |
| hasTags | Check if the element identified by path has tags set path : Return : |
| hasUnit | Check if the element identified by path has an unit set path : Return : |
| help | Help function to show all parameters |
| is | Predicate function calculating if the type of the value associated with the key is of a specific type in template parameter key : The key having associated value and the type of this value we want to test against template parameter Return : true or false |
| is | Predicate function calculating if the value associated with key is of type type. |
| isAccessInitOnly | Check if the element identified by path is init-only path : Return : |
| isAccessReadOnly | Check if the element identified by path is read-only path : Return : |
| isAccessReconfigurable | Check if the element identified by path is reconfigurable path : Return : |
| isAssignmentInternal | Check if the element identified by path is assignment internal path : Return : |
| isAssignmentMandatory | Check if the element identified by path is assignment mandatory path : Return : |
| isAssignmentOptional | Check if the element identified by path is assignment optional path : Return : |
| isChoiceOfNodes | Check if the element at path is of Choice-of-Nodes type path : Return : |
| isCommand | Check if the element at path is a command path : Return : |
| isCustomNode | Check if given element is a custom node like IMAGEDATA or NDARRAY_ELEMENT. |
| isLeaf | Check if the element at path is of Leaf-type path : Return : |
| isNode | Check if the element at path is of Node-Element-type path : Return : |
| isOrphaned | True if node's key points to a subnode whose parent does not exist or is of inappropriate node type. |
| isProperty | Check if the element at path is a property path : Return : |
| keyHasAlias | Check if an alias has been set for path path : Return : |
| keyIsPrefixOfAnyPath | True if the first key (separated by 'separator') of any of 'paths' matches 'key'. |
| loadFromFile | Load an object of class T from a file. |
| loadFromFile | Load a buffer from a file buffer : filename : |
| mbegin | Alpha-numeric order iterator (i.e. map iterator) |
| memorize | Use this function if you want to just memorize the exception but keep on running. |
| merge | Merges another schema into the current one schema : Another schema to be merged |
| merge | Merges another hash into this one Creates new nodes, if they do not already exists. |
| mergeAttributes | Merge 'attrs' to 'targetNode' according to merge 'policy'. |
| mergeTableElement | Merge two vector |
| msg | Explicit output function. |
| saveToFile | Save an object of class T to a file. |
| saveToFile | Save a buffer into a file buffer : filename : |
| selectChildPaths | Out of 'paths' select those that belong to child with 'childKey', e.g. out of ["a", "b.c", "b.d.e"] return ["c", "d.e"] if childKey == "b" and separator == k_defaultSep. |
| selectIndicesOfKey | For all 'paths', check whether their first key matches 'key' (as in keyIsPrefixOfAnyPath). |
| set | @brief Insert key/value pair in current container. |
| setAccessMode | Set the access mode for the element identified by path path : value : |
| setAlias | Set an alias for path path : value : |
| setAllowedActions | Specify one or more actions that are allowed on the element. |
| setAllowedStates | Set new allowed states for the element identified by path path : s1 : |
| setArchivePolicy | Set the archive policy for the element identified by path path : value : |
| setAssemblyRules | Set the assembly rules for this schema rules : |
| setAssignment | Set the assignment type for the element identified by path path : value : |
| setAttribute | Set the value of an attribute called "attribute" of the element identified by "path" path : attribute : value : separator : |
| setAttribute | Set the value of an attribute called "attribute" of the element identified by "path" path : attribute : value : separator : |
| setAttributes | Assign of list of attributes (i.e. Hash::Attributes container) to the element identified by "path" path : attributes : separator : |
| setAttributes | Assign of list of attributes (i.e. Hash::Attributes container) to the element identified by "path" path : attributes : to move from separator : |
| setDAQPolicy | Set the DAQ policy for the element identified by path path : value : |
| setDaqDataType | Set the DAQ data type for a given node element. |
| setDefaultDAQPolicy | Set the default DAQ policy to use if not specified per element. |
| setDefaultValue | Set the new default value for the element identified by path path : value : |
| setDescription | Set the description for the element identified by path path : value : |
| setDisplayType | Set the display type for the element identified by path path : value : |
| setDisplayedName | Set the displayed name for the element identified by path path : value : |
| setHash | Internal helper to avoid code duplication for template specialisations of set(path, hashValue, separator). |
| setMax | Set the maximum number of nodes needed in a list element path : value : |
| setMaxExc | Set the maximum exclusive restriction for setting values to the element identified by path path : value : |
| setMaxInc | Set the maximum inclusive restriction for setting values to the element identified by path path : value : |
| setMaxSize | Set the maximum size restriction for setting sequence values to the element identified by path path : value : |
| setMetricPrefix | Set the metric prefix for the element identified by path path : value : |
| setMin | Set the minimum number of nodes needed in a list element path : value : |
| setMinExc | Set the minimum exclusive restriction for setting values to the element identified by path path : value : |
| setMinInc | Set the minimum inclusive restriction for setting values to the element identified by path path : value : |
| setMinSize | Set the minimum size restriction for setting sequence values to the element identified by path path : value : |
| setMulti | Set an arbitray number of key/value pairs, internally using Hash::set(..) with the default separator |
| setMulti | End point for setMulti(..) with variadic templates |
| setNode | Clone the content (key, value, attributes) of another elements. |
| setOptions | Set options for the element identified by path. |
| setParameterHash | Set the parameter hash of the schema. |
| setParameterHash | Set (with move semantics) the parameter hash of the schema. |
| setRequiredAccessLevel | Set the required access level for the element identified by path path : value : |
| setRootName | St the schema's root element's name rootName : |
| setSkipValidation | Set the element identified by path to skip validation path : value : |
| setTags | Set the tags for the element identified by path path : value : |
| setUnit | Set the unit for the element identified by path path : value : |
| showTrace | Shows all memorized messages. |
| size | ********* Provide same interface as STL ********* Return the number of key elements in the hash Return : size_t |
| split | Split input string using delimiter (default = space) into vector of strings. |
| subSchema | Retrieve a sub-schema of the schema subNodePath : path of the node element to retrieve sub schema from filterTags : optional tags to filter sub schema by Return : a sub-schema of this schema. |
| subSchemaByPaths | Retrieves a sub-schema with given paths A path to a node means that all further nested paths are kept paths : in the schema whose information should be copied to the resulting sub schema Return : reduced schema |
| subSchemaByRules | Retrieve a sub-schema of those paths that fulfill given rules rules : assemby rules: - if their state field is emtpy, accept all states - similarly, default accessLevel -1 means do not care |
| subtract | Subtracts from current hash all nodes that can be found in other hash given as argument. |
| toString | Return a string representation of a value of type T. |
| toString | Floats are output to their maximum precision of 7 digits value : Return : |
| toString | Doubles are output to their maximum precision of 15 digits value : Return : |
| toString | Complex floats are output to their maximum precision of 7 digits value : Return : |
| toString | Complex doubles are output to their maximum precision of 15 digits value : Return : |
| toString | Vector values are output as a comma separated list, where the StringTools::toString method for their value type T defines the representation of each element value : is the vector to be converted maxElementsShown : is the maximum number of vector elements treated. If value.size() is larger, skip elements in the middle. Default is 0 which means no skipping of elements. Return : |
| toString | Byte array is output as a hexadecimal string (short) value : ByteArray object maxBytesShown : max. number of bytes to be presented Return : string representation of ByteArray |
| toString | String vector values are output as a comma separated list. |
| toString | Pointers with size information given as a std::pair of pointer and size are output like vectors (see StringTools::toString(const std::vectorvalue : Return : |
| toString | An NDArray is output in a flattened representation using StringTools::toString(const std::pairvalue : Return : |
| toString | A std::set is output as a list of comma (,) separated values value : Return : |
| toString | A std::unordered_set is output as a list of comma (,) separated values value : Return : |
| toString | A std::deque is output as a list of comman (,) separated values value : Return : |
| toString | A std::map is output in the form { key1 : value1, key2: value2, ... } value : Return : |
| toString | States are output using their stringified name value : Return : |
| toString | Small helper function |
| tokenize | Split a string into its components separated by any of the given delimiters inputString : tokens : output container - will never be empty delimiters : each char in this C-style string indicates the end of a substring |
| tokenize | Split a string into its components separated by the given delimiter inputString : tokens : output container - will never be empty delimiter : |
| type | The type of the exception |
| unflatten | Arranges flat Hash object in a hierarchy using separator symbol (default: ".") during parsing the keys to recognize a hierarchy sep : An optional separator symbol (default: ".") Return : A Hash object containing keys with no separator symbols |
| updateAliasMap | This function updates the internal mapping between keys and their aliases The function must be called after de-serialization in order to construct the proper inner structure |
| userFriendlyMsg | This function is intended to be used for example in GUIs. |
| visit | Implement the visitor pattern visitor : Return : bool |
| what | Overrides std::exception. Same as detailedMsg() except returning 'const char*', not 'std::string'. The returned pointer is valid as long as exception object is alive or until what() is called again. Also clears the exception stack. |
| ~Exception | Constructor using message, exception type, filename, function name, line number and possible detailsMsg Destructor |
| ~Schema | Constructs empty schema for given classId classId : The factory key of the configurable class (will be stored outside the inner hash) rules : Assembly rules if the schema is assembled from a class configurations (filters access modes, states and access rights) |
Macro Details
KARABO_REGISTER_CONFIGURATION_BASE_CLASS
#define KARABO_REGISTER_CONFIGURATION_BASE_CLASS(className)
If we are importing symbols from a dll in windows, we have to tell the compiler that he should use a single "version" of our templated factory only. This happens through KARABO_TEMPLATE_DLL which resolves to "extern" in case of dll import. If karaboFramework is compiled into a dll, the symbols are exported, if we have an application linking against the karabo dll, the symbols are imported and templates must be flagged extern!
KARABO_REGISTER_FACTORY_BASE_CLASS
#define KARABO_REGISTER_FACTORY_BASE_CLASS(className)
If we are importing symbols from a dll in windows, we have to tell the compiler that he should use a single "version" of our templated factory only. This happens through KARABO_TEMPLATE_DLL which resolves to "extern" in case of dll import. If karaboFramework is compiled into a dll, the symbols are exported, if we have an application linking against the karabo dll, the symbols are imported and templates must be flagged extern!
Variable Details
tableValidationRules
extern const Validator::ValidationRules tableValidationRules
Validation rules to be used when table elements in Hash are merged.
Operator Details
operator+=
Hash& operator+=(const Hash& other)
Destructor Copy constructor Assignment of "lvalue" Move constructor Assignment of "rvalue" Merge the current hash with another one
other
: Hash object
operator-=
Hash& operator-=(const Hash& other)
Subtract another hash from the current one
other
: Hash object
operator<<
KARABO_DECLSPEC friend std::ostream& operator<<(std::ostream& os, const Schema& schema)
Default output using help function
key
:
Return :
friend std::ostream& operator<<(std::ostream& os, const Hash& hash)
Serialize a hash to standard std::ostream object
visitor
:
KARABO_DECLSPEC friend std::ostream& operator<<(std::ostream& os, const Exception& Exception)
Automatic output using the << operator
operator==
bool operator==(const Hash& other) const
Checks if this Hash is similar to other.
A Hash is considered similar to another if both have the same number of elements, of the same type and in the same order.
other
: the Hash this Hash will be compared to.
Return : true if both hashes are similar.
Note
: this is not the full equality operator as the values of the elements are not considered.
Function Details
Hash
template <typename V1, typename... Args> Hash(const std::string& path1, V1&& value1, Args&&... args)
Default constructor creates an empty hash
Example:
Hash hash;
key
: Name of empty child
Example: The code like this ...
Hash hash(myKey);
Hash hash(myKey, Hash());
key1
: A string hash key
value1
: Any object as (r- or l-)value
key2
: Optionally another key
value2
: Optionally another object as (r- or l-)value
...
Example:
Hash hash("firstKey", 1, "secondKey", 2, "thirdKey", 3, "fourthKey", 4, "fifthKey", 5, "sixthKey", 6);
addToTrace
static void addToTrace(const ExceptionInfo& value)
Adds exception information to trace for current thread
aliasHasKey
template <class AliasType> bool aliasHasKey(const AliasType& alias) const
Check if a key with alias exists
alias
:
Return :
base64Decode
void base64Decode(const std::string& in, std::vector<unsigned char>& out)
Base64 decode a string
in
:
out
: vector of bytes
base64Encode
std::string base64Encode(const unsigned char* bytes_to_encode, const size_t len)
Base64 encode bytes
bytes_to_encode
:
len
:
Return :
begin
const_iterator begin() const
Insertion order iterator (i.e. list iterator)
bindPointer
template <typename ValueType> ValueType* bindPointer(const std::string& path, const char separator = k_defaultSep)
Bind a (newly created) object in the map into and external variable Optimization: This is useful in order to avoid the later copy of the value into std::any, in the hash::set(key, value). This function provides a pointer to the object in the map where you can build your data directly.
key
: A string hash key
Return : A pointer to the internal object Example:
int* value = set<int>("key");
*value = 10;
bindReference
template <typename ValueType> ValueType& bindReference(const std::string& path, const char separator = k_defaultSep)
Bind a (newly created) object in the map into and external variable Optimization: This is useful in order to avoid the later copy of the value into std::any, in the hash::set(key, value). This function provides a reference to the object in the map where you can build your data directly.
key
: A string hash key
Return : A reference to the internal object
Example
vector<string>& vec = set<vector<string> >("key");
vec.resize(20);
vec[1] = "a string";
clear
void clear()
Remove all the keys from the hash
Return : No
clearTrace
static void clearTrace()
Clears the trace of memorized messages for current thread
createCastFailureMessage
std::string createCastFailureMessage(const std::string& key, const std::type_info& src, const std::type_info& tgt)
Create a cast failure message for a Hash key when trying to cast to a different value type
key
: the message pertains to
src
: typeinfo of source type, i.e. type of the value in the Hash
tgt
: typeinfo of target type, i.e. type to which the cast failed
Return : the failure message
createTypeMismatchMessage
std::string createTypeMismatchMessage(const std::string& key, const std::type_info& srcType, const std::type_info& tgtType)
@brief Creates a type mismatch message for an attempt to get a Hash node value with a type different from the current type of the node.
key
: the key of the node whose value has been requested.
srcType
: the current type of the node whose value should have been retrieved.
tgtType
: the expected type of the node whose value should have been retrieved
Return : std::string the failure message.
detailedMsg
std::string detailedMsg() const
This function returns the full error stack with all information.
Clears the exception stack.
Return : The stack of exceptions as string, incl. source code line number.
details
const std::string& details() const
The details of the exception - without trace.
Some exceptions do not offer to provide details, then an empty string is returned. Stack is not touched/cleared.
empty
bool empty() const
Check if the Schema is empty
Return :
bool empty() const
Check if the hash contains any keys or not.
Return : true if hash is empty, false otherwise
erase
bool erase(const std::string& path, const char separator = k_defaultSep)
Remove the element identified by 'path' if it exists.
Otherwise, do nothing.
If 'path' is a composite element, all its descendents are removed
as well. The path up to the last part of 'path' is not removed.
Example 1: erase ("a.b.c") will remove "c", but "a.b" should
not be removed even if "c" is the only child of "a.b".
If 'path' refers to a Hash inside a vector
Return : true if key exists, otherwise false
map_iterator erase(map_iterator it)
Remove element identified by map_iterator of this Hash.
The iterator must not belong to a Hash nested in this one.
it
: a valid iterator (invalid afterwards)
Return : a map_iterator pointing to the element after 'it' (or mend() if it was the last element)
erasePath
void erasePath(const std::string& path, const char separator = k_defaultSep)
Remove the element identified by 'path' if it exists.
If 'key' is composite (e.g. "a.b.c") and the last component ("c")
is the only child of its parent, the parent is removed as well.
This removal is recursively continued to the root.
Example 1: erasePath("a.b.c") will remove "c" and "b" will
be removed as well if "c" is the only child of "a.b".
If "a.b.c" is the only element in the Hash, then
erasePath("a.b.c") will result in an empty hash.
If 'path' refers to a Hash inside a vector
Return : No
find
boost::optional<const Hash::Node&> find(const std::string& path, const char separator = k_defaultSep) const
Lookup for the hash element identified by "path". If the node exists, it returns a reference to it wrapped in boost::optional object. Otherwise, uninitialized boost::optional object is returned.
path
: sequence of keys to the searched for element
separator
: key separation char
Return : Hash::Node wrapped in boost::optional
flatten
void flatten(Hash& flat, const char separator = k_defaultSep) const
Flattens a hierarchical Hash into "one-level", flat Hash object
Return : A Hash having keys that are all leaves
format
static void format(std::ostream& os, const ExceptionInfo& exceptionInfo, const std::string& spacing)
Formats the exception content
os
: Any output stream to that the exception content will be added
exceptionInfo
: Content of an exception,
See
: ExceptionInfo stuct
fromString
template <class T> inline T fromString(const std::string& value)
The generic fromString method tries to obtain a value of type T using a boost::lexical_cast of the passed value.
value
:
Return :
template <> inline int fromString(const std::string& value)
For integer return values the lowever overhead method strtol is used
value
:
Return :
template <> inline karabo::data::CppNone fromString(const std::string& value)
A string "None" can be cast to karabo::data::CppNone. Any other string representation may not!
value
:
Return :
template <> inline karabo::data::ByteArray fromString(const std::string& value)
Bytearrays can be constructed from strings where each character in the string represents a byte (char) in the array
value
:
Return :
template <typename T, template <typename ELEM, typename = std::allocator<ELEM>> class CONT> // e.g. for vector container inline CONT<T> fromString(const std::string& value, const std::string& separator = ",")
Sequence type elements can be constructed from strings of the form
[ value1, value2, ..., valueN ]
where the enclosing brackets ([]) are optional and other separators may be specified. The sequence elements must have a StringTools:fromString method for their type T and each element must be castable to T using this method.
value
:
separator
: if separator other than the comma (,) is used
Return :
template <> inline std::vector<unsigned char> fromString(const std::string& value, const std::string&)
Vectors of unsigned char elements can be constructed directly from strings where character of the string represents a byte of the vector. The second argument should be set to ""
value
:
`` :
template <> inline std::vector<char> fromString(const std::string& value, const std::string&)
Vectors of char elements can be constructed directly from strings where character of the string represents a byte of the vector. The second argument should be set to ""
value
:
`` :
fromStringForSchemaOptions
template <class T> inline std::vector<T> fromStringForSchemaOptions(const std::string& value, const std::string& sep)
XXX: This function is working around the surprising behavior of fromstring
In the meantime, we can use this simple version for schema options parsing.
fullyEquals
bool fullyEquals(const Hash& other, bool orderMatters = true) const
Checks if this Hash is equal to other.
A Hash is considered fully equal to another if both are similar and their corresponding elements have the same keys, values and attributes.
other
: Hash to compare with
orderMatters
: if true (default) order of keys is relevant as well
Return : bool
get
template <typename ValueType> inline const ValueType& get(const std::string& path, const char separator = k_defaultSep) const
Retrieve a constant reference to the value of element identified by 'key'
key
: A string key
Return : The associated value
Note
Differently from Hash::getAs, Hash::get (and its overloads) doesn't perform any conversion while retrieving a node value. If the node type specified on the get call doesn't match the actual node type, a cast exception will be thrown.
template <typename ValueType> inline ValueType& get(const std::string& key, const char separator = k_defaultSep)
Retrieve a (non-const) reference to the stored value of a given key
key
: A string key
Return : The associated value
template <typename ValueType> inline void get(const std::string& path, ValueType& value, const char separator = k_defaultSep) const
Retrieve (non-const) reference to the stored value into second parameter
key
: A string key
value
: Any object that will be filled by reference
Return : void
getAccessMode
int getAccessMode(const std::string& path) const
Get the access mode for the element identified by path
path
:
Return : maps to the Schema::AccessMode enum
getAliasAsString
std::string getAliasAsString(const std::string& path) const
Get the alias for path as string. Check if an alias has been set first by using Schema::keyHasAlias
path
:
Return :
getAliasFromKey
template <class AliasType> const AliasType& getAliasFromKey(const std::string& path) const
Get the alias mapping to the key at path. Check if an alias has been set first by using Schema::keyHasAlias
path
:
Return :
getAllowedActions
const std::vector<std::string>& getAllowedActions(const std::string& path) const
Get allowed actions of given element if available. Pre-requisite: hasAllowedActions(path) has to return true.
path
: to element
Return : specified allowed actions
getAllowedStates
const std::vector<karabo::data::State> getAllowedStates(const std::string& path) const
Get the allowed states set for the element identified by path
path
:
Return :
getArchivePolicy
const int& getArchivePolicy(const std::string& path) const
Get the archive policy for the element identified by path.
path
:
Return : maps to the Schema::ArchivePolicy enum
getAs
template <typename ValueType> inline ValueType getAs(const std::string& path, const char separator = k_defaultSep) const
Casts the the value of element identified by "path" from its original type to another different target type. Throws CastException if casting fails, i.e. not possible or unsafe
path
:
separator
:
Return : value
Note
Hash::getAs (and its overload for vector elements) converts the node values to the target type specified by the caller. As an example, retrieval of unsigned integer values from nodes that are signed integers will perform the same implicit conversion performed by C/C++ (e.g., -1 assigned to an INT32 key will be retrieved as 4.294.967.295 when requested as an UINT32).
getAssemblyRules
Schema::AssemblyRules getAssemblyRules() const
Get the assembly rules of this schema
Return :
getAssignment
const int getAssignment(const std::string& path) const
Get the assignment type for the element identified by path
path
:
Return :
getAttribute
template <typename ValueType> const ValueType& getAttribute(const std::string& path, const std::string& attribute, const char separator = k_defaultSep) const
Return the value of the attribute called "attribute" of the element identified by "path"
path
:
attribute
:
separator
:
Return : bool
getAttributeAs
template <typename T> T getAttributeAs(const std::string& path, const std::string& attribute, const char separator = k_defaultSep) const
Casts the value of the attribute called "attribute" of the element identified by "path" from its original type to another different target type. Throws CastException if casting fails, i.e. not posible or unsafe
path
:
attribute
:
separator
:
Return : value
getAttributeAsAny
std::any& getAttributeAsAny(const std::string& path, const std::string& attribute, const char separator = k_defaultSep)
Return the value of the attribute called "attribute" of the element identified as std::any.
path
:
attribute
:
separator
:
Return : std::any
getAttributes
const Attributes& getAttributes(const std::string& path, const char separator = k_defaultSep) const
Return the list of attributes of the element identified by "path"
path
:
separator
:
Return : Hash::Attributes
getClassId
const std::string& getClassId(const std::string& path) const
Get the classId for the element identified by path
path
:
Return :
const std::string& getClassId() const
Return the Karabo ClassId of this class
Return :
getClassName
const std::string& getClassName() const
Return the C++ class name of this class
Return :
getCustomNodeClass
const std::string& getCustomNodeClass(const std::string& path) const
Get the class name for a given custom node element Result is undefined if path does not point to a custom node element (may e.g. throw or not), so better check isCustomNode before.
path
: of custom node element
getDAQPolicy
DAQPolicy getDAQPolicy(const std::string& path) const
Get the DAQ policy for the element identified by path.
path
:
Return : maps to the Schema::DAQPolicy enum
getDaqDataType
DaqDataType getDaqDataType(const std::string& path) const
Get the DAQ data type for a given node element
path
:
getDeepPaths
template <template <class T, class All = std::allocator<T> > class container> void getDeepPaths(container<std::string>& result, const char separator = k_defaultSep) const
Returns all root-to-leaves paths in hash in the provided container (vector, list, ...)
In contrast to getPaths, inserted data of C++ objects with protected inheritance from Hash (NDarray, ImageData) ar not treated as atomic, but as another Hash level
result
: container to which paths get appended (it is not cleared before)
separator
: to glue keys of the hierarchy levels
void getDeepPaths(std::set<std::string>& result, const char separator = k_defaultSep) const
Returns all root-to-leaves paths in hash in the provided set
In contrast to getPaths, inserted data of C++ objects with protected inheritance from Hash (NDarray, ImageData) ar not treated as atomic, but as another Hash level
result
: container to which paths get appended (it is not cleared before)
separator
: to glue keys of the hierarchy levels
std::vector<std::string> getDeepPaths(const char separator = k_defaultSep) const
Returns all root-to-leaves paths in hash in the provided set
In contrast to getPaths, inserted data of C++ objects with protected inheritance from Hash (NDarray, ImageData) ar not treated as atomic, but as another Hash level
separator
: to glue keys of the hierarchy levels
Return : vector of all deep paths
getDefaultDAQPolicy
DAQPolicy getDefaultDAQPolicy() const
Get the default DAQ policy to use if not specified per element
getDefaultValue
template <class ValueType> const ValueType& getDefaultValue(const std::string& path) const
Get the default value set for the element identified by path. Use Schema::hasDefaultValue first to check if one is set. Will throw an Exception if ValueType does not match the type of the default value set (it will be of the Element's value type)
path
:
Return :
getDefaultValueAs
template <class T> T getDefaultValueAs(const std::string& path) const
Get the default value set for the element identified by path. Use Schema::hasDefaultValue first to check if one is set. Will throw an Exception if the type of the default value set (it will be of the Element's value type) cannot be casted to T
path
:
Return :
template <typename T, template <typename Elem, typename = std::allocator<Elem> > class Cont> Cont<T> getDefaultValueAs(const std::string& path) const
Get the default value set for the element identified by path. Use Schema::hasDefaultValue first to check if one is set. Will throw an Exception if the type of the default value set (it will be of the Element's value type) cannot be casted to T. Overload for sequence types.
path
:
Return :
getDescription
const std::string& getDescription(const std::string& path) const
Get the description for the element identified by path
path
:
Return :
getDisplayType
const std::string& getDisplayType(const std::string& path) const
Get the display type for the element identified by path
path
:
Return :
getDisplayedName
const std::string& getDisplayedName(const std::string& path) const
Set the displayed name for the element identified by path
path
:
Return :
getIODataType
template <class T> inline std::string getIODataType()
Get the I/O datatype for type T in terms of the Karabo class id
Return :
getKeyFromAlias
template <class AliasType> const std::string& getKeyFromAlias(const AliasType& alias) const
Get the key the alias maps to. Check if the alias maps to a key first by using Schema::aliasHasKey
path
:
Return :
getKeys
std::vector<std::string> getKeys(const std::string& path = "") const
Returns all keys in the schema (no recursion) Keys in inner-structures are not provided
level
: from which to start the traversal
Return : array of strings
template <template <class T, class All = std::allocator<T> > class container> void getKeys(container<std::string>& result) const
Returns all first level keys of the hash in the provided container (vector, list, ...)
No recursion, i.e. keys in inner hashes are not included
container
: that the keys are appended to (it is not cleared before)
void getKeys(std::set<std::string>& result) const
Returns all first level keys of the hash in the provided set
No recursion, i.e. keys in inner hashes are not included
result
: that the keys are inserted into (it is not cleared before!))
std::vector<std::string> getKeys() const
Returns all first level keys of the hash as a vector
No recursion, i.e. keys in inner hashes are not included
Return : first level keys
getLogCategory
const std::string& getLogCategory() const
Return the LogCategory for this class
Return :
getMax
const int& getMax(const std::string& path) const
Set the maximum number of nodes needed in a list element
path
:
value
:
getMaxExc
template <class ValueType> const ValueType& getMaxExc(const std::string& path) const
Get the maximum exclusive restriction for setting values to the element identified by path. Will throw an exception if ValueType is not of the type of the bound (usually the Element's data type)
path
:
getMaxExcAs
template <class T> T getMaxExcAs(const std::string& path) const
Get the maximum exclusive restriction for setting values to the element identified by path. Will throw an exception if T is not of the type of the bound (usually the Element's data type) or cannot be casted to T.
path
:
getMaxInc
template <class ValueType> const ValueType& getMaxInc(const std::string& path) const
Get the maximum inclusive restriction for setting values to the element identified by path. Will throw an exception if ValueType is not of the type of the bound (usually the Element's data type)
path
:
getMaxIncAs
template <class T> T getMaxIncAs(const std::string& path) const
Get the maximum inclusive restriction for setting values to the element identified by path. Will throw an exception if T is not of the type of the bound (usually the Element's data type) or cannot be casted to T.
path
:
getMaxSize
const unsigned int& getMaxSize(const std::string& path) const
Get the maximum size restriction for setting sequence values to the element identified by path.
path
:
getMetricPrefix
const int getMetricPrefix(const std::string& path) const
Get the metric prefix set for the element identified by path. Check if the element has an metric prefix set first using Schema::hasMetricPrefix()
path
:
Return : maps to a karabo::data::UnitType enum
getMetricPrefixName
const std::string& getMetricPrefixName(const std::string& path) const
Get the metric prefix name for the element identified by path. Check if the element has an metric prefix set first using Schema::hasMetricPrefix()
path
:
Return :
getMetricPrefixSymbol
const std::string& getMetricPrefixSymbol(const std::string& path) const
Get the metric prefix symbol for the element identified by path. Check if the element has an metric prefix set first using Schema::hasMetricPrefix()
path
:
Return :
getMin
const int& getMin(const std::string& path) const
Get the minimum number of nodes needed for the element identified by path
path
:
Return :
getMinExc
template <class ValueType> const ValueType& getMinExc(const std::string& path) const
Get the minimum exclusive restriction for setting values to the element identified by path. Will throw an exception if ValueType is not of the type of the bound (usually the Element's data type)
path
:
getMinExcAs
template <class T> T getMinExcAs(const std::string& path) const
Get the minimum exclusive restriction for setting values to the element identified by path. Will throw an exception if T is not of the type of the bound (usually the Element's data type) or cannot be casted to T.
path
:
getMinInc
template <class ValueType> const ValueType& getMinInc(const std::string& path) const
Get the minimum inclusive restriction for setting values to the element identified by path. Will throw an exception if ValueType is not of the type of the bound (usually the Element's data type)
path
:
getMinIncAs
template <class T> T getMinIncAs(const std::string& path) const
Get the minimum inclusive restriction for setting values to the element identified by path. Will throw an exception if T is not of the type of the bound (usually the Element's data type) or cannot be casted to T.
path
:
getMinSize
const unsigned int& getMinSize(const std::string& path) const
Get the minimum size restriction for setting sequence values to the element identified by path.
path
:
getNamespace
const std::string& getNamespace() const
Return the C++ name space of this class
Return :
getNode
const Node& getNode(const std::string& path, const char separator = k_defaultSep) const
Return the internal Hash node element designated by "path"
path
:
separator
:
Return : Hash::Node element
getNodeType
int getNodeType(const std::string& path) const
Get the node type of the element identified by path. You should check if it is of Node-type first with Schema::hasNodeType()
path
:
Return : a value mapping to the Schema::NodeType enum
getOptions
template <class T> const std::vector<T>& getOptions(const std::string& path) const
Get the options set for the element identified by path
path
:
Return :
getParameterHash
const karabo::data::Hash& getParameterHash() const
Get a Hash representation of this Schema. It will have the same hierarchical structure as the schema. Each keys attributes map to the attributes/modifiers of the respective schema element. The value types to not match up with the schema but are all of type INT32. If you need a Hash holding empty values of correct data types use the karabo::DeviceClient::getDataSchema method instead
Return :
getPaths
std::vector<std::string> getPaths() const
Returns all root-to-leaves paths of the schema
Return : array of strings
template <template <class T, class All = std::allocator<T> > class container> void getPaths(container<std::string>& result, const char separator = k_defaultSep) const
Returns all root-to-leaves paths in hash in the provided container (vector, list, ...)
This function goes recursively through the whole hash and the returned paths are their keys "glued" together via the given separator
result
: container to which paths get appended (it is not cleared before)
separator
: to glue keys of the hierarchy levels
void getPaths(std::set<std::string>& result, const char separator = k_defaultSep) const
Returns all root-to-leaves paths in hash in the provided set
This function goes recursively through the whole hash and the returned paths are their keys "glued" together via the given separator
result
: set into which paths get inserted (it is not cleared before)
separator
: to glue keys of the hierarchy levels
std::vector<std::string> getPaths(const char separator = k_defaultSep) const
Returns all root-to-leaves paths in hash as vector
This function goes recursively through the whole hash and the returned paths are their keys "glued" together via the given separator
separator
: to glue keys of the hierarchy levels
Return : vector of all paths
getRequiredAccessLevel
const int getRequiredAccessLevel(const std::string& path) const
Get the required access level for the element identified by path
path
:
Return : maps to the Schema::AccessLevel enum
getRootName
const std::string& getRootName() const
Get the schema's root element's name
Return :
getSkipValidation
bool getSkipValidation(const std::string& path)
Check if the element identified by path is set to skip validation
path
:
Return :
getTags
const std::vector<std::string>& getTags(const std::string& path) const
Get the tags for the element identified by path
path
:
Return :
getType
Types::ReferenceType getType(const std::string& path, const char separator = k_defaultSep) const
Function to obtain value type information
key
: The key to the value of which type information should be returned
Return : The typeId as defined in See : Types.hh
getUnit
const int getUnit(const std::string& path) const
Get the unit set for the element identified by path. Check if the element has an unit set first using Schema::hasUnit()
path
:
Return : maps to a karabo::data::UnitType enum
getUnitName
const std::string& getUnitName(const std::string& path) const
Get the unit name for the element identified by path. Check if the element has an unit set first using Schema::hasUnit()
path
:
Return :
getUnitSymbol
const std::string& getUnitSymbol(const std::string& path) const
Get the unit symbol for the element identified by path. Check if the element has an unit set first using Schema::hasUnit()
path
:
Return :
getValueType
Types::ReferenceType getValueType(const std::string& path) const
Get the valuetype of the element at path. You should check that it is of LeafType first using Schema::isLeaf
path
:
Return :
getVersion
const std::string& getVersion() const
Return the version number of this class - currently does not convey much meaning.
Return :
has
bool has(const std::string& path) const
Check if a given path exists in the Schema
path
:
Return :
bool has(const std::string& path, const char separator = k_defaultSep) const
Check if the key 'key' exist in hash
key
: A string hash key
Return : true if key exists, false otherwise
hasAccessMode
bool hasAccessMode(const std::string& path) const
Check if the element identified by path has an access mode set
path
:
Return :
hasAllowedActions
bool hasAllowedActions(const std::string& path) const
Check if given element has allowed actions.
path
: to element
hasAllowedStates
bool hasAllowedStates(const std::string& path) const
Check if the element identified by path has allowed states set
path
:
Return :
hasArchivePolicy
bool hasArchivePolicy(const std::string& path) const
Check if the element identified by path has an archive policy set
path
:
Return :
hasAssignment
bool hasAssignment(const std::string& path) const
Check if the element identified by path has a assignment type set
path
:
Return :
hasAttribute
bool hasAttribute(const std::string& path, const std::string& attribute, const char separator = k_defaultSep) const
*****************************************************************
Attributes manipulation
*****************************************************************
Check if the element identified by "path" has an attribute called "attribute"
path
:
attribute
:
separator
:
Return : bool
hasClassId
bool hasClassId(const std::string& path) const
Check if the element identified by path has a classId
path
:
Return :
hasDAQPolicy
bool hasDAQPolicy(const std::string& path) const
Check if the element identified by path has an DAQ policy set
path
:
Return :
hasDaqDataType
bool hasDaqDataType(const std::string& path) const
Check if a DAQ data type has been set for a given element.
path
:
hasDefaultValue
bool hasDefaultValue(const std::string&) const
Check if the element identified by path has a default value set
`` :
hasDescription
bool hasDescription(const std::string& path) const
Check if the element identified by path has a description set
path
:
Return :
hasDisplayType
bool hasDisplayType(const std::string& path) const
Check if the element identified by path has a display type set
path
:
Return :
hasDisplayedName
bool hasDisplayedName(const std::string& path) const
Check if the element identified by path has a displayed name set
path
:
Return :
hasMax
bool hasMax(const std::string& path) const
Check if the element identified by path has a maximum number of Nodes set
path
:
Return :
hasMaxExc
bool hasMaxExc(const std::string& path) const
Check if a maximum exclusive restriction for setting values to the element identified by path has been set
path
:
Return :
hasMaxInc
bool hasMaxInc(const std::string& path) const
Check if a maximum inclusive restriction for setting values to the element identified by path has been set
path
:
Return :
hasMaxSize
bool hasMaxSize(const std::string& path) const
Check if a maximum size restriction for setting sequence values to the element identified by path has been set
path
:
Return :
hasMetricPrefix
bool hasMetricPrefix(const std::string& path) const
Check if the element identified by path has an metric prefix set
path
:
Return :
hasMin
bool hasMin(const std::string& path) const
Check if the element identified by path has a minimum number of Nodes set
path
:
Return :
hasMinExc
bool hasMinExc(const std::string& path) const
Check if a minimum exclusive restriction for setting values to the element identified by path has been set
path
:
Return :
hasMinInc
bool hasMinInc(const std::string& path) const
Check if a minimum inclusive restriction for setting values to the element identified by path has been set
path
:
Return :
hasMinSize
bool hasMinSize(const std::string& path) const
Check if a minimum size restriction for setting sequence values to the element identified by path has been set
path
:
Return :
hasNodeType
bool hasNodeType(const std::string& path) const
Check if the element at path has one of the node element types (NodeElement, ChoiceElement)
path
:
Return :
hasOptions
bool hasOptions(const std::string& path) const
Check if the element identified by path has options set
path
:
Return :
hasTags
bool hasTags(const std::string& path) const
Check if the element identified by path has tags set
path
:
Return :
hasUnit
bool hasUnit(const std::string& path) const
Check if the element identified by path has an unit set
path
:
Return :
help
void help(const std::string& classId = "", std::ostream& os = std::cout)
Help function to show all parameters
is
template <typename ValueType> bool is(const std::string& path, const char separator = k_defaultSep) const
Predicate function calculating if the type of the value associated with the key is of a specific type in template parameter
key
: The key having associated value and the type of this value we want to test against template
parameter
Return : true or false
bool is(const std::string& path, const Types::ReferenceType& type, const char separator = k_defaultSep) const
Predicate function calculating if the value associated with key is of type type.
key
: Some string
type
: Some type from Types::Type enumeration
Return : true or false
isAccessInitOnly
bool isAccessInitOnly(const std::string& path) const
Check if the element identified by path is init-only
path
:
Return :
isAccessReadOnly
bool isAccessReadOnly(const std::string& path) const
Check if the element identified by path is read-only
path
:
Return :
isAccessReconfigurable
bool isAccessReconfigurable(const std::string& path) const
Check if the element identified by path is reconfigurable
path
:
Return :
isAssignmentInternal
bool isAssignmentInternal(const std::string& path) const
Check if the element identified by path is assignment internal
path
:
Return :
isAssignmentMandatory
bool isAssignmentMandatory(const std::string& path) const
Check if the element identified by path is assignment mandatory
path
:
Return :
isAssignmentOptional
bool isAssignmentOptional(const std::string& path) const
Check if the element identified by path is assignment optional
path
:
Return :
isChoiceOfNodes
bool isChoiceOfNodes(const std::string& path) const
Check if the element at path is of Choice-of-Nodes type
path
:
Return :
isCommand
bool isCommand(const std::string& path) const
Check if the element at path is a command
path
:
Return :
isCustomNode
bool isCustomNode(const std::string& path) const
Check if given element is a custom node like IMAGEDATA or NDARRAY_ELEMENT.
path
:
isLeaf
bool isLeaf(const std::string& path) const
Check if the element at path is of Leaf-type
path
:
Return :
isNode
bool isNode(const std::string& path) const
Check if the element at path is of Node-Element-type
path
:
Return :
isOrphaned
bool isOrphaned(const Hash::Node& node) const
True if node's key points to a subnode whose parent does not
exist or is of inappropriate node type.
isProperty
bool isProperty(const std::string& path) const
Check if the element at path is a property
path
:
Return :
keyHasAlias
bool keyHasAlias(const std::string& path) const
Check if an alias has been set for path
path
:
Return :
keyIsPrefixOfAnyPath
static bool keyIsPrefixOfAnyPath(const std::set<std::string>& paths, const std::string& key, char separator, unsigned int size)
True if the first key (separated by 'separator') of any of 'paths' matches 'key'. A first key that contains an index also matches (indirectly) 'key' without index if index < 'size', i.e. path "a[0].g" matches key "a" if 'size' >= 1, but not if 'size' == 0.
loadFromFile
template <class T> inline void loadFromFile(T& object, const std::string& filename, const karabo::data::Hash& config = karabo::data::Hash())
Load an object of class T from a file. The configuration determines which access and de-serialzation methods to use.
object
: to load data into
filename
: of the file to load from. The input chose depends on the file
extension:
- .h5: Hdf5File
- .bin: BinaryFile
- .others: TextFile
config
: for the Input class that will be used
inline void loadFromFile(std::vector<char>& buffer, const std::string& filename)
Load a buffer from a file
buffer
:
filename
:
mbegin
const_map_iterator mbegin() const
Alpha-numeric order iterator (i.e. map iterator)
memorize
static void memorize()
Use this function if you want to just memorize the exception but keep on running. This function should be used for exceptions thrown in multi-threaded context, as C++'s intrinsic exception handling is not thread safe.
Example: TODO
merge
void merge(const Schema& schema)
Merges another schema into the current one
schema
: Another schema to be merged
void merge(const Hash& other, const MergePolicy policy = REPLACE_ATTRIBUTES, const std::set<std::string>& selectedPaths = std::set<std::string>(), char separator = k_defaultSep)
Merges another hash into this one
Creates new nodes, if they do not already exists. Creates new leaves, if they do not already exist.
Existing leaves will be replaced by the new hash.
hash
: Another hash to be merged into current hash
policy
: Whether to replace attributes by those merged in or to merge them
selectedPaths
: If not empty, only merge these paths
separator
: The separator for nested keys in selectedPaths
mergeAttributes
static void mergeAttributes(Hash::Node& targetNode, const Hash::Attributes& attrs, Hash::MergePolicy policy)
Merge 'attrs' to 'targetNode' according to merge 'policy'.
mergeTableElement
static void mergeTableElement(const Hash::Node& source, Hash::Node& target, const std::set<std::string>& selectedPaths, char separator)
Merge two vector
msg
void msg(std::ostream& os = std::cerr) const
Explicit output function. In contrast to the inherited what() function this function also lists memorized/traced exceptions.
saveToFile
template <class T> inline void saveToFile(const T& object, const std::string& filename, const karabo::data::Hash& config = karabo::data::Hash())
Save an object of class T to a file. The configuration determines which access and serialzation methods to use.
object
: to save
filename
: of the file to load from. The input chose depends on the file
extension:
- .h5: Hdf5File
- .bin: BinaryFile
- .others: TextFile
config
: for the Output class that will be used
inline void saveToFile(const std::vector<char>& buffer, const std::string& filename)
Save a buffer into a file
buffer
:
filename
:
selectChildPaths
static std::set<std::string> selectChildPaths(const std::set<std::string>& paths, const std::string& childKey, char separator)
Out of 'paths' select those that belong to child with 'childKey', e.g. out of ["a", "b.c", "b.d.e"] return ["c", "d.e"] if childKey == "b" and separator == k_defaultSep.
selectIndicesOfKey
static std::set<unsigned int> selectIndicesOfKey(unsigned int targetSize, const std::set<std::string>& paths, const std::string& key, char separator)
For all 'paths', check whether their first key matches 'key' (as in keyIsPrefixOfAnyPath). If it does indirectly (see keyIsPrefixOfAnyPath), append the index specified behind it to the result, except if there is also a direct match - then the result is empty: Paths = {a[0], b, a[2]} and key = a ==> return [0,2] Paths = {a[0], b, a} and key = a ==> return [] Indices >= 'targetSize' are ignored.
set
template <typename ValueType> inline Node& set(const std::string& path, const ValueType& value, const char separator = k_defaultSep)
@brief Insert key/value pair in current container.
key
: A string key
value
: Any object as value
Return : void
Example
Hash hash;
hash.set("myKey", "myValue");
hash.set("myFloat", float(12.44));
Optimization: to avoid double-copy, ie value into std::any object, and the later into the map, we first insert an empty object of type std::any into the map, get a reference to the std::any object associated with key, then copy the given value into it.
setAccessMode
void setAccessMode(const std::string& path, const AccessType& value)
Set the access mode for the element identified by path
path
:
value
:
setAlias
template <class AliasType> void setAlias(const std::string& path, const AliasType& value)
Set an alias for path
path
:
value
:
setAllowedActions
void setAllowedActions(const std::string& path, const std::vector<std::string>& actions)
Specify one or more actions that are allowed on the element.
If a Karabo device specifies allowed actions, that means that it offers a specific slot interface to operate on this element. Which allowed actions require which interface will be defined elsewhere.
path
: to element
actions
: vector of strings of allowed actions
setAllowedStates
void setAllowedStates(const std::string& path, const karabo::data::State& s1)
Set new allowed states for the element identified by path
path
:
s1
:
setArchivePolicy
void setArchivePolicy(const std::string& path, const ArchivePolicy& value)
Set the archive policy for the element identified by path
path
:
value
:
setAssemblyRules
void setAssemblyRules(const Schema::AssemblyRules& rules)
Set the assembly rules for this schema
rules
:
setAssignment
void setAssignment(const std::string& path, const AssignmentType& value)
Set the assignment type for the element identified by path
path
:
value
:
setAttribute
template <typename ValueType> void setAttribute(const std::string& path, const std::string& attribute, const ValueType& value, const char separator = k_defaultSep)
Set the value of an attribute called "attribute" of the element identified by "path"
path
:
attribute
:
value
:
separator
:
template <typename ValueType> void setAttribute(const std::string& path, const std::string& attribute, ValueType&& value, const char separator = k_defaultSep)
Set the value of an attribute called "attribute" of the element identified by "path"
path
:
attribute
:
value
:
separator
:
setAttributes
void setAttributes(const std::string& path, const Attributes& attributes, const char separator = k_defaultSep)
Assign of list of attributes (i.e. Hash::Attributes container) to the element identified by "path"
path
:
attributes
:
separator
:
void setAttributes(const std::string& path, Attributes&& attributes, const char separator = k_defaultSep)
Assign of list of attributes (i.e. Hash::Attributes container) to the element identified by "path"
path
:
attributes
: to move from
separator
:
setDAQPolicy
void setDAQPolicy(const std::string& path, const DAQPolicy& value)
Set the DAQ policy for the element identified by path
path
:
value
:
setDaqDataType
void setDaqDataType(const std::string& path, const DaqDataType& dataType)
Set the DAQ data type for a given node element.
Data types may only be set for node elements
path
: at which the node is located
dataType
: of this node
setDefaultDAQPolicy
void setDefaultDAQPolicy(const DAQPolicy& value)
Set the default DAQ policy to use if not specified per element. Needs to be called at the very beginning of the expected parameter section.
policy
:
setDefaultValue
template <class ValueType> void setDefaultValue(const std::string& path, const ValueType& value)
Set the new default value for the element identified by path
path
:
value
:
setDescription
void setDescription(const std::string& path, const std::string& value)
Set the description for the element identified by path
path
:
value
:
setDisplayType
void setDisplayType(const std::string& path, const std::string& value)
Set the display type for the element identified by path
path
:
value
:
setDisplayedName
void setDisplayedName(const std::string& path, const std::string& value)
Set the displayed name for the element identified by path
path
:
value
:
setHash
template <typename HashType> inline Node& setHash(const std::string& path, HashType value, const char separator = k_defaultSep)
Internal helper to avoid code duplication for template specialisations of set(path, hashValue, separator).
HashType shall be const reference or lvalue reference of Hash or Hash derived classes: 'const Hash&', 'Hash&&', 'const NDArray&', etc.
setMax
void setMax(const std::string& path, const int& value)
Set the maximum number of nodes needed in a list element
path
:
value
:
setMaxExc
template <class ValueType> void setMaxExc(const std::string& path, const ValueType& value)
Set the maximum exclusive restriction for setting values to the element identified by path
path
:
value
:
setMaxInc
template <class ValueType> void setMaxInc(const std::string& path, const ValueType& value)
Set the maximum inclusive restriction for setting values to the element identified by path
path
:
value
:
setMaxSize
void setMaxSize(const std::string& path, const unsigned int& value)
Set the maximum size restriction for setting sequence values to the element identified by path
path
:
value
:
setMetricPrefix
void setMetricPrefix(const std::string& path, const MetricPrefixType& value)
Set the metric prefix for the element identified by path
path
:
value
:
setMin
void setMin(const std::string& path, const int& value)
Set the minimum number of nodes needed in a list element
path
:
value
:
setMinExc
template <class ValueType> void setMinExc(const std::string& path, const ValueType& value)
Set the minimum exclusive restriction for setting values to the element identified by path
path
:
value
:
setMinInc
template <class ValueType> void setMinInc(const std::string& path, const ValueType& value)
Set the minimum inclusive restriction for setting values to the element identified by path
path
:
value
:
setMinSize
void setMinSize(const std::string& path, const unsigned int& value)
Set the minimum size restriction for setting sequence values to the element identified by path
path
:
value
:
setMulti
template <typename ValueType, typename... Args> inline void setMulti(const std::string& key, ValueType&& value, Args&&... args)
Set an arbitray number of key/value pairs, internally using Hash::set(..) with the default separator
inline void setMulti() const
End point for setMulti(..) with variadic templates
setNode
Node& setNode(const Node& srcElement)
Clone the content (key, value, attributes) of another elements. This function use the source element's key, NOT his full path.
setOptions
void setOptions(const std::string& path, const std::string& value, const std::string& sep)
Set options for the element identified by path.
path
:
value
: a stringified list of options, separated by sep
sep
:
setParameterHash
void setParameterHash(const karabo::data::Hash& parameterDescription)
Set the parameter hash of the schema. Implicitly alters the schema as this Hash is its underlying description.
parameterDescription
: - must match the structure of the Schema internal Hash
void setParameterHash(karabo::data::Hash&& parameterDescription)
Set (with move semantics) the parameter hash of the schema. Implicitly alters the schema as this Hash is its underlying description.
parameterDescription
: - must match the structure of the Schema internal Hash
setRequiredAccessLevel
void setRequiredAccessLevel(const std::string& path, const AccessLevel& value)
Set the required access level for the element identified by path
path
:
value
:
setRootName
void setRootName(const std::string& rootName)
St the schema's root element's name
rootName
:
setSkipValidation
void setSkipValidation(const std::string& path, const bool value)
Set the element identified by path to skip validation
path
:
value
:
setTags
void setTags(const std::string& path, const std::string& value, const std::string& sep = " ,;")
Set the tags for the element identified by path
path
:
value
:
setUnit
void setUnit(const std::string& path, const UnitType& value)
Set the unit for the element identified by path
path
:
value
:
showTrace
static void showTrace(std::ostream& os = std::cerr)
Shows all memorized messages.
size
size_t size() const
*****************************************************************
Provide same interface as STL
*****************************************************************
Return the number of key elements in the hash
Return : size_t
split
std::vector<std::string> split(std::string& str, const char* dl = " ", std::size_t maxsplit = 0)
Split input string using delimiter (default = space) into vector of strings.
str
: input string to split
dl
: delimiter character used for splitting (default = " ")
maxsplit
: max size of resulting vector ... (default = 0: unlimited)
Return : vector of splitted parts of input string
subSchema
Schema subSchema(const std::string& subNodePath, const std::string& filterTags = std::string()) const
Retrieve a sub-schema of the schema
subNodePath
: path of the node element to retrieve sub schema from
filterTags
: optional tags to filter sub schema by
Return : a sub-schema of this schema.
subSchemaByPaths
Schema subSchemaByPaths(const std::set<std::string>& paths) const
Retrieves a sub-schema with given paths
A path to a node means that all further nested paths are kept
paths
: in the schema whose information should be copied to the resulting sub schema
Return : reduced schema
subSchemaByRules
Schema subSchemaByRules(const AssemblyRules& rules) const
Retrieve a sub-schema of those paths that fulfill given rules
rules
: assemby rules: - if their state field is emtpy, accept all states
- similarly, default accessLevel -1 means do not care
subtract
void subtract(const Hash& other, const char separator = k_defaultSep)
Subtracts from current hash all nodes that can be found in other hash given as argument.
other
: hash used for defining the candidates for subtraction
separator.
: The default separator is k_defaultSep
Return : the current hash is shrinked in place, the other hash is untouched
toString
template <class T> inline std::string toString(const T& value)
Return a string representation of a value of type T. Overloads for common value types exist. In general std::ostream is used for output so it will work for any type supporting the "<<" operator or supported by std::ostream
value
:
Return :
inline std::string toString(const float& value)
Floats are output to their maximum precision of 7 digits
value
:
Return :
inline std::string toString(const double& value)
Doubles are output to their maximum precision of 15 digits
value
:
Return :
inline std::string toString(const std::complex<float>& value)
Complex floats are output to their maximum precision of 7 digits
value
:
Return :
inline std::string toString(const std::complex<double>& value)
Complex doubles are output to their maximum precision of 15 digits
value
:
Return :
template <typename T> inline std::string toString(const std::vector<T>& value, size_t maxElementsShown = 0)
Vector values are output as a comma separated list, where the StringTools::toString method for their value type T defines the representation of each element
value
: is the vector to be converted
maxElementsShown
: is the maximum number of vector elements treated. If value.size() is larger,
skip elements in the middle. Default is 0 which means no skipping of elements.
Return :
std::string toString(const karabo::data::ByteArray& value, size_t maxBytesShown = 0)
Byte array is output as a hexadecimal string (short)
value
: ByteArray object
maxBytesShown
: max. number of bytes to be presented
Return : string representation of ByteArray
inline std::string toString(const std::vector<std::string>& value)
String vector values are output as a comma separated list. The individual strings in the list may not contain comma (,) separators, e.g. an element "Hello, World" is not allowed as it would yield a representation ambiguous with two elements "Hello" and "World" -> "Hello, World".
value
:
Return :
template <typename T> inline std::string toString(const std::pair<const T*, size_t>& value)
Pointers with size information given as a std::pair of pointer and size are output like
vectors (see StringTools::toString(const std::vector
value
:
Return :
std::string toString(const karabo::data::NDArray& value)
An NDArray is output in a flattened representation using StringTools::toString(const std::pair
value
:
Return :
template <typename T> inline std::string toString(const std::set<T>& value)
A std::set is output as a list of comma (,) separated values
value
:
Return :
template <typename T> inline std::string toString(const std::unordered_set<T>& value)
A std::unordered_set is output as a list of comma (,) separated values
value
:
Return :
template <typename T> inline std::string toString(const std::deque<T>& value)
A std::deque is output as a list of comman (,) separated values
value
:
Return :
template <typename KeyType, typename ValueType> inline std::string toString(const std::map<KeyType, ValueType>& value)
A std::map is output in the form { key1 : value1, key2: value2, ... }
value
:
Return :
inline std::string toString(const karabo::data::State& value)
States are output using their stringified name
value
:
Return :
template <class T> std::string toString(const T& value)
Small helper function
tokenize
template <typename container> inline void tokenize(const std::string& inputString, container& tokens, char const* delimiters)
Split a string into its components separated by any of the given delimiters
inputString
:
tokens
: output container - will never be empty
delimiters
: each char in this C-style string indicates the end of a substring
template <typename container> inline void tokenize(const std::string& inputString, container& tokens, const char delimiter)
Split a string into its components separated by the given delimiter
inputString
:
tokens
: output container - will never be empty
delimiter
:
type
const std::string& type() const
The type of the exception
unflatten
void unflatten(Hash& tree, const char separator = k_defaultSep) const
Arranges flat Hash object in a hierarchy using separator symbol (default: ".") during parsing the keys to recognize a hierarchy
sep
: An optional separator symbol (default: ".")
Return : A Hash object containing keys with no separator symbols
updateAliasMap
void updateAliasMap()
This function updates the internal mapping between keys and their aliases The function must be called after de-serialization in order to construct the proper inner structure
userFriendlyMsg
std::string userFriendlyMsg(bool clearTrace = true) const
This function is intended to be used for example in GUIs.
clearTrace
: Whether to clear the exception stack, default is true.
visit
template <class Visitor> bool visit(Visitor& visitor)
Implement the visitor pattern
visitor
:
Return : bool
what
virtual const char* what() const throw()
Overrides std::exception.
Same as detailedMsg() except returning 'const char*', not 'std::string'. The returned pointer is valid as long as exception object is alive or until what() is called again. Also clears the exception stack.
~Exception
virtual ~Exception() throw()
Constructor using message, exception type, filename, function name, line number and possible detailsMsg Destructor
~Schema
virtual ~Schema()
Constructs empty schema for given classId
classId
: The factory key of the configurable class (will be stored outside the inner hash)
rules
: Assembly rules if the schema is assembled from a class configurations (filters access modes,
states and access rights)