![]() |
Lumiera 0.pre.04
»edit your freedom«
|
Specialised adapter to consume a record of GenNode entries to build a tuple. More...
Go to the source code of this file.
Specialised adapter to consume a record of GenNode entries to build a tuple.
This is a complement to lib::meta::TupleConstructor to deal with arguments passed in our "External Tree Description" form. This is relevant for structural diff and the invocation of actions driven by messages via the UI-Bus.
In those cases, a sequence of arguments will be passed within a run-time sequential container, as a sequence of GenNode entries. The latter are variant records, which means they can hold any of a small collection of basic types, like numbers, strings, time values etc. So we have to face two challenges here.
long, we'll provide a conversion path for the case when the GenNode holds a short, an int, and – depending on the platform – when it holds a int64_t (please recall that long and int are the same type on 32bit platforms!). When encountering any other of the possible types within GenNode (e.g. string or TimeSpan), a type mismatch exception is raised.Definition in file tuple-record-init.hpp.
#include "lib/meta/tuple-helper.hpp"#include "lib/meta/typelist-manip.hpp"#include "lib/meta/typeseq-util.hpp"#include "lib/meta/generator.hpp"#include "lib/diff/gen-node.hpp"#include "lib/meta/trait.hpp"Functions | |
| _Pragma ("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Woverloaded-virtual\"") namespace lib | |
| _Pragma | ( | "GCC diagnostic push" | ) |
the visitor type our converter is based on
specialised Accessor to retrieve a given target type from a run-time typed, opaque GenNode element. Since GenNode may hold some value from a (lib::diff::DataValues small and fixed selection of types), we prepare a converter function for each sensible conversion path to the given TAR target type. This converter will placement-construct a target value in a buffer reserved within this Accessor object.
Concrete specialisation to build a std::tuple from a sequence of GenNode elements, with run-time type compatibility check.
Record<GenNode> as argument. The embedded template Access<i> will be initialised with (a reference) to the source record, followed by an attempt to convert it to the individual member type at position i within the target tuple. | error::Invalid | when the number of types within the target exceeds the number of children within the source record. LUMIERA_ERROR_INDEX_BOUNDS |
| error::Invalid | when some source GenNode element can not be sensibly converted to the corresponding type in the target tuple. LUMIERA_ERROR_WRONG_TYPE |
Definition at line 64 of file tuple-record-init.hpp.
References util::toString(), and Type.
Here is the call graph for this function: