All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Units.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 #include "Units.h"
5 // ============================================================================
6 namespace gp = Gaudi::Parsers;
7 // ============================================================================
8 bool gp::Units::Add(std::string name, double value) {
9  return Add(std::move(name), value, Position());
10 }
11 // ============================================================================
12 bool gp::Units::Add(std::string name, double value, const Position& pos) {
13  return units_.emplace( std::move(name), ValueWithPosition(value, pos) ).second;
14 }
15 // ============================================================================
16 bool gp::Units::Find(const std::string& name, double& result) const {
18  if ( !Find(name,r) ) return false;
19  result = r.first;
20  return true;
21 }
22 // ============================================================================
23 bool gp::Units::Find(const std::string& name,
24  ValueWithPosition& result) const {
25  auto it = units_.find(name);
26  if (it == units_.end()) return false;
27  result = it->second;
28  return true;
29 }
STL class.
T move(T...args)
Container::mapped_type ValueWithPosition
Definition: Units.h:20