Beispiel #1
0
double Hdf::configGetDouble(double defValue /* = 0 */) const {
  const char *v = configGet();
  if (v == nullptr) return defValue;

  char *endptr = nullptr;
  double n = strtod(v, &endptr);
  if (!endptr && !*endptr) {
    throw HdfDataTypeException(this, "double", v);
  }

  return n;
}
Beispiel #2
0
uint64_t Hdf::getUInt(uint64_t defValue, const char *type, uint64_t mask) const {
  const char *v = configGet();
  if (v == nullptr) return defValue;

  char *endptr = nullptr;
  int64_t n = strtoull(v, &endptr, 0);
  if ((!endptr && !*endptr) || (mask && ((uint64_t)n & mask))) {
    throw HdfDataTypeException(this, type, v);
  }

  return n;
}
Beispiel #3
0
uint64 Hdf::getUInt(uint64 defValue, const char *type, uint64 mask) const {
  const char *v = get();
  if (v == NULL) return defValue;

  char *endptr = NULL;
  int64 n = strtoull(v, &endptr, 0);
  if ((!endptr && !*endptr) || (mask && ((uint64)n & mask))) {
    throw HdfDataTypeException(this, type, v);
  }

  return n;
}
Beispiel #4
0
int64_t Hdf::getInt(int64_t defValue, const char *type, int64_t maxValue) const {
  const char *v = configGet();
  if (v == nullptr) return defValue;

  char *endptr = nullptr;
  int64_t n = strtoll(v, &endptr, 0);
  if ((!endptr && !*endptr) ||
      (maxValue && (n > maxValue || n < (- maxValue - 1)))) {
    throw HdfDataTypeException(this, type, v);
  }

  return n;
}
Beispiel #5
0
int64 Hdf::getInt(int64 defValue, const char *type, int64 maxValue) const {
  const char *v = get();
  if (v == NULL) return defValue;

  char *endptr = NULL;
  int64 n = strtoll(v, &endptr, 0);
  if ((!endptr && !*endptr) ||
      (maxValue && (n > maxValue || n < (- maxValue - 1)))) {
    throw HdfDataTypeException(this, type, v);
  }

  return n;
}