CMS 3D CMS Logo

Namespaces | Functions
stringArchiveIO.cc File Reference
#include "Alignment/Geners/interface/IOException.hh"
#include <cassert>
#include <cstring>
#include <fstream>
#include <sstream>
#include "Alignment/Geners/interface/CompressedIO.hh"
#include "Alignment/Geners/interface/Reference.hh"
#include "Alignment/Geners/interface/stringArchiveIO.hh"

Go to the source code of this file.

Namespaces

 gs
 

Functions

StringArchive * gs::loadStringArchiveFromArchive (AbsArchive &arch, const unsigned long long id)
 
StringArchive * gs::readCompressedStringArchive (const char *filename)
 
StringArchive * gs::readCompressedStringArchiveExt (const char *filename, const char *suffix)
 
StringArchive * gs::readStringArchive (const char *filename)
 
static bool suffix_matches (const char *filename, const char *suffix)
 
bool gs::writeCompressedStringArchive (const StringArchive &ar, const char *filename, const unsigned inCompressionMode, const int compressionLevel, const unsigned minSizeToCompress, const unsigned bufSize)
 
bool gs::writeCompressedStringArchiveExt (const StringArchive &ar, const char *filename, const char *suffix)
 
bool gs::writeStringArchive (const StringArchive &ar, const char *filename)
 

Function Documentation

static bool suffix_matches ( const char *  filename,
const char *  suffix 
)
static

Definition at line 12 of file stringArchiveIO.cc.

References mps_fire::i.

Referenced by gs::readCompressedStringArchiveExt(), and gs::writeCompressedStringArchiveExt().

12  {
13  static const char default_suffix[] = ".gssaz";
14  assert(filename);
15  if (suffix == nullptr)
16  suffix = default_suffix;
17  const std::size_t lenSuffix = strlen(suffix);
18  const std::size_t len = strlen(filename);
19  bool suffixMatches = len >= lenSuffix;
20  for (std::size_t i = 0; i < lenSuffix && suffixMatches; ++i)
21  suffixMatches = suffix[i] == filename[len - lenSuffix + i];
22  return suffixMatches;
23 }