CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.

Function Documentation

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

Definition at line 38 of file BinaryArchiveBase.cc.

References relativeConstraints::value.

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 }
tuple result
Definition: query.py:137
static bool parse_unsigned ( std::ostringstream &  err,
const char *  c,
unsigned *  result 
)
static

Definition at line 17 of file BinaryArchiveBase.cc.

References relativeConstraints::value.

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 }
tuple result
Definition: query.py:137