version 3.8
rasterimagedata.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_RASTER_IMAGE_DATA_HH
13#define DUMUX_RASTER_IMAGE_DATA_HH
14
15#include <string>
16#include <vector>
17#include <fstream>
18
20
24struct Format
25{
26 std::string magicNumber;
27 std::string type;
28 std::string encoding;
29};
30
35{
37 std::size_t nCols;
38 std::size_t nRows;
39 std::size_t maxValue = 1;
40};
41
46template<class T>
47class Result : private std::vector<T>
48{
49 using Parent = std::vector<T>;
50public:
51 Result() = delete;
52
56 Result(const std::vector<T>& data, const HeaderData& header)
57 : Parent(data)
58 , header_(header)
59 {}
60
64 Result(std::vector<T>&& data, HeaderData&& header)
65 : Parent(std::move(data))
66 , header_(std::move(header))
67 {}
68
70 const HeaderData& header() const { return header_; }
71
72 // expose some methods of std::vector
73 using Parent::operator[];
74 using Parent::begin;
75 using Parent::end;
76 using Parent::size;
77
78private:
79 HeaderData header_;
80};
81
82} // end namespace Dumux::Detail::RasterImageData
83
84#endif
The return type of the reading functions. Holds the actual pixel values and the header data.
Definition: rasterimagedata.hh:48
const HeaderData & header() const
Returns the header data.
Definition: rasterimagedata.hh:70
Result(std::vector< T > &&data, HeaderData &&header)
Construct from data and header by move.
Definition: rasterimagedata.hh:64
Result(const std::vector< T > &data, const HeaderData &header)
Construct from data and header by copy.
Definition: rasterimagedata.hh:56
Definition: rasterimagedata.hh:19
A struct that holds all information of the image format.
Definition: rasterimagedata.hh:25
std::string magicNumber
Definition: rasterimagedata.hh:26
std::string type
Definition: rasterimagedata.hh:27
std::string encoding
Definition: rasterimagedata.hh:28
A struct that contains all header data of the image.
Definition: rasterimagedata.hh:35
std::size_t maxValue
Definition: rasterimagedata.hh:39
std::size_t nRows
Definition: rasterimagedata.hh:38
Format format
Definition: rasterimagedata.hh:36
std::size_t nCols
Definition: rasterimagedata.hh:37