BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
OutputDataReadFactory Class Reference
Collaboration diagram for OutputDataReadFactory:

Static Public Member Functions

static OutputDataReadergetReader (const std::string &file_name)
 
static OutputDataReadergetReflectometryReader (const std::string &file_name)
 

Static Private Member Functions

static IOutputDataReadStrategygetReadStrategy (const std::string &file_name)
 

Detailed Description

Creates reader appropariate for given type of files.

Definition at line 23 of file OutputDataReadFactory.h.

Member Function Documentation

◆ getReader()

OutputDataReader * OutputDataReadFactory::getReader ( const std::string &  file_name)
static

Definition at line 19 of file OutputDataReadFactory.cpp.

20 {
21  OutputDataReader* result = new OutputDataReader(file_name);
22  result->setStrategy(getReadStrategy(file_name));
23  return result;
24 }
static IOutputDataReadStrategy * getReadStrategy(const std::string &file_name)
Reads OutputData from file using different reading strategies.
void setStrategy(IOutputDataReadStrategy *read_strategy)
Sets concrete reading strategy.

References getReadStrategy(), and OutputDataReader::setStrategy().

Referenced by IntensityDataIOFactory::readOutputData().

Here is the call graph for this function:

◆ getReflectometryReader()

OutputDataReader * OutputDataReadFactory::getReflectometryReader ( const std::string &  file_name)
static

Definition at line 26 of file OutputDataReadFactory.cpp.

27 {
28  OutputDataReader* result = new OutputDataReader(file_name);
30  return result;
31 }
Strategy to read Reflectometry data from ASCII file.

References OutputDataReader::setStrategy().

Referenced by IntensityDataIOFactory::readReflectometryData().

Here is the call graph for this function:

◆ getReadStrategy()

IOutputDataReadStrategy * OutputDataReadFactory::getReadStrategy ( const std::string &  file_name)
staticprivate

Definition at line 33 of file OutputDataReadFactory.cpp.

34 {
35  IOutputDataReadStrategy* result(nullptr);
36  if (DataFormatUtils::isIntFile(file_name))
37  result = new OutputDataReadINTStrategy();
38 #ifdef BORNAGAIN_TIFF_SUPPORT
39  else if (DataFormatUtils::isTiffFile(file_name))
40  result = new OutputDataReadTiffStrategy();
41 #endif // BORNAGAIN_TIFF_SUPPORT
42  else
43  // Try to read ASCII by default. Binary maps to ASCII.
44  // If the file is not actually a matrix of numbers,
45  // the error will be thrown during the reading.
46  result = new OutputDataReadNumpyTXTStrategy();
47  return result;
48 }
Interface for reading strategy of OutputData from file.
Strategy to read BornAgain native IntensityData from ASCII file.
Strategy to read OutputData from simple ASCII file with the layout as in numpy.savetxt.
bool isIntFile(const std::string &file_name)
returns true if file name corresponds to BornAgain native format (compressed or not)
bool isTiffFile(const std::string &file_name)
returns true if file name corresponds to tiff file (can be also compressed)

References DataFormatUtils::isIntFile(), and DataFormatUtils::isTiffFile().

Referenced by getReader().

Here is the call graph for this function:

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