MI - Fimex
Static Public Member Functions | List of all members
MetNoFimex::CDMFileReaderFactory Class Reference

#include <fimex/CDMFileReaderFactory.h>

Static Public Member Functions

static mifi_filetype detectFileType (const std::string &fileName)
 detect the filetype of a input-file More...
 
static boost::shared_ptr< CDMReadercreate (int fileType, const std::string &fileName, const std::string &configFile="", const std::vector< std::string > &args=std::vector< std::string >())
 Factory for CDMReader of input-files. More...
 
static boost::shared_ptr< CDMReadercreate (const std::string &fileType, const std::string &fileName, const std::string &configFile="", const std::vector< std::string > &args=std::vector< std::string >())
 same as the other create(), but with a fileType string More...
 
static boost::shared_ptr< CDMReadercreate (int fileType, const std::string &fileName, const XMLInput &configXML, const std::vector< std::string > &args=std::vector< std::string >())
 Factory for CDMReader of input-files. More...
 
static boost::shared_ptr< CDMReadercreate (const std::string &fileType, const std::string &fileName, const XMLInput &configXML, const std::vector< std::string > &args=std::vector< std::string >())
 same as the other create(), but with a fileType string More...
 
static void parseGribArgs (const std::vector< std::string > &args, std::vector< std::pair< std::string, std::string > > &members, std::vector< std::string > &files)
 parse special arguments for grib-files More...
 

Detailed Description

helper class to simplify file-reader detection and creation

Member Function Documentation

static boost::shared_ptr<CDMReader> MetNoFimex::CDMFileReaderFactory::create ( int  fileType,
const std::string fileName,
const std::string configFile = "",
const std::vector< std::string > &  args = std::vectorstd::string >() 
)
static

Factory for CDMReader of input-files.

This function tries to create a reader by filetype mifi_filetype. The optional arguments are defined by the different readers. Use default objects (empty string, empty vector) if arguments are not desired.

Parameters
fileTypeone of mifi_filetype, possibly read by detectFileType(). To get a CDMReaderWriter, use MIFI_FILETYPE_NETCDF|MIFI_FILETYPE_RW.
fileNamename of input file (might start with glob: for grib or netcdf, e.g. glob:*.nc (joinExisting aggregation, see NcmlCDMReader.h)
configFile
argsoptional options for the CDMReader, e.g. for grib: additional message files
Returns
pointer to CDMReader
Exceptions
CDMExceptionif type not compiled in, or creation fails
Deprecated:
use create(int fileType, const std::string& fileName, const XMLInput& configXML, const std::vector<std::string>& args = std::vector<std::string>())
Examples:
coordinateSystem.cpp, and parallelRead.cpp.
static boost::shared_ptr<CDMReader> MetNoFimex::CDMFileReaderFactory::create ( const std::string fileType,
const std::string fileName,
const std::string configFile = "",
const std::vector< std::string > &  args = std::vectorstd::string >() 
)
static

same as the other create(), but with a fileType string

Deprecated:
use create(const std::string& fileType, const std::string& fileName, const XMLInput& configXML, const std::vector<std::string>& args = std::vector<std::string>())
static boost::shared_ptr<CDMReader> MetNoFimex::CDMFileReaderFactory::create ( int  fileType,
const std::string fileName,
const XMLInput configXML,
const std::vector< std::string > &  args = std::vectorstd::string >() 
)
static

Factory for CDMReader of input-files.

This function tries to create a reader by filetype mifi_filetype. The optional arguments are defined by the different readers. Use default objects (empty string, empty vector) if arguments are not desired.

Parameters
fileTypeone of mifi_filetype, possibly read by detectFileType(). To get a CDMReaderWriter, use MIFI_FILETYPE_NETCDF|MIFI_FILETYPE_RW
fileNamename of input file (might start with glob: for grib or netcdf, e.g. glob:*.nc (joinExisting aggregation, see NcmlCDMReader.h)
configXMLconfig source
argsoptional options for the CDMReader
Returns
pointer to CDMReader
Exceptions
CDMExceptionif type not compiled in, or creation fails
Deprecated:
use create(int fileType, const std::string& fileName, const XMLInput& configXML, const std::vector<std::string>& args = std::vector<std::string>())
static boost::shared_ptr<CDMReader> MetNoFimex::CDMFileReaderFactory::create ( const std::string fileType,
const std::string fileName,
const XMLInput configXML,
const std::vector< std::string > &  args = std::vectorstd::string >() 
)
static

same as the other create(), but with a fileType string

static mifi_filetype MetNoFimex::CDMFileReaderFactory::detectFileType ( const std::string fileName)
static

detect the filetype of a input-file

The detectFileType function uses heuristics (appendix, magic characters) to detect the filetype

Parameters
fileNameinput file
Returns
one of the mifi_filetype flags
Exceptions
iffile not found
static void MetNoFimex::CDMFileReaderFactory::parseGribArgs ( const std::vector< std::string > &  args,
std::vector< std::pair< std::string, std::string > > &  members,
std::vector< std::string > &  files 
)
static

parse special arguments for grib-files

Parameters
argslist of arguments, e.g. combined –input.file –input.optional from fimex command-line
membersreturn members as memberName/memberRegexp pairs
filesretrun all input files

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