soma-io
5.0.5
|
Generic information retreiver / checker for all data sources and file formats. More...
#include <soma-io/datasourceinfo/datasourceinfoloader.h>
Public Types | |
enum | State { Unchecked, Ok, Error } |
Public Member Functions | |
DataSourceInfoLoader () | |
~DataSourceInfoLoader () | |
DataSourceInfo | check (DataSourceInfo dsi, carto::Object options=carto::none(), int passbegin=1, int passend=3) |
Finds the right format checker. More... | |
State | state () const |
std::string | errorMessage () const |
void | launchException () |
Static Public Member Functions | |
static void | registerFormat (const std::string &fmtid, FormatChecker *format, const std::vector< std::string > &extensions) |
Registers a FormatChecker into the dictionary. More... | |
static FormatChecker * | formatInfo (const std::string &format) |
Returns the corresponding FormatChecker. More... | |
static carto::Object | readMinf (DataSource &ds, carto::Object base=carto::none(), carto::Object options=carto::none()) |
Called inter alia by format-specific FormatChecker to complete header informations. More... | |
static carto::SyntaxSet & | minfSyntax () |
Syntax for minf dictionaries. More... | |
static std::set< std::string > | extensions (const std::string &format) |
Extensions matching a specified format. More... | |
static std::set< std::string > | formats (const std::string &ext) |
Formats matching a specified extension. More... | |
static std::set< std::string > | readFormats (const std::string &ext, const std::string &data_type_name) |
Available reading formats for an extension and a data type. More... | |
static std::set< std::string > | writeFormats (const std::string &ext, const std::string &data_type_name) |
Available writing formats for an extension and a data type. More... | |
Static Protected Member Functions | |
static std::set< std::string > | formats (const std::string &ext, soma::IOObjectTypesDictionary::FormatInfo &format_info) |
Available formats for an extension and a format info. More... | |
Protected Attributes | |
Private * | d |
Generic information retreiver / checker for all data sources and file formats.
It replaces carto::DataSourceInfo and aims::Finder.
DataSourceInfoLoader provides a plug-in system for new formats and data types. Formats are hidden in the plugins and should never be accessed directly.
Usage: check() the DataSourceInfo and then process according to the object type ("Volume of S16", "Mesh", "Texture", "Bucket", ...).
Use the generic Reader once the data type is known, the right format will be selected automatically.
Avoiding manually switching on objects and data types is possible using the ReaderAlgorithm interface and presumably, template functions.
Here is an example of how to use the DataSourceInfoLoader class:
Definition at line 107 of file datasourceinfoloader.h.
Enumerator | |
---|---|
Unchecked | |
Ok | |
Error |
Definition at line 110 of file datasourceinfoloader.h.
soma::DataSourceInfoLoader::DataSourceInfoLoader | ( | ) |
soma::DataSourceInfoLoader::~DataSourceInfoLoader | ( | ) |
DataSourceInfo soma::DataSourceInfoLoader::check | ( | DataSourceInfo | dsi, |
carto::Object | options = carto::none() , |
||
int | passbegin = 1 , |
||
int | passend = 3 |
||
) |
Finds the right format checker.
dsi | DataSourceInfo containing header, DSlist and . capabilities. It allows us to have none, some or all information already computed. It is for the DSIloader to deal with the all case, and for the FormatCheckers to deal with some and none cases. |
options | A dictionary containing options. They may not be of any use to the checker, but soma are ( resolution_level ). |
passbegin
and passend
.Referenced by soma::FormatReader< carto::GenericObject >::checkDataSourceInfo(), and soma::Reader< T >::read().
std::string soma::DataSourceInfoLoader::errorMessage | ( | ) | const |
|
static |
Extensions matching a specified format.
|
static |
Returns the corresponding FormatChecker.
format | Identification of the format. ex: "GIS" |
|
static |
Formats matching a specified extension.
|
staticprotected |
Available formats for an extension and a format info.
void soma::DataSourceInfoLoader::launchException | ( | ) |
Referenced by soma::Reader< T >::read().
|
static |
Syntax for minf dictionaries.
|
static |
Available reading formats for an extension and a data type.
|
static |
Called inter alia by format-specific FormatChecker to complete header informations.
ds | DataSource to minf file |
base | If given, the function keeps information from the base header and adds that from the minf file. |
|
static |
Registers a FormatChecker into the dictionary.
fmtid | Identification of the format. ex: "GIS" |
format | Specialized FormatChecker |
extensions | Extensions readable by the FormatChecker |
State soma::DataSourceInfoLoader::state | ( | ) | const |
|
static |
Available writing formats for an extension and a data type.
|
protected |
Definition at line 183 of file datasourceinfoloader.h.