# MI - Fimex: MetNoFimex::CDMFileReaderFactory Class Reference

# MetNoFimex::CDMFileReaderFactory Class Reference

`#include <CDMFileReaderFactory.h>`

List of all members.

## Static Public Member Functions

static int | detectFileType (const std::string &fileName)
| detect the filetype of a input-file
static boost::shared_ptr < CDMReader > | create (int fileType, const std::string &fileName, const std::string &configFile, const std::vector< std::string > &args)
| Factory for CDMReader of input-files.

## Detailed Description

helper class to simplify file-reader detection and creation

## Member Function Documentation

static int 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:

  | fileName | input file

Returns:
  one of the MIFI_FILETYPE_* flags

Exceptions:

  | if | file not found

static boost::shared_ptr<CDMReader> MetNoFimex::CDMFileReaderFactory::create | ( | int | fileType,
|  | const std::string & | fileName,
|  | const std::string & | configFile,
|  | const std::vector< std::string > & | args |
| ) |  |  | `[static]`

Factory for CDMReader of input-files.

The function create reader 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:

  | fileNype,one | of MIFI_FILETYPE_*, possibly read by detectFileType()
  | fileName,name | of input type
  | configFile |
  | options | optional options for the CDMReader

Returns:
  pointer to CDMReader

Exceptions:

  | CDMException | if type not compiled in, or creation fails

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

- include/fimex/CDMFileReaderFactory.h