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

◆ GENERS_BINARY_ARCHIVE_FORMAT_ID

#define GENERS_BINARY_ARCHIVE_FORMAT_ID   (0x1f2e3d4c)

Definition at line 15 of file BinaryArchiveBase.cc.

Function Documentation

◆ parse_int()

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

Definition at line 35 of file BinaryArchiveBase.cc.

References c, submitPVResolutionJobs::err, mps_fire::result, and relativeConstraints::value.

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

◆ parse_unsigned()

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

Definition at line 17 of file BinaryArchiveBase.cc.

References c, submitPVResolutionJobs::err, mps_fire::result, and relativeConstraints::value.

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