21 std::istringstream istrm(hexOrDecString);
24 istrm.exceptions(std::ios_base::badbit|std::ios_base::failbit);
26 if (not hexOrDecString.empty()){
28 bool numberIsHex = (hexOrDecString.find(
'x') not_eq std::string::npos) or (hexOrDecString.find(
'X') not_eq std::string::npos);
34 }
catch (
const std::ios_base::failure&){
37 std::cerr<<
"stringToInt failed to convert a string to an integer in InDetCabling/SCT_CablingUtilities"<<std::endl;
38 throw(std::ios_base::failure(
"stringToInt failure in SCT_CablingUtilities"));
45 bool inRange(
const int value,
const int lowerBound,
const int upperBound,
const std::string & valueName){
48 std::string
name = valueName.empty()?
"The value":valueName;
49 std::cerr<<
name<<
" = "<<
value<<
" is out of the allowable range."<<std::endl;
55 int calculateLink(
const int MURorder,
const int ModID,
const int theSide,
const bool isSwapped =
false){
56 return isSwapped?(MURorder*12 + (5 - ModID) * 2 + (theSide)):(MURorder*12 + ModID * 2 + theSide);
61 namespace CoveritySafe{
63 std::string
getenv(
const std::string & variableName){
65 const char * pChar=
std::getenv(variableName.c_str());