All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Units.cpp
Go to the documentation of this file.
1 // $Id:$
2 // ============================================================================
3 // Include files
4 // ============================================================================
5 #include "Units.h"
6 // ============================================================================
7 namespace gp = Gaudi::Parsers;
8 // ============================================================================
9 bool gp::Units::Add(const std::string& name, double value) {
10  return Add(name, value, Position());
11 }
12 // ============================================================================
13 bool gp::Units::Add(const std::string& name, double value,
14  const Position& pos) {
15  std::pair<Container::iterator,bool> result =
16  units_.insert(
17  Container::value_type(name,ValueWithPosition(value, pos))
18  );
19  return result.second;
20 }
21 // ============================================================================
22 bool gp::Units::Find(const std::string& name, double& result) const {
23 
25  if (Find(name,r)){
26  result = r.first;
27  return true;
28  }
29  return false;
30 }
31 // ============================================================================
32 bool gp::Units::Find(const std::string& name,
33  ValueWithPosition& result) const {
34  Container::const_iterator it = units_.find(name);
35  if (it != units_.end()) {
36  result = it->second;
37  return true;
38  }
39  return false;
40 }
Container::mapped_type ValueWithPosition
Definition: Units.h:21