soma-io  5.0.5
soma::GenericWriter Class Referenceabstract

#include <soma-io/io/writer.h>

Inheritance diagram for soma::GenericWriter:
Collaboration diagram for soma::GenericWriter:

Public Member Functions

 GenericWriter ()
 
 GenericWriter (carto::rc_ptr< DataSource > ds)
 
 GenericWriter (const std::string &filename)
 
 GenericWriter (std::ostream &stream)
 
virtual ~GenericWriter ()
 
template<typename T >
bool write (const T &obj, carto::Object options=carto::none())
 Finds the correct format and writes the object. More...
 
virtual std::string writtenObjectType () const =0
 
const carto::rc_ptr< DataSourcedataSource () const
 
carto::rc_ptr< DataSourcedataSource ()
 
void attach (carto::rc_ptr< DataSource > ds)
 
void attach (const std::string &filename)
 
void attach (std::ostream &stream)
 
void flush ()
 flush the writing DataSource (if still open) More...
 
void close ()
 close the writing DataSource More...
 
template<>
bool write (const carto::Object &obj, carto::Object options)
 

Protected Attributes

carto::rc_ptr< DataSourceInfo_datasourceinfo
 

Detailed Description

Definition at line 47 of file writer.h.

Constructor & Destructor Documentation

◆ GenericWriter() [1/4]

soma::GenericWriter::GenericWriter ( )

◆ GenericWriter() [2/4]

soma::GenericWriter::GenericWriter ( carto::rc_ptr< DataSource ds)

◆ GenericWriter() [3/4]

soma::GenericWriter::GenericWriter ( const std::string &  filename)

◆ GenericWriter() [4/4]

soma::GenericWriter::GenericWriter ( std::ostream &  stream)

◆ ~GenericWriter()

virtual soma::GenericWriter::~GenericWriter ( )
virtual

Member Function Documentation

◆ attach() [1/3]

void soma::GenericWriter::attach ( carto::rc_ptr< DataSource ds)

◆ attach() [2/3]

void soma::GenericWriter::attach ( const std::string &  filename)

◆ attach() [3/3]

void soma::GenericWriter::attach ( std::ostream &  stream)

◆ close()

void soma::GenericWriter::close ( )

close the writing DataSource

◆ dataSource() [1/2]

const carto::rc_ptr<DataSource> soma::GenericWriter::dataSource ( ) const

◆ dataSource() [2/2]

carto::rc_ptr<DataSource> soma::GenericWriter::dataSource ( )

◆ flush()

void soma::GenericWriter::flush ( )

flush the writing DataSource (if still open)

◆ write() [1/2]

template<typename T >
bool soma::GenericWriter::write ( const T &  obj,
carto::Object  options = carto::none() 
)

Finds the correct format and writes the object.

Options can be passed to specify some writing parameters. The most important is the format ("format" property): if it is specified, this format is tried first, so you can use it to force the format, otherwise it will be determined from the filename extension (if available). If no extension and no format are given, the first working format will be used.

Definition at line 59 of file writer_d.h.

References _datasourceinfo, and soma::Writer< T >::write().

Referenced by operator<<(), and write().

◆ write() [2/2]

template<>
bool soma::GenericWriter::write ( const carto::Object obj,
carto::Object  options 
)
inline

Definition at line 86 of file writer.h.

References write().

◆ writtenObjectType()

virtual std::string soma::GenericWriter::writtenObjectType ( ) const
pure virtual

Implemented in soma::Writer< T >.

Member Data Documentation

◆ _datasourceinfo

carto::rc_ptr<DataSourceInfo> soma::GenericWriter::_datasourceinfo
protected

Definition at line 81 of file writer.h.

Referenced by write(), and soma::Writer< T >::write().


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