Loading...
Searching...
No Matches
GenericIO.hpp
1/*---------------------------------------------------------------------------*\
2 *
3 * bitpit
4 *
5 * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6 *
7 * -------------------------------------------------------------------------
8 * License
9 * This file is part of bitpit.
10 *
11 * bitpit is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License v3 (LGPL)
13 * as published by the Free Software Foundation.
14 *
15 * bitpit is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with bitpit. If not, see <http://www.gnu.org/licenses/>.
22 *
23\*---------------------------------------------------------------------------*/
24
25#ifndef __BITPIT_GENERIC_IO_HPP__
26#define __BITPIT_GENERIC_IO_HPP__
27
28#include <iostream>
29#include <iomanip>
30#include <fstream>
31#include <sstream>
32#include <vector>
33#include <array>
34
35#include "bitpit_common.hpp"
36#include "bitpit_containers.hpp"
37
38#include "logger.hpp"
39
40namespace bitpit {
41
46namespace genericIO{
47
48template<class data_T>
49void lineStream(std::fstream &str, data_T &data);
50
51template<class data_T>
52void lineStream(std::fstream &str, std::vector<data_T> &data);
53
54template<class data_T, size_t d>
55void lineStream(std::fstream &str, std::array<data_T,d> &data);
56
57template<class data_T, size_t d>
58void lineStream(std::fstream &str, data_T *data, int nr);
59
60template<class data_T>
61void flushASCII(std::fstream &str, const data_T &data);
62
63template<>
64void flushASCII(std::fstream &str, const uint8_t &data);
65
66template<class data_T>
67void flushASCII(std::fstream &str, int elements_per_line, const std::vector<data_T> &data);
68
69template<class data_T, size_t d>
70void flushASCII(std::fstream &str, int elements_per_line, const std::array<data_T,d> &data);
71
72template<class data_T>
73void flushASCII(std::fstream &str, int elements_per_line, const data_T *data, int nr);
74
75template<class data_T>
76void flushASCII(std::fstream &str, int elements_per_line, const bitpit::PiercedVector<data_T> &data, bool writeIndex = false);
77
78template<class data_T>
79void flushBINARY(std::fstream &str, const data_T &data);
80
81template<class data_T>
82void flushBINARY(std::fstream &str, const std::vector<data_T> &data);
83
84template<class data_T>
85void flushBINARY(std::fstream &str, const std::vector<std::vector<data_T>> &data);
86
87template<class data_T, size_t d>
88void flushBINARY(std::fstream &str, const std::vector<std::array<data_T,d>> &data);
89
90template<class data_T, size_t d>
91void flushBINARY(std::fstream &str, const std::array<data_T,d> &data);
92
93template<class data_T>
94void flushBINARY(std::fstream &str, const data_T *data, int nr);
95
96template<class data_T>
97void flushBINARY(std::fstream &str, const bitpit::PiercedVector<data_T> &, bool writeIndex = false);
98
99template<class data_T>
100void absorbASCII(std::fstream &str, data_T &data);
101
102template<class data_T>
103void absorbASCII(std::fstream &str, std::vector<data_T> &data);
104
105template<class data_T>
106void absorbASCII(std::fstream &str, std::vector<std::vector<data_T>> &data);
107
108template<class data_T, size_t d>
109void absorbASCII(std::fstream &str, std::vector<std::array<data_T,d>> &data);
110
111template<class data_T, size_t d>
112void absorbASCII(std::fstream &str, std::array<data_T,d> &data);
113
114template<class data_T>
115void absorbASCII(std::fstream &str, data_T *data, int nr);
116
117template<class data_T>
118void absorbASCII(std::fstream &str, bitpit::PiercedVector<data_T> &data);
119
120template<class data_T>
121void absorbASCII(std::fstream &str, bitpit::PiercedVector<data_T> &data, long);
122
123template<class data_T>
124void absorbBINARY(std::fstream &str, data_T &data);
125
126template<class data_T>
127void absorbBINARY(std::fstream &str, std::vector<data_T> &data);
128
129template<class data_T>
130void absorbBINARY(std::fstream &str, std::vector<std::vector<data_T>> &data);
131
132template<class data_T, size_t d>
133void absorbBINARY(std::fstream &str, std::vector<std::array<data_T,d>> &data);
134
135template<class data_T, size_t d>
136void absorbBINARY(std::fstream &str, std::array<data_T,d> &data);
137
138template<class data_T>
139void absorbBINARY(std::fstream &str, data_T *data, int nr);
140
141template<class data_T>
142void absorbBINARY(std::fstream &str, bitpit::PiercedVector<data_T> &data);
143
144template<class data_T>
145void absorbBINARY(std::fstream &str, bitpit::PiercedVector<data_T> &data, long);
146
147void copyUntilEOFInString(std::fstream &str, char *&buffer, int &length);
148
149}
150
151}
152
153#include "GenericIO.tpp"
154
155#endif
Metafunction for generating a pierced vector.
void copyUntilEOFInString(std::fstream &str, char *&buffer, int &length)
Definition GenericIO.cpp:61
void flushASCII(std::fstream &str, const uint8_t &data)
Definition GenericIO.cpp:37
void absorbBINARY(std::fstream &str, data_T &data)
void absorbASCII(std::fstream &str, data_T &data)
void lineStream(std::fstream &str, data_T &data)
void flushBINARY(std::fstream &str, const data_T &data)
--- layout: doxygen_footer ---