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

Default Base::DataOutputHandler implementation that exposes a fixed Base::DataFormat and instantiates writers of the supplied stream-based WriterImpl type (file-based writers are produced by wrapping it in Util::FileDataWriter). More...

#include <DefaultDataOutputHandler.hpp>

+ Inheritance diagram for CDPL::Util::DefaultDataOutputHandler< WriterImpl, FORMAT, DataType >:

Public Types

typedef Base::DataOutputHandler< DataType >::WriterType WriterType
 Type of the Base::DataWriter specialization produced by this handler. More...
 
- Public Types inherited from CDPL::Base::DataOutputHandler< typename WriterImpl::DataType >
typedef DataWriter< typename WriterImpl::DataType > WriterType
 
typedef std::shared_ptr< DataOutputHandlerSharedPointer
 

Public Member Functions

const Base::DataFormatgetDataFormat () const
 Returns the data format advertised by this handler. More...
 
WriterType::SharedPointer createWriter (std::ostream &os) const
 Creates a writer that writes to the output stream os. More...
 
WriterType::SharedPointer createWriter (const std::string &file_name, std::ios_base::openmode mode) const
 Creates a writer that writes to the file file_name (opened in mode mode). More...
 
- Public Member Functions inherited from CDPL::Base::DataOutputHandler< typename WriterImpl::DataType >
virtual ~DataOutputHandler ()
 Virtual destructor. More...
 

Detailed Description

template<typename WriterImpl, const Base::DataFormat & FORMAT, typename DataType = typename WriterImpl::DataType>
class CDPL::Util::DefaultDataOutputHandler< WriterImpl, FORMAT, DataType >

Default Base::DataOutputHandler implementation that exposes a fixed Base::DataFormat and instantiates writers of the supplied stream-based WriterImpl type (file-based writers are produced by wrapping it in Util::FileDataWriter).

Template Parameters
WriterImplThe underlying stream-based writer implementation type.
FORMATA reference to the Base::DataFormat constant advertised by the handler.
DataTypeThe data type written by WriterImpl.

Member Typedef Documentation

◆ WriterType

template<typename WriterImpl , const Base::DataFormat & FORMAT, typename DataType = typename WriterImpl::DataType>
typedef Base::DataOutputHandler<DataType>::WriterType CDPL::Util::DefaultDataOutputHandler< WriterImpl, FORMAT, DataType >::WriterType

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

Member Function Documentation

◆ getDataFormat()

template<typename WriterImpl , const Base::DataFormat & FORMAT, typename DataType = typename WriterImpl::DataType>
const Base::DataFormat& CDPL::Util::DefaultDataOutputHandler< WriterImpl, 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::DataOutputHandler< typename WriterImpl::DataType >.

◆ createWriter() [1/2]

template<typename WriterImpl , const Base::DataFormat & FORMAT, typename DataType = typename WriterImpl::DataType>
WriterType::SharedPointer CDPL::Util::DefaultDataOutputHandler< WriterImpl, FORMAT, DataType >::createWriter ( std::ostream &  os) const
inlinevirtual

Creates a writer that writes to the output stream os.

Parameters
osThe output stream to wrap.
Returns
A shared pointer to a freshly constructed WriterImpl.

Implements CDPL::Base::DataOutputHandler< typename WriterImpl::DataType >.

◆ createWriter() [2/2]

template<typename WriterImpl , const Base::DataFormat & FORMAT, typename DataType = typename WriterImpl::DataType>
WriterType::SharedPointer CDPL::Util::DefaultDataOutputHandler< WriterImpl, FORMAT, DataType >::createWriter ( const std::string &  file_name,
std::ios_base::openmode  mode 
) const
inlinevirtual

Creates a writer that writes to the file file_name (opened in mode mode).

Parameters
file_nameThe path of the output file.
modeThe open mode of the underlying file stream.
Returns
A shared pointer to a freshly constructed Util::FileDataWriter wrapping a WriterImpl.

Implements CDPL::Base::DataOutputHandler< typename WriterImpl::DataType >.


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