CMS 3D CMS Logo

Namespaces | Macros | Functions
BinaryArchiveBase.cc File Reference
#include <cerrno>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#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 38 of file BinaryArchiveBase.cc.

References edm::bufSize, EnergyCorrector::c, 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().

40 {
41  char *endptr;
42  errno = 0;
43  const long value = strtol(c, &endptr, 0);
44  if (errno || *endptr != '\0')
45  {
46  err << "expected an integer, got \"" << c << '"';
47  if (errno) err << ", " << strerror(errno);
48  return false;
49  }
50  if (value < INT_MIN || value > INT_MAX)
51  {
52  err << "integer value \"" << c << "\" is out of range";
53  return false;
54  }
55  *result = value;
56  return true;
57 }
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().

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