The Gaudi Framework  v30r3 (a5ef0a68)
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 {
12  return units_.emplace( std::move( name ), ValueWithPosition( value, pos ) ).second;
13 }
14 // ============================================================================
15 bool gp::Units::Find( const std::string& name, double& result ) const
16 {
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, ValueWithPosition& result ) const
24 {
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:24