CMS 3D CMS Logo

Namespaces | Functions
gs Namespace Reference

Namespaces

 Private
 

Functions

std::string fileDirname (const char *filename)
 
std::string fileTail (const char *filename)
 
std::string joinDir1WithName2 (const char *fname1, const char *fname2)
 
StringArchive * loadStringArchiveFromArchive (AbsArchive &arch, const unsigned long long id)
 
std::string localFileURI (const char *filename)
 
StringArchive * readCompressedStringArchive (const char *filename)
 
StringArchive * readCompressedStringArchiveExt (const char *filename, const char *suffix)
 
StringArchive * readStringArchive (const char *filename)
 
bool writeBinaryCatalog (std::ostream &os, const unsigned compressionCode, const unsigned mergeLevel, const std::vector< std::string > &annotations, const AbsCatalog &catalog, const unsigned formatId)
 
bool writeCompressedStringArchive (const StringArchive &ar, const char *filename, const unsigned inCompressionMode, const int compressionLevel, const unsigned minSizeToCompress, const unsigned bufSize)
 
bool writeCompressedStringArchiveExt (const StringArchive &ar, const char *filename, const char *suffix)
 
bool writeStringArchive (const StringArchive &ar, const char *filename)
 

Function Documentation

◆ fileDirname()

std::string gs::fileDirname ( const char *  filename)

Definition at line 29 of file uriUtils.cc.

29  {
31  const char *progname = std::strrchr(filename, '/');
32  if (progname)
33  return std::string(filename, progname - filename);
34  else
35  return std::string(".");
36  }

References cms::cuda::assert(), corrVsCorr::filename, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by joinDir1WithName2().

◆ fileTail()

std::string gs::fileTail ( const char *  filename)

Definition at line 19 of file uriUtils.cc.

19  {
21  const char *progname = std::strrchr(filename, '/');
22  if (progname)
23  ++progname;
24  else
25  progname = filename;
26  return std::string(progname);
27  }

References cms::cuda::assert(), corrVsCorr::filename, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by joinDir1WithName2().

◆ joinDir1WithName2()

std::string gs::joinDir1WithName2 ( const char *  fname1,
const char *  fname2 
)

Definition at line 38 of file uriUtils.cc.

38  {
39  std::string res(fileDirname(fname1));
40  res += '/';
41  res += fileTail(fname2);
42  return res;
43  }

References fileDirname(), fileTail(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ loadStringArchiveFromArchive()

StringArchive* gs::loadStringArchiveFromArchive ( AbsArchive &  arch,
const unsigned long long  id 
)

Definition at line 80 of file stringArchiveIO.cc.

80  {
81  Reference<StringArchive> ref(arch, id);
82  if (!ref.unique()) {
83  std::ostringstream os;
84  os << "In gs::loadStringArchiveFromArchive: "
85  << "StringArchive item with id " << id << " not found";
86  throw gs::IOInvalidArgument(os.str());
87  }
88  CPP11_auto_ptr<StringArchive> p = ref.get(0);
89  return p.release();
90  }

References AlCaHLTBitMon_ParallelJobs::p.

◆ localFileURI()

std::string gs::localFileURI ( const char *  filename)

Definition at line 8 of file uriUtils.cc.

8  {
10  if (strlen(filename) == 0)
11  throw gs::IOInvalidArgument("In gs::localFileURI: empty file name");
12  std::string uri("file://");
13  if (filename[0] != '/')
14  uri += "./";
15  uri += filename;
16  return uri;
17  }

References cms::cuda::assert(), corrVsCorr::filename, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ readCompressedStringArchive()

StringArchive* gs::readCompressedStringArchive ( const char *  filename)

Definition at line 71 of file stringArchiveIO.cc.

71  {
73  std::ifstream is(filename, std::ios_base::binary);
74  if (!is.is_open())
75  throw IOOpeningFailure("gs::readCompressedStringArchive", filename);
76  CPP11_auto_ptr<StringArchive> ar = read_compressed_item<StringArchive>(is);
77  return ar.release();
78  }

References cms::cuda::assert(), and corrVsCorr::filename.

Referenced by readCompressedStringArchiveExt().

◆ readCompressedStringArchiveExt()

StringArchive* gs::readCompressedStringArchiveExt ( const char *  filename,
const char *  suffix 
)

◆ readStringArchive()

StringArchive* gs::readStringArchive ( const char *  filename)

Definition at line 39 of file stringArchiveIO.cc.

39  {
41  std::ifstream is(filename, std::ios_base::binary);
42  if (!is.is_open())
43  throw IOOpeningFailure("gs::readStringArchive", filename);
44  CPP11_auto_ptr<StringArchive> ar = read_item<StringArchive>(is);
45  return ar.release();
46  }

References cms::cuda::assert(), and corrVsCorr::filename.

Referenced by readCompressedStringArchiveExt().

◆ writeBinaryCatalog()

bool gs::writeBinaryCatalog ( std::ostream &  os,
const unsigned  compressionCode,
const unsigned  mergeLevel,
const std::vector< std::string > &  annotations,
const AbsCatalog &  catalog,
const unsigned  formatId 
)

Definition at line 4 of file CatalogIO.cc.

9  {
10  os.seekp(0, std::ios_base::beg);
11 
12  const unsigned endianness = 0x01020304;
13  const unsigned char sizelong = sizeof(long);
14 
15  write_pod(os, formatId);
16  write_pod(os, endianness);
17  write_pod(os, sizelong);
18  write_pod(os, compressionCode);
19  write_pod(os, mergeLevel);
20  write_pod_vector(os, annotations);
21 
22  return !os.fail() && catalog.classId().write(os) && catalog.write(os);
23  }

References getEcalConditions_orcoffint2r_cff::catalog.

◆ writeCompressedStringArchive()

bool gs::writeCompressedStringArchive ( const StringArchive &  ar,
const char *  filename,
const unsigned  inCompressionMode,
const int  compressionLevel,
const unsigned  minSizeToCompress,
const unsigned  bufSize 
)

Definition at line 48 of file stringArchiveIO.cc.

53  {
55  if (inCompressionMode > CStringStream::BZIP2)
56  throw gs::IOInvalidArgument(
57  "In gs::writeCompressedStringArchive: "
58  "compression mode argument out of range");
59  const CStringStream::CompressionMode m = static_cast<CStringStream::CompressionMode>(inCompressionMode);
60  bool status = false;
61  {
62  std::ofstream of(filename, std::ios_base::binary);
63  if (of.is_open()) {
64  const_cast<StringArchive &>(ar).flush();
65  status = write_compressed_item(of, ar, m, compressionLevel, minSizeToCompress, bufSize);
66  }
67  }
68  return status;
69  }

References cms::cuda::assert(), edm::bufSize, NanoAODEDMEventContent_cff::compressionLevel, corrVsCorr::filename, visualization-live-secondInstance_cfg::m, and mps_update::status.

Referenced by writeCompressedStringArchiveExt().

◆ writeCompressedStringArchiveExt()

bool gs::writeCompressedStringArchiveExt ( const StringArchive &  ar,
const char *  filename,
const char *  suffix 
)

◆ writeStringArchive()

bool gs::writeStringArchive ( const StringArchive &  ar,
const char *  filename 
)

Definition at line 26 of file stringArchiveIO.cc.

26  {
28  bool status = false;
29  {
30  std::ofstream of(filename, std::ios_base::binary);
31  if (of.is_open()) {
32  const_cast<StringArchive &>(ar).flush();
33  status = write_item(of, ar);
34  }
35  }
36  return status;
37  }

References cms::cuda::assert(), corrVsCorr::filename, and mps_update::status.

Referenced by writeCompressedStringArchiveExt().

gs::writeStringArchive
bool writeStringArchive(const StringArchive &ar, const char *filename)
Definition: stringArchiveIO.cc:26
edm::bufSize
static const int bufSize
Definition: Guid.cc:23
getEcalConditions_orcoffint2r_cff.catalog
catalog
Definition: getEcalConditions_orcoffint2r_cff.py:40
gs::fileDirname
std::string fileDirname(const char *filename)
Definition: uriUtils.cc:29
mps_update.status
status
Definition: mps_update.py:69
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::assert
assert(be >=bs)
gs::readCompressedStringArchive
StringArchive * readCompressedStringArchive(const char *filename)
Definition: stringArchiveIO.cc:71
createPayload.suffix
suffix
Definition: createPayload.py:281
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
gs::readStringArchive
StringArchive * readStringArchive(const char *filename)
Definition: stringArchiveIO.cc:39
gs::fileTail
std::string fileTail(const char *filename)
Definition: uriUtils.cc:19
suffix_matches
static bool suffix_matches(const char *filename, const char *suffix)
Definition: stringArchiveIO.cc:12
res
Definition: Electron.h:6
gs::writeCompressedStringArchive
bool writeCompressedStringArchive(const StringArchive &ar, const char *filename, const unsigned inCompressionMode, const int compressionLevel, const unsigned minSizeToCompress, const unsigned bufSize)
Definition: stringArchiveIO.cc:48
NanoAODEDMEventContent_cff.compressionLevel
compressionLevel
Definition: NanoAODEDMEventContent_cff.py:15