soma-io
5.0.5
|
Generic reader for every format of Cartograph object. More...
#include <soma-io/io/reader.h>
Public Member Functions | |
Reader () | |
Reader (const std::string &filename) | |
Reader (carto::rc_ptr< DataSource > ds) | |
Reader (carto::rc_ptr< DataSourceInfo > dsi) | |
Reader (std::istream &stream) | |
virtual | ~Reader () |
virtual bool | read (T &obj, carto::Object header=carto::none(), int passbegin=1, int passend=4) |
Finds the correct format and reads the object. More... | |
virtual T * | read (carto::Object header=carto::none(), int passbegin=1, int passend=4) |
Creates and reads an object. More... | |
const carto::rc_ptr< DataSourceInfo > & | dataSourceInfo () const |
carto::rc_ptr< DataSourceInfo > & | dataSourceInfo () |
void | setAllocatorContext (const AllocatorContext &ac) |
const AllocatorContext & | allocatorContext () const |
void | setOptions (carto::Object options) |
carto::Object | options () const |
carto::Object & | options () |
const carto::rc_ptr< DataSource > | dataSource () const |
carto::rc_ptr< DataSource > | dataSource () |
void | attach (carto::rc_ptr< DataSource > ds) |
void | attach (const std::string &filename, offset_t offset=0) |
void | attach (std::istream &stream) |
void | flush () |
void | close () |
Static Public Member Functions | |
static std::string | extension (const std::string &filename) |
Protected Attributes | |
carto::rc_ptr< DataSourceInfo > | _datasourceinfo |
AllocatorContext | _alloccontext |
carto::Object | _options |
Generic reader for every format of Cartograph object.
Still a template class, the data type must be switched at upper-level (see DataSourceInfoLoader or ReaderAlgorithm).
Generic readers offer a plug-in mechanism to allow new formats to be registered.
It uses at lower level specific readers of each object type (Volume, Meshes, Buckets, Textures) and even lower, specific reader of each format (GIS, SPM).
See IO system general explanations on how to use Reader and Writer classes.
The standard cartodata library includes a set of already compiled formats, using a FormatDictionary to provide a common link between Reader and Writer, see FormatDictionary for a list.
If you need to use other types, you'll have to include soma-io/io/reader_d.h
in order to have the template functions definitions, soma-io/io/reader.h
is only the class declarations. In addition, you may want to specialize the registerBaseFormats() functions of the FormatDictionary classes.
soma::Reader< T >::Reader | ( | ) |
Definition at line 68 of file reader_d.h.
soma::Reader< T >::Reader | ( | const std::string & | filename | ) |
Definition at line 83 of file reader_d.h.
soma::Reader< T >::Reader | ( | carto::rc_ptr< DataSource > | ds | ) |
Definition at line 73 of file reader_d.h.
soma::Reader< T >::Reader | ( | carto::rc_ptr< DataSourceInfo > | dsi | ) |
Definition at line 78 of file reader_d.h.
soma::Reader< T >::Reader | ( | std::istream & | stream | ) |
Definition at line 90 of file reader_d.h.
|
virtual |
Definition at line 97 of file reader_d.h.
const AllocatorContext & soma::Reader< T >::allocatorContext | ( | ) | const |
Definition at line 111 of file reader_d.h.
References soma::Reader< T >::_alloccontext.
Referenced by soma::Reader< T >::dataSourceInfo().
void soma::Reader< T >::attach | ( | carto::rc_ptr< DataSource > | ds | ) |
Definition at line 141 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo.
Referenced by soma::Reader< T >::dataSourceInfo().
void soma::Reader< T >::attach | ( | const std::string & | filename, |
offset_t | offset = 0 |
||
) |
Definition at line 151 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo.
void soma::Reader< T >::attach | ( | std::istream & | stream | ) |
Definition at line 163 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo.
void soma::Reader< T >::close | ( | void | ) |
Definition at line 203 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo.
Referenced by soma::Reader< T >::dataSourceInfo().
const carto::rc_ptr< DataSource > soma::Reader< T >::dataSource | ( | ) | const |
Definition at line 175 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo, and soma::DataSource::none().
Referenced by soma::Reader< T >::dataSourceInfo(), and soma::Reader< T >::read().
carto::rc_ptr< DataSource > soma::Reader< T >::dataSource | ( | ) |
Definition at line 185 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo, and soma::DataSource::none().
|
inline |
Definition at line 124 of file reader.h.
References soma::Reader< T >::_datasourceinfo.
|
inline |
Definition at line 126 of file reader.h.
References soma::Reader< T >::_datasourceinfo, soma::Reader< T >::allocatorContext(), soma::Reader< T >::attach(), soma::Reader< T >::close(), soma::Reader< T >::dataSource(), soma::Reader< T >::extension(), soma::Reader< T >::flush(), soma::Reader< T >::options(), soma::Reader< T >::setAllocatorContext(), and soma::Reader< T >::setOptions().
|
static |
Referenced by soma::Reader< T >::dataSourceInfo().
void soma::Reader< T >::flush | ( | ) |
Definition at line 195 of file reader_d.h.
References soma::Reader< T >::_datasourceinfo.
Referenced by soma::Reader< T >::dataSourceInfo().
carto::Object soma::Reader< T >::options | ( | ) | const |
Definition at line 126 of file reader_d.h.
References soma::Reader< T >::_options.
Referenced by soma::Reader< T >::dataSourceInfo(), and soma::Reader< T >::setOptions().
carto::Object & soma::Reader< T >::options | ( | ) |
Definition at line 132 of file reader_d.h.
References soma::Reader< T >::_options.
|
virtual |
Finds the correct format and reads the object.
if format
is specified, this format is tried first, so you can use it as a hint if you already know it (from the DataSourceInfoLoader check ). It is possible to specify wich passes to process through passbegin
and passend
.
Definition at line 221 of file reader_d.h.
References soma::Reader< T >::_alloccontext, soma::Reader< T >::_datasourceinfo, soma::Reader< T >::_options, soma::DataSourceInfoLoader::check(), soma::FormatReader< T >::clone(), soma::Reader< T >::dataSource(), soma::DataSourceList::empty(), carto::FileUtil::extension(), rc_ptr< GenericObject >::get(), soma::DataSourceInfo::header(), carto::Object::isNone(), carto::io_error::keepExceptionPriority(), carto::io_error::launchExcept(), soma::DataSourceInfoLoader::launchException(), soma::DataSourceInfo::list(), localMsg, soma::FormatDictionary< T >::readExtensions(), soma::FormatDictionary< T >::readFormat(), soma::FormatDictionary< T >::readFormats(), soma::AllocatorContext::setDataSourceInfo(), carto::toString(), and carto::Object::value().
Referenced by operator>>().
|
virtual |
Creates and reads an object.
This function differs from the read( T&, ... ) function in the way that it creates the object and does not just fill it. This enables to create sub-classes of T (factory-like behaviour) on types that allow subclasses. The object is created by new
and can be deleted. The default is just to create a T and call the read( T&, ... ) function, but some specialized low-level readers may behave differently. It is possible to specify wich passes to process through passbegin
and passend
.
Definition at line 425 of file reader_d.h.
References soma::Reader< T >::_alloccontext, soma::Reader< T >::_datasourceinfo, soma::Reader< T >::_options, soma::DataSourceInfoLoader::check(), soma::FormatReader< T >::clone(), soma::Reader< T >::dataSource(), soma::DataSourceList::empty(), carto::FileUtil::extension(), rc_ptr< GenericObject >::get(), soma::DataSourceInfo::header(), carto::Object::isNone(), carto::io_error::keepExceptionPriority(), carto::io_error::launchExcept(), soma::DataSourceInfoLoader::launchException(), soma::DataSourceInfo::list(), localMsg, soma::FormatDictionary< T >::readExtensions(), soma::FormatDictionary< T >::readFormat(), soma::FormatDictionary< T >::readFormats(), soma::AllocatorContext::setDataSourceInfo(), carto::toString(), and carto::Object::value().
void soma::Reader< T >::setAllocatorContext | ( | const AllocatorContext & | ac | ) |
Definition at line 105 of file reader_d.h.
References soma::Reader< T >::_alloccontext.
Referenced by soma::Reader< T >::dataSourceInfo().
void soma::Reader< T >::setOptions | ( | carto::Object | options | ) |
Definition at line 120 of file reader_d.h.
References soma::Reader< T >::_options, and soma::Reader< T >::options().
Referenced by soma::Reader< T >::dataSourceInfo().
|
protected |
Definition at line 169 of file reader.h.
Referenced by soma::Reader< T >::allocatorContext(), soma::Reader< T >::read(), and soma::Reader< T >::setAllocatorContext().
|
protected |
Definition at line 168 of file reader.h.
Referenced by soma::Reader< T >::attach(), soma::Reader< T >::close(), soma::Reader< T >::dataSource(), soma::Reader< T >::dataSourceInfo(), soma::Reader< T >::flush(), and soma::Reader< T >::read().
|
protected |
Definition at line 170 of file reader.h.
Referenced by soma::Reader< T >::options(), soma::Reader< T >::read(), and soma::Reader< T >::setOptions().