mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
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:
committed by
Greg Landrum
parent
48c9532c6f
commit
d2f716a2e4
17
Code/RDStreams/CMakeLists.txt
Normal file
17
Code/RDStreams/CMakeLists.txt
Normal 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)
|
||||
|
||||
|
||||
11
Code/RDStreams/streams.cpp
Normal file
11
Code/RDStreams/streams.cpp
Normal 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
16
Code/RDStreams/streams.h
Normal 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);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user