CMS 3D CMS Logo

Namespaces | Defines | Functions

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/Alignment/Geners/src/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

namespace  gs

Defines

#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)

Define 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.

{
    char *endptr;
    errno = 0;
    const long value = strtol(c, &endptr, 0);
    if (errno || *endptr != '\0')
    {
        err << "expected an integer, got \"" << c << '"';
        if (errno) err << ", " << strerror(errno);
        return false;
    }
    if (value < INT_MIN || value > INT_MAX)
    {
        err << "integer value \"" << c << "\" is out of range";
        return false;
    }
    *result = value;
    return true;
}
static bool parse_unsigned ( std::ostringstream &  err,
const char *  c,
unsigned *  result 
) [static]

Definition at line 17 of file BinaryArchiveBase.cc.

References relativeConstraints::value.

{
    char *endptr;
    errno = 0;
    const unsigned long value = strtoul(c, &endptr, 0);
    if (errno || *endptr != '\0')
    {
        err << "expected an unsigned integer, got \"" << c << '"';
        if (errno) err << ", " << strerror(errno);
        return false;
    }
    if (value > UINT_MAX)
    {
        err << "unsigned value \"" << c << "\" is out of range";
        return false;
    }
    *result = value;
    return true;
}