Warning, file /acts/Examples/Io/HepMC3/src/CompressedIO.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef HEPMC3_COMPRESSEDIO_H
0025 #define HEPMC3_COMPRESSEDIO_H
0026 #if HEPMC3_USE_COMPRESSION
0027 #if HEPMC3_Z_SUPPORT
0028 #define BXZSTR_Z_SUPPORT 1
0029 #endif
0030 #if HEPMC3_LZMA_SUPPORT
0031 #define BXZSTR_LZMA_SUPPORT 1
0032 #endif
0033 #if HEPMC3_BZ2_SUPPORT
0034 #define BXZSTR_BZ2_SUPPORT 1
0035 #endif
0036 #if HEPMC3_ZSTD_SUPPORT
0037 #define BXZSTR_ZSTD_SUPPORT 1
0038 #endif
0039 #endif
0040 #include "HepMC3/bxzstr/bxzstr.hpp"
0041
0042 #include <array>
0043
0044 namespace HepMC3
0045 {
0046 using ofstream = bxz::ofstream;
0047 using ostream = bxz::ostream;
0048 using ifstream = bxz::ifstream;
0049 using istream = bxz::istream;
0050
0051 using Compression = bxz::Compression;
0052
0053 inline Compression detect_compression_type(char* in_buff_start, char* in_buff_end) {
0054 return bxz::detect_type(in_buff_start,in_buff_end);
0055 }
0056
0057 constexpr int num_supported_compression_types = 0
0058 #if HEPMC3_Z_SUPPORT
0059 +1
0060 #endif
0061 #if HEPMC3_LZMA_SUPPORT
0062 +1
0063 #endif
0064 #if HEPMC3_BZ2_SUPPORT
0065 +1
0066 #endif
0067 #if HEPMC3_ZSTD_SUPPORT
0068 +1
0069 #endif
0070 ;
0071
0072 constexpr std::array<Compression,num_supported_compression_types> supported_compression_types{
0073 #if HEPMC3_Z_SUPPORT
0074 Compression::z,
0075 #endif
0076 #if HEPMC3_LZMA_SUPPORT
0077 Compression::lzma,
0078 #endif
0079 #if HEPMC3_BZ2_SUPPORT
0080 Compression::bz2,
0081 #endif
0082 #if HEPMC3_ZSTD_SUPPORT
0083 Compression::zstd,
0084 #endif
0085 };
0086
0087 constexpr std::array<Compression, 4> known_compression_types{
0088 Compression::z,
0089 Compression::lzma,
0090 Compression::bz2,
0091 Compression::zstd,
0092 };
0093
0094
0095 inline std::string to_string(HepMC3::Compression & c) {
0096 switch (c) {
0097 case HepMC3::Compression::z:
0098 return std::string("z");
0099 case HepMC3::Compression::lzma:
0100 return std::string("lzma");
0101 case HepMC3::Compression::bz2:
0102 return std::string("bz2");
0103 case HepMC3::Compression::zstd:
0104 return std::string("zstd");
0105 default:
0106 break;
0107 }
0108 return std::string("plaintext");
0109 }
0110
0111 }
0112
0113 inline std::ostream& operator<<(std::ostream& os, HepMC3::Compression & c) {
0114 return os << HepMC3::to_string(c);
0115 }
0116
0117
0118 #endif