aimsdata  5.0.5
Neuroimaging data handling
aims::AnyTypeReader< T, TConvertorFamily > Class Template Reference

A class to read an object of type T, even if the type on file is different. More...

#include <aims/utility/anytype_reader.h>

Inheritance diagram for aims::AnyTypeReader< T, TConvertorFamily >:
Collaboration diagram for aims::AnyTypeReader< T, TConvertorFamily >:

Public Types

typedef AnyTypeReaderProcess< T, TConvertorFamily > Base
 

Public Member Functions

 AnyTypeReader (std::string filename)
 initialize with the name of the file to be read. More...
 
void read (T &out)
 read file and get result. More...
 

Detailed Description

template<typename T, typename TConvertorFamily = TArgWrapper2<RawConverterWithAllocation>>
class aims::AnyTypeReader< T, TConvertorFamily >

A class to read an object of type T, even if the type on file is different.

Conversion is taken care of by convertor classes, indexed by the TConvertorFamily "template typename". These convertors have to be able to allocate the output if necessary. NB: error checking during conversion is left to the convertors – no tests are done inside AnyTypeReader to check that the conversion succeeded, or even that a convertion is possible at all. Therefore, it is as safe as the Convertors you provide.

Example:

If you want to read an image as an AimsData<float>, whatever the type on file:

std::string filename = "toto.ima"; AnyTypeReader<AimsData<float> > reader(filename); AimsData<float> im; reader.read(im);

Definition at line 195 of file anytype_reader.h.

Member Typedef Documentation

◆ Base

template<typename T , typename TConvertorFamily = TArgWrapper2<RawConverterWithAllocation>>
typedef AnyTypeReaderProcess<T, TConvertorFamily> aims::AnyTypeReader< T, TConvertorFamily >::Base

Definition at line 199 of file anytype_reader.h.

Constructor & Destructor Documentation

◆ AnyTypeReader()

template<typename T , typename TConvertorFamily >
aims::AnyTypeReader< T, TConvertorFamily >::AnyTypeReader ( std::string  filename)
explicit

initialize with the name of the file to be read.

Definition at line 107 of file anytype_reader_details.h.

Member Function Documentation

◆ read()

template<typename T , typename TConvertorFamily >
void aims::AnyTypeReader< T, TConvertorFamily >::read ( T &  out)

read file and get result.

Definition at line 114 of file anytype_reader_details.h.

References aims::Process::execute().


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