Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

FileHandler Class Reference
[File IO]

#include <OpenMS/FORMAT/FileHandler.h>

List of all members.


Detailed Description

Facilitates file handling by file type recognition.

This class provides file type recognition from the file name and from the file content.

It also offer a common interface to load MSExperiment data and allows querying for supported file types.

Public Types

enum  Type {
  UNKNOWN, DTA, DTA2D, MZDATA,
  MZXML, FEATUREXML, FEATUREPAIRSXML, ANDIMS,
  IDXML, CONSENSUSXML, MGF, SIZE_OF_TYPE
}
 The known file types. More...

Public Member Functions

Type getTypeByFileName (const String &filename)
 Determines the file type from a file name.
Type getTypeByContent (const String &filename) throw (Exception::FileNotFound)
 Determines the file type of a file by parsing the first few lines.
Type nameToType (const String &name)
 Converts a file type name into a Type.
String typeToName (Type type)
 Converts a Type into a file type name.
bool isSupported (Type type)
 Returns if the file type is supported in this build of the library.
PeakFileOptionsgetOptions ()
 Mutable access to the options for loading.
const PeakFileOptionsgetOptions () const
 Non-mutable access to the options for loading.
template<class PeakType>
bool loadExperiment (const String &filename, MSExperiment< PeakType > &exp, Type force_type=UNKNOWN, ProgressLogger::LogType log=ProgressLogger::NONE)
 Loads a file into an MSExperiment.

Static Public Attributes

static const std::string NamesOfTypes [SIZE_OF_TYPE]
 String representations of the file types.

Private Attributes

PeakFileOptions options_


Member Enumeration Documentation

enum Type

The known file types.

See also:
nameToType and typeToName
Enumerator:
UNKNOWN  Unknown file extension.
DTA  DTA file (.dta).
DTA2D  DTA2D file (.dta2d).
MZDATA  MzData file (.MzData).
MZXML  MzXML file (.MzXML).
FEATUREXML  OpenMS feature file (.featureXML)
FEATUREPAIRSXML  OpenMS feature pairs file (.featurePairsXML)
ANDIMS  ANDI\MS file (.cdf).
IDXML  OpenMS identification format (.idXML)
CONSENSUSXML  OpenMS consensus map format (.consensusXML)
MGF  Mascot Generic Format (.mgf).
SIZE_OF_TYPE  No file type. Simply stores the number of types.


Member Function Documentation

Type getTypeByFileName ( const String filename  ) 

Determines the file type from a file name.

Type getTypeByContent ( const String filename  )  throw (Exception::FileNotFound)

Determines the file type of a file by parsing the first few lines.

Type nameToType ( const String name  ) 

Converts a file type name into a Type.

String typeToName ( Type  type  ) 

Converts a Type into a file type name.

bool isSupported ( Type  type  ) 

Returns if the file type is supported in this build of the library.

PeakFileOptions& getOptions (  ) 

Mutable access to the options for loading.

const PeakFileOptions& getOptions (  )  const

Non-mutable access to the options for loading.

bool loadExperiment ( const String filename,
MSExperiment< PeakType > &  exp,
Type  force_type = UNKNOWN,
ProgressLogger::LogType  log = ProgressLogger::NONE 
) [inline]

Loads a file into an MSExperiment.

Parameters:
filename the Filename of the file to load.
exp The MSExperiment to load the data into.
force_type Forces to load the file with that file type.
If no type is forced, it is determined from the extention ( or from the content if that fails).
log Progress logging mode
Returns:
true if the file could be loaded, false otherwise


Member Data Documentation

const std::string NamesOfTypes[SIZE_OF_TYPE] [static]

String representations of the file types.

PeakFileOptions options_ [private]


The documentation for this class was generated from the following file:
Generated Tue Apr 1 15:36:44 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1