File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 can be extended as needed by adding new names and aliases to
77 UnitValidator::createAllowedUnitTypes() and
88 UnitValidator::createAllowedUnitNames() in UnitValidator.cc
9+
10+ Strategy:
11+ -------
12+ - Types and their aliases are stored in an std::unordered_map
13+ - Units and their aliases are stored in an std::map of
14+ std::unordered_maps
15+ - The operator()(type, unit, value) first checks if the provided
16+ type exists in the allowed types map. If it does, it retrieves
17+ the canonical type string which is used to look up the allowed
18+ units for that type in the std::map. Then, the unit type is
19+ checked against the allowed units for that type. If both type
20+ and unit are valid, the canonical strings are returned.
21+
22+ Usage:
23+ -----
24+ - Create an instance of UnitValidator. Currently, this is done in
25+ the Coefficients class by default.
26+ - Call the operator() on an instance with the type and unit
27+ strings to be validated
28+ - The operator() returns a tuple with:
29+ + a boolean indicating if the type and unit are valid
30+ + the canonical type string, or "unknown" if invalid
31+ + the canonical unit string, or "unknown" if invalid
932*/
1033class UnitValidator
1134{
You can’t perform that action at this time.
0 commit comments