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

Static Public Member Functions

static OutputDataWritergetWriter (const std::string &file_name)
 

Static Private Member Functions

static IOutputDataWriteStrategygetWriteStrategy (const std::string &file_name)
 

Detailed Description

Creates writer appropariate for given type of files.

Definition at line 23 of file OutputDataWriteFactory.h.

Member Function Documentation

◆ getWriter()

OutputDataWriter * OutputDataWriteFactory::getWriter ( const std::string &  file_name)
static

Definition at line 18 of file OutputDataWriteFactory.cpp.

19 {
20  OutputDataWriter* result = new OutputDataWriter(file_name);
21  result->setStrategy(getWriteStrategy(file_name));
22  return result;
23 }
static IOutputDataWriteStrategy * getWriteStrategy(const std::string &file_name)
Write OutputData to file using different witing strategies.
void setStrategy(IOutputDataWriteStrategy *write_strategy)
Sets concrete writing strategy.

References getWriteStrategy(), and OutputDataWriter::setStrategy().

Referenced by IntensityDataIOFactory::writeOutputData().

Here is the call graph for this function:

◆ getWriteStrategy()

IOutputDataWriteStrategy * OutputDataWriteFactory::getWriteStrategy ( const std::string &  file_name)
staticprivate

Definition at line 25 of file OutputDataWriteFactory.cpp.

26 {
27  IOutputDataWriteStrategy* result(nullptr);
28  if (DataFormatUtils::isIntFile(file_name)) {
29  result = new OutputDataWriteINTStrategy();
30  }
31 
32 #ifdef BORNAGAIN_TIFF_SUPPORT
33  else if (DataFormatUtils::isTiffFile(file_name)) {
34  result = new OutputDataWriteTiffStrategy();
35  }
36 #endif // BORNAGAIN_TIFF_SUPPORT
37 
38  else {
39  result = new OutputDataWriteNumpyTXTStrategy();
40  }
41 
42  return result;
43 }
Strategy interface to write OututData in file.
Strategy to write OutputData to special BornAgain ASCII format.
Strategy to write OutputData to 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 getWriter().

Here is the call graph for this function:

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