Data Structures | |
class | HasName |
Functions | |
G4bool | GetUnitValue (const G4String &unit, G4double &value) |
Definition at line 48 of file G4DimensionedTypeUtils.cc.
References G4UnitDefinition::BuildUnitsTable(), and G4UnitDefinition::GetUnitsTable().
Referenced by G4DimensionedType< T, ConversionErrorPolicy >::G4DimensionedType().
00049 { 00050 // Get units table 00051 G4UnitsTable& unitTable = G4UnitDefinition::GetUnitsTable(); 00052 if (unitTable.size() == 0) G4UnitDefinition::BuildUnitsTable(); 00053 00054 // Iterate over unit lists, searching for unit match 00055 G4UnitsTable::const_iterator iterTable = unitTable.begin(); 00056 00057 HasName myUnit(unit); 00058 G4bool gotUnit(false); 00059 00060 while (!gotUnit && (iterTable != unitTable.end())) { 00061 G4UnitsContainer unitContainer = (*iterTable)->GetUnitsList(); 00062 00063 G4UnitsContainer::const_iterator iterUnits = 00064 std::find_if(unitContainer.begin(), unitContainer.end(), myUnit); 00065 00066 if (iterUnits != unitContainer.end()) { 00067 value = (*iterUnits)->GetValue(); 00068 gotUnit = true; 00069 } 00070 00071 iterTable++; 00072 } 00073 00074 return gotUnit; 00075 }