soma-io
5.0.5
|
Low-level object IO reader specialized for a specific format. More...
#include <soma-io/io/formatdictionary.h>
Public Member Functions | |
virtual | ~FormatReader () |
virtual void | setupAndRead (T &obj, carto::rc_ptr< DataSourceInfo > dsi, const AllocatorContext &context, carto::Object options) |
Full reading procedure, for an already existing object. More... | |
virtual T * | createAndRead (carto::rc_ptr< DataSourceInfo > dsi, const AllocatorContext &context, carto::Object options) |
Factory mode: creates an object and reads it. More... | |
virtual void | read (T &obj, carto::rc_ptr< DataSourceInfo > dsi, const AllocatorContext &context, carto::Object options) |
Reads part or all of the object obj . More... | |
virtual FormatReader< T > * | clone () const =0 |
Duplicate the FormatReader. More... | |
virtual std::string | formatID () const =0 |
Format identifier (abstract). More... | |
virtual carto::rc_ptr< DataSourceInfo > | checkDataSourceInfo (carto::rc_ptr< DataSourceInfo > dsi, carto::Object options) |
Checks that dsi has been identified with the matching format checker. More... | |
virtual T * | create (carto::Object header, const AllocatorContext &context, carto::Object options) |
create the object to be read, bind the allocation context. More... | |
virtual void | setup (T &obj, carto::Object header, const AllocatorContext &context, carto::Object options) |
setup an existing object (for resizing or reallocation for instance). More... | |
Low-level object IO reader specialized for a specific format.
To invoque such a format-specific reader, information about the source is supposed te be already read, this is to say: the object header has already been read (using DataSourceInfo).
This is a low-level format reader, which is not intended to be used alone: Reader will use it to achieve appropriate decoding, allocation, and reading.
The job of a reader can be decomposed into several steps:
Definition at line 49 of file formatdictionary.h.
|
virtual |
Definition at line 60 of file formatreader_d.h.
|
virtual |
Checks that dsi has been identified with the matching format checker.
If not, instantiate a new DataSourceInfo and return it. If yes, the returned DataSourceInfo will be the input one. This method is called automatically from createAndRead() or setupAndRead().
Definition at line 117 of file formatreader_d.h.
|
pure virtual |
Duplicate the FormatReader.
Some FormatReader can contain data describing the data source or storage buffer, so must be cloned for each read. Note that, for now, the cloned instance does not need to have the same bound internal data, since it is cloned precisely to work on a different source/buffer. It just needs to be another instance of the same exact type.
Implemented in soma::JsonFormatReader, soma::PythonFormatReader, and soma::XMLFormatReader.
Referenced by soma::Reader< T >::read().
|
virtual |
create the object to be read, bind the allocation context.
Either create() or setup() will be called, depending if we are working on an existing object or have to allocate a new one. The default implementations just calls Creator<T>::create().
Definition at line 139 of file formatreader_d.h.
|
virtual |
Factory mode: creates an object and reads it.
The returned object belongs to the calling layer and may be deleted by the standard delete
Reimplemented in soma::JsonFormatReader, soma::PythonFormatReader, and soma::XMLFormatReader.
Definition at line 82 of file formatreader_d.h.
|
pure virtual |
Format identifier (abstract).
Used to match checker and reader
Implemented in soma::JsonFormatReader, soma::PythonFormatReader, and soma::XMLFormatReader.
|
virtual |
Reads part or all of the object obj
.
This read() method should be called after everything is setup and bound For objects supporting allocators, context
should be the same as the context bound to the object, and reading is just a matter of calling the read methods of the DataSource bound to the context.
obj | object to read into |
dsi | DataSourceInfo containing pre-computed header, data source list and capabilities. |
options | may specify a sub-object for partial reading |
Reimplemented in soma::JsonFormatReader, soma::PythonFormatReader, and soma::XMLFormatReader.
Definition at line 105 of file formatreader_d.h.
|
virtual |
setup an existing object (for resizing or reallocation for instance).
Either create() or setup() will be called, depending if we are working on an existing object or have to allocate a new one. The default implementations just calls Creator<T>::create().
Definition at line 148 of file formatreader_d.h.
|
virtual |
Full reading procedure, for an already existing object.
Definition at line 68 of file formatreader_d.h.