14 #ifndef DD4HEP_DD4HEP_IOSTREAMS_H
15 #define DD4HEP_DD4HEP_IOSTREAMS_H
21 #pragma GCC diagnostic push
22 #pragma GCC diagnostic ignored "-Wshadow" // Code that causes warning goes here
26 #include <boost/iostreams/categories.hpp>
27 #include <boost/iostreams/detail/ios.hpp>
28 #include <boost/iostreams/detail/path.hpp>
29 #include <boost/iostreams/positioning.hpp>
33 #define __DD4HEP_LOCAL_GNUC__ __GNUC__
35 #include <boost/iostreams/stream.hpp>
36 #define __GNUC__ __DD4HEP_LOCAL_GNUC__
38 #include <boost/iostreams/stream.hpp>
82 struct category : boost::iostreams::seekable_device_tag, boost::iostreams::closable_tag { };
89 dd4hep_file(
const char* fname, BOOST_IOS::openmode mode);
95 void open(
const char* path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out );
130 struct category : boost::iostreams::input_seekable,
131 boost::iostreams::device_tag,
132 boost::iostreams::closable_tag { };
161 void open(
const char* path, BOOST_IOS::openmode mode = BOOST_IOS::in)
165 void open(
const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in)
166 {
open(path.c_str(), mode); }
169 template<
typename Path>
void open(
const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::in)
191 template <
typename T>
192 class dd4hep_file_sink :
private dd4hep_file<T> {
195 struct category : boost::iostreams::output_seekable,
196 boost::iostreams::device_tag,
197 boost::iostreams::closable_tag { };
218 explicit dd4hep_file_sink(
const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::out)
226 template<
typename Path>
235 void open(
const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::out )
236 {
open(path.c_str(),mode); }
239 void open(
const char* path, BOOST_IOS::openmode mode = BOOST_IOS::out )
243 template<
typename Path>
void open(
const Path& path, BOOST_IOS::openmode mode = BOOST_IOS::out )
250 #pragma GCC diagnostic pop
253 #endif // DD4HEP_DD4HEP_IOSTREAMs_H
std::streampos seek(stream_offset off, BOOST_IOS::seekdir way)
DD4hep file handling extension to boost::iostreams.
void open(const std::string &path, BOOST_IOS::openmode mode=BOOST_IOS::out)
open overload taking a std::string
descriptor::char_type char_type
dd4hep_file_sink(const Path &path, BOOST_IOS::openmode mode=BOOST_IOS::out)
Constructor taking a Boost.Filesystem path.
dd4hep_file_source(const char *name, BOOST_IOS::openmode mode=BOOST_IOS::in)
Constructors taking file desciptors.
void open(const Path &path, BOOST_IOS::openmode mode=BOOST_IOS::in)
open overload taking a Boost.Filesystem path
dd4hep_file_source()
Default Constructor.
dd4hep_file_sink(const char *path, BOOST_IOS::openmode mode=BOOST_IOS::out)
Constructor taking a C-style string.
descriptor::handle_type handle_type
dd4hep_file_source(const dd4hep_file_source< T > &other)
Copy constructor.
boost::iostreams::stream_offset stream_offset
dd4hep_file_sink(const std::string &path, BOOST_IOS::openmode mode=BOOST_IOS::out)
Constructor taking a std::string.
dd4hep_file_sink(handle_type fd, dd4hep_file_flags flags)
Constructors taking file desciptors.
dd4hep_file< T > descriptor
dd4hep_file_source(handle_type h, dd4hep_file_flags flags)
Constructors taking file desciptors.
void open(const char *path, BOOST_IOS::openmode mode=BOOST_IOS::out)
open overload taking C-style string
boost::iostreams::detail::path detail_path
descriptor::handle_type handle_type
std::streamsize read(char_type *s, std::streamsize n)
dd4hep_file< T > descriptor
DD4hep file sink extension to boost::iostreams.
dd4hep_file_sink()
Default constructor.
void open(const std::string &path, BOOST_IOS::openmode mode=BOOST_IOS::in)
open overload taking a std::string
void open(const char *path, BOOST_IOS::openmode mode=BOOST_IOS::in)
open overload taking C-style string
std::streamsize write(const char_type *s, std::streamsize n)
void open(handle_type h, dd4hep_file_flags flags)
open overload taking file desciptors
handle_type handle() const
DD4hep file source extension to boost::iostreams.
descriptor::char_type char_type
void open(handle_type fd, dd4hep_file_flags flags)
dd4hep_file_sink(const dd4hep_file_sink< T > &other)
Copy constructor.
void open(const Path &path, BOOST_IOS::openmode mode=BOOST_IOS::out)
open overload taking a Boost.Filesystem path
void open(handle_type fd, dd4hep_file_flags flags)
open overloads taking file descriptors