2323
2424#include < boost/filesystem.hpp>
2525#include < boost/iostreams/device/file_descriptor.hpp>
26+ #ifdef ORE_USE_ZLIB
2627#include < boost/iostreams/filter/gzip.hpp>
28+ #endif
2729#include < boost/iostreams/filtering_stream.hpp>
2830
2931#include < iomanip>
@@ -34,11 +36,14 @@ namespace analytics {
3436namespace {
3537
3638bool use_compression (const std::string& filename) {
37-
39+ # ifdef ORE_USE_ZLIB
3840 // assume compression for all filenames that do not end with csv or txt
3941
4042 std::string extension = boost::filesystem::path (filename).extension ().string ();
4143 return extension != " .csv" && extension != " .txt" ;
44+ #else
45+ return false ;
46+ #endif
4247}
4348
4449std::string getMetaData (const std::string& line, const std::string& tag) {
@@ -61,8 +66,10 @@ boost::shared_ptr<NPVCube> loadCube(const std::string& filename, const bool doub
6166 bool gzip = use_compression (filename);
6267 std::ifstream in1 (filename, gzip ? (std::ios::binary | std::ios::in) : std::ios::in);
6368 boost::iostreams::filtering_stream<boost::iostreams::input> in;
69+ #ifdef ORE_USE_ZLIB
6470 if (gzip)
6571 in.push (boost::iostreams::gzip_decompressor ());
72+ #endif
6673 in.push (in1);
6774
6875 // read meta data
@@ -142,8 +149,10 @@ void saveCube(const std::string& filename, const NPVCube& cube, const bool doubl
142149 bool gzip = use_compression (filename);
143150 std::ofstream out1 (filename, gzip ? (std::ios::binary | std::ios::out) : std::ios::out);
144151 boost::iostreams::filtering_stream<boost::iostreams::output> out;
152+ #ifdef ORE_USE_ZLIB
145153 if (gzip)
146154 out.push (boost::iostreams::gzip_compressor (/* boost::iostreams::gzip_params(9)*/ ));
155+ #endif
147156 out.push (out1);
148157
149158 // write meta data (tag width is hardcoded and used in getMetaData())
@@ -195,8 +204,10 @@ boost::shared_ptr<AggregationScenarioData> loadAggregationScenarioData(const std
195204 bool gzip = use_compression (filename);
196205 std::ifstream in1 (filename, gzip ? (std::ios::binary | std::ios::in) : std::ios::in);
197206 boost::iostreams::filtering_stream<boost::iostreams::input> in;
207+ #ifdef ORE_USE_ZLIB
198208 if (gzip)
199209 in.push (boost::iostreams::gzip_decompressor ());
210+ #endif
200211 in.push (in1);
201212
202213 // read meta data
@@ -261,8 +272,10 @@ void saveAggregationScenarioData(const std::string& filename, const AggregationS
261272 bool gzip = use_compression (filename);
262273 std::ofstream out1 (filename, gzip ? (std::ios::binary | std::ios::out) : std::ios::out);
263274 boost::iostreams::filtering_stream<boost::iostreams::output> out;
275+ #ifdef ORE_USE_ZLIB
264276 if (gzip)
265277 out.push (boost::iostreams::gzip_compressor (/* boost::iostreams::gzip_params(9)*/ ));
278+ #endif
266279 out.push (out1);
267280
268281 // write meta data (tag width is hardcoded and used in getMetaData())
0 commit comments