34#include <data/QuantitySelector.h>
39#include <drain/Type.h>
40#include <drain/util/ReferenceMap.h>
41#include <drain/util/StringMatcherList.h>
42#include <drain/util/Range.h>
44#include "EncodingODIM.h"
55class Quantity :
public std::map<char,EncodingODIM> {
60 typedef std::map<char,EncodingODIM>
map_t;
63 typedef std::list<EncodingODIM>
list_t;
107 double undetectValue = std::numeric_limits<double>::signaling_NaN());
118 double undetectValue = std::numeric_limits<double>::signaling_NaN());
134 physicalRange(quantity.physicalRange),
158 void addEncodings(
const list_t & l);
168 bool isApplicable(
const std::string & key){
193 void setZero(
const std::string & value);
198 undetectValue = std::numeric_limits<double>::signaling_NaN();
211 physicalRange.set(min, max);
215 std::ostream &
toStream(std::ostream & ostr)
const;
221std::ostream & operator<<(std::ostream & ostr,
const Quantity & q){
222 return q.toStream(ostr);
bool test(const std::string &key, bool defaultResult=true) const
Check if key is accepted.
Definition StringMatcherList.h:273
Structure for data storage type, scaling and marker codes. Does not contain quantity.
Definition EncodingODIM.h:75
Structure for defining quantity.
Definition Quantity.h:55
void setZero(double value)
Set a value to be used like a real measurement, for example in interpolation.
Definition Quantity.h:185
void setPhysicalRange(double min, double max=std::numeric_limits< double >::max())
Sets absolute or typical range of this quantity.
Definition Quantity.h:207
Quantity(const Quantity &quantity)
Copy constructor.
Definition Quantity.h:129
std::list< EncodingODIM > list_t
List type applicable in constructors.
Definition Quantity.h:63
const EncodingODIM & get(char typecode='\0') const
Retrieve the scaling for a given storage type.
Definition Quantity.cpp:168
double undetectValue
A physical value corresponding a very small (unmeasurable) value has been defined.
Definition Quantity.h:84
std::string name
Container supporting constructors.
Definition Quantity.h:68
std::map< char, EncodingODIM > map_t
Container for default encodings.
Definition Quantity.h:60
QuantitySelector keySelector
Collection of quantities that can be similarly scaled and encoded.
Definition Quantity.h:73
bool hasUndetectValue() const
True, if a value corresponding a very small (unmeasurable) value has been defined.
Definition Quantity.h:174
std::ostream & toStream(std::ostream &ostr) const
Print declared encodings (storage types and scalings)
Definition Quantity.cpp:200
Quantity(const std::string &name="", const QuantitySelector &compatibleVariants={}, const drain::Range< double > &range={}, char defaultType='\0', const list_t &l={}, double undetectValue=std::numeric_limits< double >::signaling_NaN())
Default constructor.
Definition Quantity.cpp:56
void unsetZero()
Confirm that no value should be used as a substitute of undetected value.
Definition Quantity.h:197
char defaultType
Default storage type.
Definition Quantity.h:76
EncodingODIM & set(char typecode)
Declare encoding (a storage type and scaling) for this quantity.
Definition Quantity.cpp:151
Definition DataSelector.cpp:44