CMS 3D CMS Logo

Namespaces | Macros | Functions
BinaryArchiveBase.cc File Reference
#include <cassert>
#include <cctype>
#include <cerrno>
#include <climits>
#include <cstdlib>
#include <cstring>
#include "Alignment/Geners/interface/BinaryArchiveBase.hh"
#include "Alignment/Geners/interface/CatalogIO.hh"
#include "Alignment/Geners/interface/binaryIO.hh"

Go to the source code of this file.

Namespaces

 gs
 

Macros

#define GENERS_BINARY_ARCHIVE_FORMAT_ID   (0x1f2e3d4c)
 

Functions

static bool parse_int (std::ostringstream &err, const char *c, int *result)
 
static bool parse_unsigned (std::ostringstream &err, const char *c, unsigned *result)
 

Macro Definition Documentation

#define GENERS_BINARY_ARCHIVE_FORMAT_ID   (0x1f2e3d4c)

Definition at line 15 of file BinaryArchiveBase.cc.

Referenced by parse_int().

Function Documentation

static bool parse_int ( std::ostringstream &  err,
const char *  c,
int *  result 
)
static

Definition at line 35 of file BinaryArchiveBase.cc.

References edm::bufSize, EnergyCorrector::c, NanoAODEDMEventContent_cff::compressionLevel, MillePedeFileConverter_cfg::e, end, Vispa.Plugins.EdmBrowser.EdmDataAccessor::eq(), runEdmFileComparison::failed, corrVsCorr::filename, GENERS_BINARY_ARCHIVE_FORMAT_ID, mps_fire::i, recoMuon::in, funct::m, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, dataset::name, MillePedeFileConverter_cfg::out, parse_unsigned(), xuti::readHeader(), RecoTauValidation_cfi::reference, alignCSCRings::s, cond::persistency::search(), AlCaHLTBitMon_QueryRunRegistry::string, estimatePileup_makeJSON::trunc, mitigatedMETSequence_cff::U, relativeConstraints::value, and xuti::writeHeader().

35  {
36  char *endptr;
37  errno = 0;
38  const long value = strtol(c, &endptr, 0);
39  if (errno || *endptr != '\0') {
40  err << "expected an integer, got \"" << c << '"';
41  if (errno)
42  err << ", " << strerror(errno);
43  return false;
44  }
45  if (value < INT_MIN || value > INT_MAX) {
46  err << "integer value \"" << c << "\" is out of range";
47  return false;
48  }
49  *result = value;
50  return true;
51 }
Definition: value.py:1
static bool parse_unsigned ( std::ostringstream &  err,
const char *  c,
unsigned *  result 
)
static

Definition at line 17 of file BinaryArchiveBase.cc.

References relativeConstraints::value.

Referenced by parse_int().

17  {
18  char *endptr;
19  errno = 0;
20  const unsigned long value = strtoul(c, &endptr, 0);
21  if (errno || *endptr != '\0') {
22  err << "expected an unsigned integer, got \"" << c << '"';
23  if (errno)
24  err << ", " << strerror(errno);
25  return false;
26  }
27  if (value > UINT_MAX) {
28  err << "unsigned value \"" << c << "\" is out of range";
29  return false;
30  }
31  *result = value;
32  return true;
33 }
Definition: value.py:1