Ejemplo n.º 1
0
 bool Unit_Impl::isBaseUnit(const std::string& baseUnit) const {
   std::vector<UnitElement>::const_iterator loc = findBaseUnit(baseUnit);
   if (loc == m_units.end()) {
     return false;
   }
   return true;
 }
Ejemplo n.º 2
0
 void FahrenheitUnit_Impl::setBaseUnitExponent(const std::string& baseUnit,int exponent) {
   auto loc = findBaseUnit(baseUnit);
   if (loc != m_units.end()) {
     loc->second = exponent;
   }
   else {
     LOG_AND_THROW("Cannot add base units to an instance of FahrenheitUnit.");
   }
 }
Ejemplo n.º 3
0
 int Unit_Impl::baseUnitExponent(const std::string& baseUnit) const {
   std::vector<UnitElement>::const_iterator loc = findBaseUnit(baseUnit);
   if (loc == m_units.end()) {
     return 0;
   }
   else {
     return loc->second;
   }
 }
Ejemplo n.º 4
0
 void SIUnit_Impl::setBaseUnitExponent(const std::string& baseUnit,int exponent)
 {
   std::vector<UnitElement>::iterator loc = findBaseUnit(baseUnit);
   if (loc != m_units.end()) {
     loc->second = exponent;
   }
   else {
     LOG_AND_THROW("Cannot add baseUnit " << baseUnit << " to an instance of SIUnit.");
   }
 }
Ejemplo n.º 5
0
 void Unit_Impl::setBaseUnitExponent(const std::string& baseUnit,int exponent)
 {
   std::vector<UnitElement>::iterator loc = findBaseUnit(baseUnit);
   if (loc != m_units.end()) {
     loc->second = exponent;
   }
   else {
     m_units.push_back(UnitElement(baseUnit,exponent));
   }
 }