NEST
2.6.0,not_revisioned_source_dir@0
|
Class Token defines the standard user interface for accessing SLI Datum types from tokens (see there). More...
Functions | |
template<typename FT > | |
FT | getValue (const Token &t) |
getValue provides easy read-access to a Token's contents. More... | |
template<typename FT > | |
void | setValue (const Token &t, FT const &value) |
setValue provides easy write-access to a Token's contents. More... | |
template<typename FT , class D > | |
Token | newToken2 (FT const &value) |
Create a new Token from a fundamental data type. More... | |
template<typename FT > | |
Token | newToken (FT const &value) |
Create a new Token from a fundamental data type. More... | |
Class Token defines the standard user interface for accessing SLI Datum types from tokens (see there).
However, this user interface returns objects of class Datum, from which the actual value would still need to be extracted. The utilitiy functions described in this group shortcut this step and provide direct access to the underlying fundamental values contained in a token.
FT getValue | ( | const Token & | t | ) |
getValue provides easy read-access to a Token's contents.
getValue returns the value of the Datum contained inside the Token.
The general getValue function assumes that the datum was directly derived from a C++ type (most probably some container or stream). All other cases will be handled by specialization of this template.
For example, AggregateDatum types are directly derived from a C++ type.
SLI Datum derived from C++ type ------------------------------------------ BoolDatum Name HandleDatum DatumHandle (whatever that might be...) LiteralDatum Name NameDatum Name ParserDatum Parser StringDatum string SymbolDatum Name (What else?)
Hence, getValue may be used in the following ways:
call can be used on Token containing SLI-type -------------------------------------------------------------------- Name getValue<Name> {Bool|Literal|Name|Symbol}Datum DatumHandle getValue<DatumHandle> HandleDatum Parser getValue<Parser> ParserDatum string getValue<string> StringDatum
The following specialized variants of getValue() can be used in addition:
call can be used on Token containing SLI-type --------------------------------------------------------------------------------- long GetValue<long> IntegerDatum double GetValue<double> DoubleDatum bool GetValue<bool> BoolDatum string GetValue<string> NameDatum string GetValue<string> LiteralDatum string GetValue<string> SymbolDatum vector<long> GetValue<vector<long> > ArrayDatum vector<double> GetValue<vector<double> > ArrayDatum valarray<long> GetValue<valarray<long> > ArrayDatum valarray<double> GetValue<valarray<double> > ArrayDatum
What about the rest? (ElementFactoryDatum, el_prtdatum, FunctionDatum, GenericDatum, NumericDatum, lockPTRDatum, ReferenceDatum, SmartPtrDatum, TrieDatum)
TypeMismatch | The specified fundamental datatype does not match the Token's contents, or a template specialization for this type is missing. |
References Token::datum().
Token newToken | ( | FT const & | value | ) |
Create a new Token from a fundamental data type.
This template is specialized for the most fundamental types. If it does not work, use newToken2() and specify the Datum type explicitely.
Token newToken2 | ( | FT const & | value | ) |
void setValue | ( | const Token & | t, |
FT const & | value | ||
) |
setValue provides easy write-access to a Token's contents.
setValue updates the value of the Datum contained inside the Token.
setValue(Token, value) can be called on the same value/Datum pairs getValue handles. Note that the template parameter to setValue does not need to be specified explicitely, as it can be derived from the second argument.
TypeMismatch | The specified fundamental datatype does not match the Token's contents, or a template specialization for this type is missing. |
References Token::datum().