Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | List of all members
CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType > Class Template Reference

Default Base::DataInputHandler implementation that exposes a fixed Base::DataFormat and instantiates readers of the supplied stream-based ReaderImpl type (file-based readers are produced by wrapping it in Util::FileDataReader). More...

#include <DefaultDataInputHandler.hpp>

+ Inheritance diagram for CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType >:

Public Types

typedef Base::DataInputHandler< DataType >::ReaderType ReaderType
 Type of the Base::DataReader specialization produced by this handler. More...
 
- Public Types inherited from CDPL::Base::DataInputHandler< typename ReaderImpl::DataType >
typedef DataReader< typename ReaderImpl::DataType > ReaderType
 
typedef std::shared_ptr< DataInputHandlerSharedPointer
 

Public Member Functions

const Base::DataFormatgetDataFormat () const
 Returns the data format advertised by this handler. More...
 
ReaderType::SharedPointer createReader (std::istream &is) const
 Creates a reader that reads from the input stream is. More...
 
ReaderType::SharedPointer createReader (const std::string &file_name, std::ios_base::openmode mode) const
 Creates a reader that reads from the file file_name (opened in mode mode). More...
 
- Public Member Functions inherited from CDPL::Base::DataInputHandler< typename ReaderImpl::DataType >
virtual ~DataInputHandler ()
 Virtual destructor. More...
 

Detailed Description

template<typename ReaderImpl, const Base::DataFormat & Format, typename DataType = typename ReaderImpl::DataType>
class CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType >

Default Base::DataInputHandler implementation that exposes a fixed Base::DataFormat and instantiates readers of the supplied stream-based ReaderImpl type (file-based readers are produced by wrapping it in Util::FileDataReader).

Template Parameters
ReaderImplThe underlying stream-based reader implementation type.
FormatA reference to the Base::DataFormat constant advertised by the handler.
DataTypeThe data type read by ReaderImpl.

Member Typedef Documentation

◆ ReaderType

template<typename ReaderImpl , const Base::DataFormat & Format, typename DataType = typename ReaderImpl::DataType>
typedef Base::DataInputHandler<DataType>::ReaderType CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType >::ReaderType

Type of the Base::DataReader specialization produced by this handler.

Member Function Documentation

◆ getDataFormat()

template<typename ReaderImpl , const Base::DataFormat & Format, typename DataType = typename ReaderImpl::DataType>
const Base::DataFormat& CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType >::getDataFormat ( ) const
inlinevirtual

Returns the data format advertised by this handler.

Returns
A const reference to the fixed Base::DataFormat Format.

Implements CDPL::Base::DataInputHandler< typename ReaderImpl::DataType >.

◆ createReader() [1/2]

template<typename ReaderImpl , const Base::DataFormat & Format, typename DataType = typename ReaderImpl::DataType>
ReaderType::SharedPointer CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType >::createReader ( std::istream &  is) const
inlinevirtual

Creates a reader that reads from the input stream is.

Parameters
isThe input stream to wrap.
Returns
A shared pointer to a freshly constructed ReaderImpl.

Implements CDPL::Base::DataInputHandler< typename ReaderImpl::DataType >.

◆ createReader() [2/2]

template<typename ReaderImpl , const Base::DataFormat & Format, typename DataType = typename ReaderImpl::DataType>
ReaderType::SharedPointer CDPL::Util::DefaultDataInputHandler< ReaderImpl, Format, DataType >::createReader ( const std::string &  file_name,
std::ios_base::openmode  mode 
) const
inlinevirtual

Creates a reader that reads from the file file_name (opened in mode mode).

Parameters
file_nameThe path of the input file.
modeThe open mode of the underlying file stream.
Returns
A shared pointer to a freshly constructed Util::FileDataReader wrapping a ReaderImpl.

Implements CDPL::Base::DataInputHandler< typename ReaderImpl::DataType >.


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