Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#ifndef GENERS_STRINGARCHIVEIO_HH_
#define GENERS_STRINGARCHIVEIO_HH_

#include "Alignment/Geners/interface/StringArchive.hh"

namespace gs {
  // The following function returns "true" on success,
  // "false" on failure.
  bool writeStringArchive(const StringArchive &ar, const char *filename);

  // The following function either succeeds or throws
  // an exception. The archive is created on the heap
  // and eventually has to be deleted by the user.
  StringArchive *readStringArchive(const char *filename);

  // Similar operations with compression
  bool writeCompressedStringArchive(const StringArchive &ar,
                                    const char *filename,
                                    unsigned compressionMode = 1U,
                                    int compressionLevel = -1,
                                    unsigned minSizeToCompress = 1024U,
                                    unsigned bufSize = 1048576U);

  StringArchive *readCompressedStringArchive(const char *filename);

  // The following function will write a compressed string archive
  // using default compression parameters if the file name has the
  // given suffix, otherwise it will write an uncompressed archive.
  // If the suffix is not provided (i.e., default value of 0 is used),
  // ".gssaz" will be assumed.
  bool writeCompressedStringArchiveExt(const StringArchive &ar, const char *filename, const char *suffix = nullptr);

  // The following function will attempt to read a compressed string
  // archive if the file name has the given suffix, otherwise it will
  // attempt to read an uncompressed archive. If the suffix is not
  // provided (i.e., default value of 0 is used), ".gssaz" will be assumed.
  StringArchive *readCompressedStringArchiveExt(const char *filename, const char *suffix = nullptr);

  // This function will extract one string archive from another
  StringArchive *loadStringArchiveFromArchive(AbsArchive &arch, unsigned long long id);
}  // namespace gs

#endif  // GENERS_STRINGARCHIVEIO_HH_