Adds gzstream stream, exposes to swig (#2314)

* Move RDBoostStreams to RDStreams

* RDBoostStreams->RDStreams

* RDBoostStreams->RDStreams

* Wrap SWIG (with Java test)

* Fix missing declaration

* Use the file that already exists

* Revert to original version

* Revert to CXSMiles version

* Update boost version

* Remove redundant code

* Add zlib

* check for win32

* FileParsers now builds static on windows
This commit is contained in:
Brian Kelley
2019-03-18 00:32:42 -04:00
committed by Greg Landrum
parent 48c9532c6f
commit d2f716a2e4
13 changed files with 202 additions and 50 deletions

View File

@@ -0,0 +1,17 @@
find_package(Boost 1.56.0 COMPONENTS system iostreams REQUIRED)
set (link_iostreams ${Boost_LIBRARIES})
if (NOT Boost_USE_STATIC_LIBS)
add_definitions("-DBOOST_IOSTREAMS_DYN_LINK")
endif()
if (WIN32)
find_package(Boost 1.58.0 COMPONENTS zlib REQUIRED)
set(zlib_lib Boost::zlib)
endif()
add_definitions(-DRDKIT_RDSTREAMS_BUILD)
rdkit_library(RDStreams streams.cpp
LINK_LIBRARIES ${Boost_LIBRARIES} ${link_iostreams} ${zlib_lib}
DEST RDStreams)

View File

@@ -0,0 +1,11 @@
#include "streams.h"
namespace RDKit
{
gzstream::gzstream(const std::string &fname) :
boost::iostreams::filtering_istream(),
is(fname.c_str(), std::ios_base::binary) {
push(boost::iostreams::gzip_decompressor());
push(is);
}
}

16
Code/RDStreams/streams.h Normal file
View File

@@ -0,0 +1,16 @@
//
#include <RDGeneral/export.h>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
namespace RDKit
{
// gzstream from a file
class RDKIT_RDSTREAMS_EXPORT gzstream : public boost::iostreams::filtering_istream
{
std::ifstream is;
public:
gzstream(const std::string &fname);
};
}