Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
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 ) { return Add( std::move( name ), value, Position() ); }
9 // ============================================================================
10 bool gp::Units::Add( std::string name, double value, const Position& pos ) {
11  return units_.emplace( std::move( name ), ValueWithPosition( value, pos ) ).second;
12 }
13 // ============================================================================
14 bool gp::Units::Find( const std::string& name, double& result ) const {
16  if ( !Find( name, r ) ) return false;
17  result = r.first;
18  return true;
19 }
20 // ============================================================================
21 bool gp::Units::Find( const std::string& name, ValueWithPosition& result ) const {
22  auto it = units_.find( name );
23  if ( it == units_.end() ) return false;
24  result = it->second;
25  return true;
26 }
STL class.
T move(T...args)
Container::mapped_type ValueWithPosition
Definition: Units.h:21