CMS 3D CMS Logo

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

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

Definition at line 29 of file uriUtils.cc.

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

Referenced by joinDir1WithName2().

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  }
assert(be >=bs)
tuple filename
Definition: lut2db_cfg.py:20
std::string gs::fileTail ( const char *  filename)

Definition at line 19 of file uriUtils.cc.

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

Referenced by joinDir1WithName2().

19  {
21  const char *progname = std::strrchr(filename, '/');
22  if (progname)
23  ++progname;
24  else
25  progname = filename;
26  return std::string(progname);
27  }
assert(be >=bs)
tuple filename
Definition: lut2db_cfg.py:20
std::string gs::joinDir1WithName2 ( const char *  fname1,
const char *  fname2 
)

Definition at line 38 of file uriUtils.cc.

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

38  {
39  std::string res(fileDirname(fname1));
40  res += '/';
41  res += fileTail(fname2);
42  return res;
43  }
std::string fileDirname(const char *filename)
Definition: uriUtils.cc:29
std::string fileTail(const char *filename)
Definition: uriUtils.cc:19
StringArchive* gs::loadStringArchiveFromArchive ( AbsArchive &  arch,
const unsigned long long  id 
)

Definition at line 80 of file stringArchiveIO.cc.

References AlCaHLTBitMon_ParallelJobs::p.

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  }
std::string gs::localFileURI ( const char *  filename)

Definition at line 8 of file uriUtils.cc.

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

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  }
assert(be >=bs)
tuple filename
Definition: lut2db_cfg.py:20
StringArchive* gs::readCompressedStringArchive ( const char *  filename)

Definition at line 71 of file stringArchiveIO.cc.

References cms::cuda::assert().

Referenced by readCompressedStringArchiveExt().

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  }
assert(be >=bs)
tuple filename
Definition: lut2db_cfg.py:20
StringArchive* gs::readCompressedStringArchiveExt ( const char *  filename,
const char *  suffix 
)

Definition at line 92 of file stringArchiveIO.cc.

References readCompressedStringArchive(), readStringArchive(), and suffix_matches().

92  {
95  else
97  }
static bool suffix_matches(const char *filename, const char *suffix)
StringArchive * readCompressedStringArchive(const char *filename)
StringArchive * readStringArchive(const char *filename)
tuple filename
Definition: lut2db_cfg.py:20
StringArchive* gs::readStringArchive ( const char *  filename)

Definition at line 39 of file stringArchiveIO.cc.

References cms::cuda::assert().

Referenced by readCompressedStringArchiveExt().

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  }
assert(be >=bs)
tuple filename
Definition: lut2db_cfg.py:20
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  }
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.

References cms::cuda::assert(), visualization-live-secondInstance_cfg::m, haddnano::of, and mps_update::status.

Referenced by writeCompressedStringArchiveExt().

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  }
list status
Definition: mps_update.py:107
assert(be >=bs)
tuple of
Definition: haddnano.py:40
tuple filename
Definition: lut2db_cfg.py:20
bool gs::writeCompressedStringArchiveExt ( const StringArchive &  ar,
const char *  filename,
const char *  suffix 
)

Definition at line 99 of file stringArchiveIO.cc.

References suffix_matches(), writeCompressedStringArchive(), and writeStringArchive().

99  {
102  else
103  return writeStringArchive(ar, filename);
104  }
static bool suffix_matches(const char *filename, const char *suffix)
bool writeCompressedStringArchive(const StringArchive &ar, const char *filename, const unsigned inCompressionMode, const int compressionLevel, const unsigned minSizeToCompress, const unsigned bufSize)
tuple filename
Definition: lut2db_cfg.py:20
bool writeStringArchive(const StringArchive &ar, const char *filename)
bool gs::writeStringArchive ( const StringArchive &  ar,
const char *  filename 
)

Definition at line 26 of file stringArchiveIO.cc.

References cms::cuda::assert(), haddnano::of, and mps_update::status.

Referenced by writeCompressedStringArchiveExt().

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  }
list status
Definition: mps_update.py:107
assert(be >=bs)
tuple of
Definition: haddnano.py:40
tuple filename
Definition: lut2db_cfg.py:20