BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
DataFormatUtils.h
Go to the documentation of this file.
1
// ************************************************************************************************
2
//
3
// BornAgain: simulate and fit reflection and scattering
4
//
5
//! @file Device/IO/DataFormatUtils.h
6
//! @brief Defines class DatafieldIOFactory.
7
//!
8
//! @homepage http://www.bornagainproject.org
9
//! @license GNU General Public License v3 or higher (see COPYING)
10
//! @copyright Forschungszentrum Jülich GmbH 2018
11
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12
//
13
// ************************************************************************************************
14
15
#ifdef SWIG
16
#error no need to expose this header to Swig
17
#endif
18
19
#ifndef USER_API
20
#ifndef BORNAGAIN_DEVICE_IO_DATAFORMATUTILS_H
21
#define BORNAGAIN_DEVICE_IO_DATAFORMATUTILS_H
22
23
#include <string>
24
#include <vector>
25
26
class
IAxis
;
27
class
Datafield
;
28
29
//! Utility functions for data input and output.
30
31
namespace
DataUtils::Format
{
32
33
//! Returns true if name contains *.gz extension
34
bool
isCompressed
(
const
std::string& name);
35
36
//! Returns true if name contains *.gz extension
37
bool
isGZipped
(
const
std::string& name);
38
39
//! Returns true if name contains *.bz2 extension
40
bool
isBZipped
(
const
std::string& name);
41
42
//! Returns true if file name corresponds to BornAgain native format (compressed or not)
43
bool
isIntFile
(
const
std::string& file_name);
44
45
//! Returns true if file name corresponds to Nicos format (compressed or not)
46
bool
isNicosFile
(
const
std::string& file_name);
47
48
//! Returns true if file name corresponds to tiff file (can be also compressed)
49
bool
isTiffFile
(
const
std::string& file_name);
50
51
IAxis
*
createAxis
(std::istream& input_stream);
52
53
void
fillDatafield
(
Datafield
* data, std::istream& input_stream);
54
55
std::vector<double>
parse_doubles
(
const
std::string& str);
56
57
void
readLineOfDoubles
(std::vector<double>& buffer, std::istringstream& iss);
58
59
}
// namespace DataUtils::Format
60
61
#endif
// BORNAGAIN_DEVICE_IO_DATAFORMATUTILS_H
62
#endif
// USER_API
Datafield
Stores radiation power per bin.
Definition:
Datafield.h:30
IAxis
Abstract base class for one-dimensional axes.
Definition:
IAxis.h:27
DataUtils::Format
Utility functions for data input and output.
Definition:
DataFormatUtils.h:31
DataUtils::Format::isBZipped
bool isBZipped(const std::string &name)
Returns true if name contains *.bz2 extension.
Definition:
DataFormatUtils.cpp:132
DataUtils::Format::isIntFile
bool isIntFile(const std::string &file_name)
Returns true if file name corresponds to BornAgain native format (compressed or not)
Definition:
DataFormatUtils.cpp:137
DataUtils::Format::parse_doubles
std::vector< double > parse_doubles(const std::string &str)
Parse double values from string to vector of double.
Definition:
DataFormatUtils.cpp:192
DataUtils::Format::readLineOfDoubles
void readLineOfDoubles(std::vector< double > &buffer, std::istringstream &iss)
Definition:
DataFormatUtils.cpp:212
DataUtils::Format::fillDatafield
void fillDatafield(Datafield *data, std::istream &input_stream)
Fills output data raw buffer from input stream.
Definition:
DataFormatUtils.cpp:171
DataUtils::Format::isGZipped
bool isGZipped(const std::string &name)
Returns true if name contains *.gz extension.
Definition:
DataFormatUtils.cpp:127
DataUtils::Format::createAxis
IAxis * createAxis(std::istream &input_stream)
Creates axis of certain type from input stream.
Definition:
DataFormatUtils.cpp:154
DataUtils::Format::isTiffFile
bool isTiffFile(const std::string &file_name)
Returns true if file name corresponds to tiff file (can be also compressed)
Definition:
DataFormatUtils.cpp:147
DataUtils::Format::isCompressed
bool isCompressed(const std::string &name)
Returns true if name contains *.gz extension.
Definition:
DataFormatUtils.cpp:120
DataUtils::Format::isNicosFile
bool isNicosFile(const std::string &file_name)
Returns true if file name corresponds to Nicos format (compressed or not)
Definition:
DataFormatUtils.cpp:142
Device
IO
DataFormatUtils.h
Generated by
1.9.1