DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Private Attributes | Friends | List of all members
dd4hep::dd4hep_file< T > Class Template Reference

dd4hep file handling extension to boost::iostreams More...

#include <IoStreams.h>

Classes

struct  category
 Helper structure to define boost::iostreams. More...
 

Public Types

typedef T handle_type
 
typedef char char_type
 
typedef boost::iostreams::stream_offset stream_offset
 
typedef boost::iostreams::detail::path detail_path
 

Public Member Functions

 dd4hep_file ()=default
 Default constructor. More...
 
 dd4hep_file (handle_type fd, dd4hep_file_flags)
 Constructors taking file desciptors. More...
 
 dd4hep_file (const char *fname, BOOST_IOS::openmode mode)
 Constructors taking file desciptors. More...
 
void open (handle_type fd, dd4hep_file_flags flags)
 Default destructor. More...
 
void open (const char *path, BOOST_IOS::openmode mode=BOOST_IOS::in|BOOST_IOS::out)
 open overload taking C-style string More...
 
void close ()
 Close the file stream. More...
 
std::streamsize read (char_type *s, std::streamsize n)
 Read from input stream. More...
 
std::streamsize write (const char_type *s, std::streamsize n)
 Write to output stream. More...
 
std::streampos seek (stream_offset off, BOOST_IOS::seekdir way)
 Direct access: set file pointer of the stream. More...
 
bool is_open () const
 Check if the file stream is opened. More...
 
handle_type handle () const
 Access to native stream handle. More...
 
void open (const char *path, BOOST_IOS::openmode mode)
 Specialization for standard file descriptor files according to the posix standard. More...
 
 dd4hep_file (handle_type fd, dd4hep_file_flags flags)
 Specialization for standard file descriptor files according to the posix standard. More...
 
 dd4hep_file (const char *fn, BOOST_IOS::openmode mode)
 Specialization for standard file descriptor files according to the posix standard. More...
 
std::streamsize read (char_type *s, std::streamsize n)
 Specialization for standard file descriptor files according to the posix standard. More...
 
std::streamsize write (const char_type *s, std::streamsize n)
 Specialization for standard file descriptor files according to the posix standard. More...
 
std::streampos seek (stream_offset off, BOOST_IOS::seekdir way)
 Specialization for standard file descriptor files according to the posix standard. More...
 
void close ()
 Specialization for standard file descriptor files according to the posix standard. More...
 
void open (const char *path, BOOST_IOS::openmode mode)
 Specialization for the usage of TFile structures. More...
 
 dd4hep_file (handle_type fd, dd4hep_file_flags flags)
 Specialization for the usage of TFile structures. More...
 
 dd4hep_file (const char *fname, BOOST_IOS::openmode mode)
 Specialization for the usage of TFile structures. More...
 
std::streamsize read (char_type *s, std::streamsize n)
 Specialization for the usage of TFile structures. More...
 
std::streamsize write (const char_type *s, std::streamsize n)
 Specialization for the usage of TFile structures. More...
 
std::streampos seek (stream_offset off, BOOST_IOS::seekdir way)
 Specialization for the usage of TFile structures. More...
 
void close ()
 Specialization for the usage of TFile structures. More...
 

Private Attributes

handle_type m_handle = 0
 Native stream handle. More...
 
dd4hep_file_flags m_flag = close_handle
 Stream flag(s) More...
 

Friends

class dd4hep_file_source< T >
 
class dd4hep_file_sink< T >
 

Detailed Description

template<typename T>
class dd4hep::dd4hep_file< T >

dd4hep file handling extension to boost::iostreams

Basic file handling for data sources and data sinks. Please see boost::iostreams for details. This got inspired by boost::iostreams::device::file_descriptor

The final aim is to hide all this behind a TFile object, so that we get the entire network file handling for free!

Note: Credits go to a large extend to the authors of boost::iostreams. Without their work I could not have done this!

Author
M.Frank
Version
1.0
See also
http://www.boost.org/libs/iostreams for further documentation.

Definition at line 73 of file IoStreams.h.

Member Typedef Documentation

◆ char_type

template<typename T >
typedef char dd4hep::dd4hep_file< T >::char_type

Definition at line 78 of file IoStreams.h.

◆ detail_path

template<typename T >
typedef boost::iostreams::detail::path dd4hep::dd4hep_file< T >::detail_path

Definition at line 80 of file IoStreams.h.

◆ handle_type

template<typename T >
typedef T dd4hep::dd4hep_file< T >::handle_type

Definition at line 77 of file IoStreams.h.

◆ stream_offset

template<typename T >
typedef boost::iostreams::stream_offset dd4hep::dd4hep_file< T >::stream_offset

Definition at line 79 of file IoStreams.h.

Constructor & Destructor Documentation

◆ dd4hep_file() [1/7]

template<typename T >
dd4hep::dd4hep_file< T >::dd4hep_file ( )
default

Default constructor.

◆ dd4hep_file() [2/7]

template<typename T >
dd4hep::dd4hep_file< T >::dd4hep_file ( handle_type  fd,
dd4hep_file_flags   
)

Constructors taking file desciptors.

◆ dd4hep_file() [3/7]

template<typename T >
dd4hep::dd4hep_file< T >::dd4hep_file ( const char *  fname,
BOOST_IOS::openmode  mode 
)

Constructors taking file desciptors.

◆ dd4hep_file() [4/7]

Specialization for standard file descriptor files according to the posix standard.

Definition at line 51 of file IoStreams.cpp.

◆ dd4hep_file() [5/7]

dd4hep::dd4hep_file< int >::dd4hep_file ( const char *  fn,
BOOST_IOS::openmode  mode 
)

Specialization for standard file descriptor files according to the posix standard.

Definition at line 55 of file IoStreams.cpp.

◆ dd4hep_file() [6/7]

Specialization for the usage of TFile structures.

Definition at line 97 of file IoStreams.cpp.

◆ dd4hep_file() [7/7]

dd4hep::dd4hep_file< TFile * >::dd4hep_file ( const char *  fname,
BOOST_IOS::openmode  mode 
)

Specialization for the usage of TFile structures.

Definition at line 101 of file IoStreams.cpp.

Member Function Documentation

◆ close() [1/3]

void dd4hep::dd4hep_file< int >::close ( )

Specialization for standard file descriptor files according to the posix standard.

Definition at line 71 of file IoStreams.cpp.

◆ close() [2/3]

template<typename T >
void dd4hep::dd4hep_file< T >::close ( )

Close the file stream.

◆ close() [3/3]

void dd4hep::dd4hep_file< TFile * >::close ( )

Specialization for the usage of TFile structures.

Definition at line 126 of file IoStreams.cpp.

◆ handle()

template<typename T >
handle_type dd4hep::dd4hep_file< T >::handle ( ) const
inline

Access to native stream handle.

Definition at line 107 of file IoStreams.h.

◆ is_open()

template<typename T >
bool dd4hep::dd4hep_file< T >::is_open ( ) const
inline

Check if the file stream is opened.

Definition at line 105 of file IoStreams.h.

◆ open() [1/4]

void dd4hep::dd4hep_file< int >::open ( const char *  path,
BOOST_IOS::openmode  mode 
)

Specialization for standard file descriptor files according to the posix standard.

Definition at line 45 of file IoStreams.cpp.

◆ open() [2/4]

void dd4hep::dd4hep_file< TFile * >::open ( const char *  path,
BOOST_IOS::openmode  mode 
)

Specialization for the usage of TFile structures.

Definition at line 77 of file IoStreams.cpp.

◆ open() [3/4]

template<typename T >
void dd4hep::dd4hep_file< T >::open ( const char *  path,
BOOST_IOS::openmode  mode = BOOST_IOS::in|BOOST_IOS::out 
)

open overload taking C-style string

◆ open() [4/4]

template<typename T >
void dd4hep::dd4hep_file< T >::open ( handle_type  fd,
dd4hep_file_flags  flags 
)

Default destructor.

open overloads taking file descriptors

◆ read() [1/3]

std::streamsize dd4hep::dd4hep_file< int >::read ( char_type s,
std::streamsize  n 
)

Specialization for standard file descriptor files according to the posix standard.

Definition at line 59 of file IoStreams.cpp.

◆ read() [2/3]

template<typename T >
std::streamsize dd4hep::dd4hep_file< T >::read ( char_type s,
std::streamsize  n 
)

Read from input stream.

◆ read() [3/3]

std::streamsize dd4hep::dd4hep_file< TFile * >::read ( char_type s,
std::streamsize  n 
)

Specialization for the usage of TFile structures.

Definition at line 105 of file IoStreams.cpp.

◆ seek() [1/3]

std::streampos dd4hep::dd4hep_file< int >::seek ( stream_offset  off,
BOOST_IOS::seekdir  way 
)

Specialization for standard file descriptor files according to the posix standard.

Definition at line 67 of file IoStreams.cpp.

◆ seek() [2/3]

template<typename T >
std::streampos dd4hep::dd4hep_file< T >::seek ( stream_offset  off,
BOOST_IOS::seekdir  way 
)

Direct access: set file pointer of the stream.

◆ seek() [3/3]

std::streampos dd4hep::dd4hep_file< TFile * >::seek ( stream_offset  off,
BOOST_IOS::seekdir  way 
)

Specialization for the usage of TFile structures.

Definition at line 122 of file IoStreams.cpp.

◆ write() [1/3]

std::streamsize dd4hep::dd4hep_file< int >::write ( const char_type s,
std::streamsize  n 
)

Specialization for standard file descriptor files according to the posix standard.

Definition at line 63 of file IoStreams.cpp.

◆ write() [2/3]

template<typename T >
std::streamsize dd4hep::dd4hep_file< T >::write ( const char_type s,
std::streamsize  n 
)

Write to output stream.

◆ write() [3/3]

std::streamsize dd4hep::dd4hep_file< TFile * >::write ( const char_type s,
std::streamsize  n 
)

Specialization for the usage of TFile structures.

Definition at line 118 of file IoStreams.cpp.

Friends And Related Function Documentation

◆ dd4hep_file_sink< T >

template<typename T >
friend class dd4hep_file_sink< T >
friend

Definition at line 1 of file IoStreams.h.

◆ dd4hep_file_source< T >

template<typename T >
friend class dd4hep_file_source< T >
friend

Definition at line 1 of file IoStreams.h.

Member Data Documentation

◆ m_flag

template<typename T >
dd4hep_file_flags dd4hep::dd4hep_file< T >::m_flag = close_handle
private

Stream flag(s)

Definition at line 113 of file IoStreams.h.

◆ m_handle

template<typename T >
handle_type dd4hep::dd4hep_file< T >::m_handle = 0
private

Native stream handle.

Definition at line 111 of file IoStreams.h.


The documentation for this class was generated from the following file: