byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
FileIO.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2022 Kristiyan Manev (University of Manchester)
3  *
4  * Licensed under the Apache License, Version 2.0(the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #ifndef FILEIO_H
18 #define FILEIO_H
19 
20 #include<iostream>
21 #include<cstdint> //uint
22 #include<fstream>
23 #include<string>
24 
25 #include "Endianness.h"
26 
27 namespace FileIO {
28  inline uint64_t readNative64(std::ifstream& fin)
29  {
30  uint64_t readValue;
31  fin.read(reinterpret_cast<char*>(&readValue), 8);
32  return readValue;
33  }
34  inline uint32_t readNative32(std::ifstream& fin)
35  {
36  uint32_t readValue;
37  fin.read(reinterpret_cast<char*>(&readValue), 4);
38  return readValue;
39  }
40  inline uint16_t readNative16(std::ifstream& fin)
41  {
42  uint16_t readValue;
43  fin.read(reinterpret_cast<char*>(&readValue), 2);
44  return readValue;
45  }
46  inline uint8_t readNative8(std::ifstream& fin)
47  {
48  uint8_t readValue;
49  fin.read(reinterpret_cast<char*>(&readValue), 1);
50  return readValue;
51  }
52  inline uint64_t readBigEndian64(std::ifstream& fin)
53  {
55  }
56  inline uint32_t readBigEndian32(std::ifstream& fin)
57  {
59  }
60  inline uint16_t readBigEndian16(std::ifstream& fin)
61  {
63  }
64  inline uint8_t readBigEndian8(std::ifstream& fin)
65  {
66  return readNative8(fin);
67  }
68 
69  inline uint64_t readLittleEndian64(std::ifstream& fin)
70  {
72  }
73  inline uint32_t readLittleEndian32(std::ifstream& fin)
74  {
76  }
77  inline uint16_t readLittleEndian16(std::ifstream& fin)
78  {
80  }
81  inline uint8_t readLittleEndian8(std::ifstream& fin)
82  {
83  return readNative8(fin);
84  }
85 
86  inline uint64_t readBitSwappedBigEndian64(std::ifstream& fin)
87  {
89  }
90  inline uint32_t readBitSwappedBigEndian32(std::ifstream& fin)
91  {
93  }
94  inline uint16_t readBitSwappedBigEndian16(std::ifstream& fin)
95  {
97  }
98  inline uint8_t readBitSwappedBigEndian8(std::ifstream& fin)
99  {
101  }
102 
103  inline uint64_t readBitSwappedLittleEndian64(std::ifstream& fin)
104  {
106  }
107  inline uint32_t readBitSwappedLittleEndian32(std::ifstream& fin)
108  {
110  }
111  inline uint16_t readBitSwappedLittleEndian16(std::ifstream& fin)
112  {
114  }
115  inline uint8_t readBitSwappedLittleEndian8(std::ifstream& fin)
116  {
118  }
119  inline uint64_t read64(std::ifstream& fin, Endianness e = Endianness::NATIVE)
120  {
121  if(e == Endianness::BE)
122  return FileIO::readBigEndian64(fin);
123  else if(e == Endianness::LE)
124  return FileIO::readLittleEndian64(fin);
125  else if(e == Endianness::BE_BS)
127  else if(e == Endianness::LE_BS)
129  return FileIO::readNative64(fin);
130  }
131  inline uint32_t read32(std::ifstream& fin, Endianness e = Endianness::NATIVE)
132  {
133  if(e == Endianness::BE)
134  return FileIO::readBigEndian32(fin);
135  else if(e == Endianness::LE)
136  return FileIO::readLittleEndian32(fin);
137  else if(e == Endianness::BE_BS)
139  else if(e == Endianness::LE_BS)
141  return FileIO::readNative32(fin);
142  }
143  inline uint16_t read16(std::ifstream& fin, Endianness e = Endianness::NATIVE)
144  {
145  if(e == Endianness::BE)
146  return FileIO::readBigEndian16(fin);
147  else if(e == Endianness::LE)
148  return FileIO::readLittleEndian16(fin);
149  else if(e == Endianness::BE_BS)
151  else if(e == Endianness::LE_BS)
153  return FileIO::readNative16(fin);
154  }
155  inline uint8_t read8 (std::ifstream& fin, Endianness e = Endianness::NATIVE)
156  {
157  if(e == Endianness::BE)
158  return FileIO::readBigEndian8(fin);
159  else if(e == Endianness::LE)
160  return FileIO::readLittleEndian8(fin);
161  else if(e == Endianness::BE_BS)
163  else if(e == Endianness::LE_BS)
165  return FileIO::readNative8(fin);
166  }
167 
168 
169  inline char* readStringIntoCharArray(std::ifstream& fin, int stringSize)
170  {
171  char* readCharArray = new char[stringSize + 1];
172  fin.read(readCharArray, stringSize);
173  readCharArray[stringSize]='\0';
174  return readCharArray;
175  }
176  inline std::string readString(std::ifstream& fin, int stringSize)
177  {
178  char* readCharArray = readStringIntoCharArray(fin, stringSize);
179  std::string returnString = std::string(readCharArray);
180  delete readCharArray;
181  return returnString;
182  }
183 
184  inline char* readBitSwappedStringIntoCharArray(std::ifstream& fin, int stringSize)
185  {
186  char* readCharArray = FileIO::readStringIntoCharArray(fin, stringSize);
187  for(int i = 0 ; i < stringSize ; i++)
188  readCharArray[i] = Endian::BitSwap8(readCharArray[i]);
189  return readCharArray;
190  }
191  inline std::string readBitSwappedString(std::ifstream& fin, int stringSize)
192  {
193  char* readCharArray = readBitSwappedStringIntoCharArray(fin, stringSize);
194  std::string returnString = std::string(readCharArray);
195  delete readCharArray;
196  return returnString;
197  }
198 
199  inline char* readStringIntoCharArray(std::ifstream& fin, int stringSize, Endianness e)
200  {
201  if(e == Endianness::BE_BS || e == Endianness::LE_BS)
202  return FileIO::readBitSwappedStringIntoCharArray(fin, stringSize);
203  else
204  return FileIO::readStringIntoCharArray(fin, stringSize);
205  }
206  inline std::string readString(std::ifstream& fin, int stringSize, Endianness e)
207  {
208  if(e == Endianness::BE_BS || e == Endianness::LE_BS)
209  return FileIO::readBitSwappedString(fin, stringSize);
210  else
211  return FileIO::readString(fin, stringSize);
212  }
213 
214  inline void writeNative64(std::ofstream& fout, uint64_t writeValue)
215  {
216  fout.write(reinterpret_cast<char*>(&writeValue), sizeof(writeValue));
217  }
218  inline void writeNative32(std::ofstream& fout, uint32_t writeValue)
219  {
220  fout.write(reinterpret_cast<char*>(&writeValue), sizeof(writeValue));
221  }
222  inline void writeNative16(std::ofstream& fout, uint16_t writeValue)
223  {
224  fout.write(reinterpret_cast<char*>(&writeValue), sizeof(writeValue));
225  }
226  inline void writeNative8 (std::ofstream& fout, uint8_t writeValue)
227  {
228  fout.write(reinterpret_cast<char*>(&writeValue), sizeof(writeValue));
229  }
230 
231  inline void writeBigEndian64(std::ofstream& fout, uint64_t writeValue)
232  {
233  uint64_t writeValueBigEndian = Endian::BigEndianToNative64(writeValue);
234  fout.write(reinterpret_cast<char*>(&writeValueBigEndian), sizeof(writeValueBigEndian));
235  }
236  inline void writeBigEndian32(std::ofstream& fout, uint32_t writeValue)
237  {
238  uint32_t writeValueBigEndian = Endian::BigEndianToNative32(writeValue);
239  fout.write(reinterpret_cast<char*>(&writeValueBigEndian), sizeof(writeValueBigEndian));
240  }
241  inline void writeBigEndian16(std::ofstream& fout, uint16_t writeValue)
242  {
243  uint16_t writeValueBigEndian = Endian::BigEndianToNative16(writeValue);
244  fout.write(reinterpret_cast<char*>(&writeValueBigEndian), sizeof(writeValueBigEndian));
245  }
246  inline void writeBigEndian8 (std::ofstream& fout, uint8_t writeValue)
247  {
248  uint8_t writeValueBigEndian = Endian::BigEndianToNative8(writeValue);
249  fout.write(reinterpret_cast<char*>(&writeValueBigEndian), sizeof(writeValueBigEndian));
250  }
251 
252  inline void writeLittleEndian64(std::ofstream& fout, uint64_t writeValue)
253  {
254  uint64_t writeValueLittleEndian = Endian::LittleEndianToNative64(writeValue);
255  fout.write(reinterpret_cast<char*>(&writeValueLittleEndian), sizeof(writeValueLittleEndian));
256  }
257  inline void writeLittleEndian32(std::ofstream& fout, uint32_t writeValue)
258  {
259  uint32_t writeValueLittleEndian = Endian::LittleEndianToNative32(writeValue);
260  fout.write(reinterpret_cast<char*>(&writeValueLittleEndian), sizeof(writeValueLittleEndian));
261  }
262  inline void writeLittleEndian16(std::ofstream& fout, uint16_t writeValue)
263  {
264  uint16_t writeValueLittleEndian = Endian::LittleEndianToNative16(writeValue);
265  fout.write(reinterpret_cast<char*>(&writeValueLittleEndian), sizeof(writeValueLittleEndian));
266  }
267  inline void writeLittleEndian8 (std::ofstream& fout, uint8_t writeValue)
268  {
269  uint8_t writeValueLittleEndian = Endian::LittleEndianToNative8(writeValue);
270  fout.write(reinterpret_cast<char*>(&writeValueLittleEndian), sizeof(writeValueLittleEndian));
271  }
272 
273  inline void writeBitSwappedBigEndian64(std::ofstream& fout, uint64_t writeValue)
274  {
275  uint64_t writeValueByteSwapped = Endian::BitSwap64(writeValue);
276  uint64_t writeValueByteSwappedBigEndian = Endian::BigEndianToNative64(writeValueByteSwapped);
277  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedBigEndian), sizeof(writeValueByteSwappedBigEndian));
278  }
279  inline void writeBitSwappedBigEndian32(std::ofstream& fout, uint32_t writeValue)
280  {
281  uint32_t writeValueByteSwapped = Endian::BitSwap32(writeValue);
282  uint32_t writeValueByteSwappedBigEndian = Endian::BigEndianToNative32(writeValueByteSwapped);
283  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedBigEndian), sizeof(writeValueByteSwappedBigEndian));
284  }
285  inline void writeBitSwappedBigEndian16(std::ofstream& fout, uint16_t writeValue)
286  {
287  uint16_t writeValueByteSwapped = Endian::BitSwap16(writeValue);
288  uint16_t writeValueByteSwappedBigEndian = Endian::BigEndianToNative16(writeValueByteSwapped);
289  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedBigEndian), sizeof(writeValueByteSwappedBigEndian));
290  }
291  inline void writeBitSwappedBigEndian8 (std::ofstream& fout, uint8_t writeValue)
292  {
293  uint8_t writeValueByteSwapped = Endian::BitSwap8(writeValue);
294  uint8_t writeValueByteSwappedBigEndian = Endian::BigEndianToNative8(writeValueByteSwapped);
295  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedBigEndian), sizeof(writeValueByteSwappedBigEndian));
296  }
297 
298  inline void writeBitSwappedLittleEndian64(std::ofstream& fout, uint64_t writeValue)
299  {
300  uint64_t writeValueByteSwapped = Endian::BitSwap64(writeValue);
301  uint64_t writeValueByteSwappedLittleEndian = Endian::LittleEndianToNative64(writeValueByteSwapped);
302  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedLittleEndian), sizeof(writeValueByteSwappedLittleEndian));
303  }
304  inline void writeBitSwappedLittleEndian32(std::ofstream& fout, uint32_t writeValue)
305  {
306  uint32_t writeValueByteSwapped = Endian::BitSwap32(writeValue);
307  uint32_t writeValueByteSwappedLittleEndian = Endian::LittleEndianToNative32(writeValueByteSwapped);
308  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedLittleEndian), sizeof(writeValueByteSwappedLittleEndian));
309  }
310  inline void writeBitSwappedLittleEndian16(std::ofstream& fout, uint16_t writeValue)
311  {
312  uint16_t writeValueByteSwapped = Endian::BitSwap16(writeValue);
313  uint16_t writeValueByteSwappedLittleEndian = Endian::LittleEndianToNative16(writeValueByteSwapped);
314  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedLittleEndian), sizeof(writeValueByteSwappedLittleEndian));
315  }
316  inline void writeBitSwappedLittleEndian8 (std::ofstream& fout, uint8_t writeValue)
317  {
318  uint8_t writeValueByteSwapped = Endian::BitSwap8(writeValue);
319  uint8_t writeValueByteSwappedLittleEndian = Endian::LittleEndianToNative8(writeValueByteSwapped);
320  fout.write(reinterpret_cast<char*>(&writeValueByteSwappedLittleEndian), sizeof(writeValueByteSwappedLittleEndian));
321  }
322 
323  inline void writeCharArray(std::ofstream& fout, char* writeCharArray, size_t outputSize = 0)
324  {
325  uint8_t nullChar = 0;
326  size_t charArraySize = 1;
327  for( ; (0 != writeCharArray[charArraySize-1] && charArraySize != outputSize); charArraySize++);
328  fout.write(writeCharArray, charArraySize);
329  for( ; charArraySize < outputSize ; charArraySize++)
330  fout.write(reinterpret_cast<char*>(&nullChar), 1);
331  }
332  inline void writeString(std::ofstream& fout, std::string writeString, size_t outputSize = 0)
333  {
334  uint8_t nullChar = 0;
335  size_t stringSize = writeString.size() + 1;
336  if((0 == outputSize) || (outputSize >= stringSize))
337  fout.write(writeString.c_str(), stringSize);
338  else
339  fout.write(writeString.c_str(), outputSize);
340  for( ; stringSize < outputSize ; stringSize++)
341  fout.write(reinterpret_cast<char*>(&nullChar), 1);
342  }
343 
344  inline void writeBitSwappedCharArray(std::ofstream& fout, char* writeCharArray, size_t outputSize = 0)
345  {
346  uint8_t nextChar = 0;
347  size_t charArraySize = 1;
348  for( ; (0 != writeCharArray[charArraySize-1] && charArraySize != outputSize); charArraySize++);
349  for(size_t i = 0 ; i < charArraySize ; i++){
350  nextChar = Endian::BitSwap8(writeCharArray[i]);
351  fout.write(reinterpret_cast<char*>(&nextChar), 1);
352  }
353  nextChar = 0;
354  for( ; charArraySize < outputSize ; charArraySize++)
355  fout.write(reinterpret_cast<char*>(&nextChar), 1);
356  }
357  inline void writeBitSwappedString(std::ofstream& fout, std::string writeString, size_t outputSize = 0)
358  {
359  uint8_t nextChar = 0;
360  size_t stringSize = writeString.size() + 1;
361  if((0 == outputSize) || (outputSize >= stringSize)) {
362  for(size_t i = 0 ; i < stringSize ; i++){
363  nextChar = Endian::BitSwap8(writeString.at(i));
364  fout.write(reinterpret_cast<char*>(&nextChar), 1);
365  }
366  } else {
367  for(size_t i = 0 ; i < outputSize ; i++){
368  nextChar = Endian::BitSwap8(writeString.at(i));
369  fout.write(reinterpret_cast<char*>(&nextChar), 1);
370  }
371  }
372  nextChar = 0;
373  for( ; stringSize < outputSize ; stringSize++)
374  fout.write(reinterpret_cast<char*>(&nextChar), 1);
375  }
376 
377  inline void writeCharArray(std::ofstream& fout, char* writeCharArray, size_t outputSize, Endianness e)
378  {
379  if(e == Endianness::BE_BS || e == Endianness::LE_BS)
380  return FileIO::writeBitSwappedCharArray(fout, writeCharArray, outputSize);
381  else
382  return FileIO::writeCharArray(fout, writeCharArray, outputSize);
383  }
384  inline void writeString(std::ofstream& fout, std::string writeString, size_t outputSize, Endianness e)
385  {
386  if(e == Endianness::BE_BS || e == Endianness::LE_BS)
387  return FileIO::writeBitSwappedString(fout, writeString, outputSize);
388  else
389  return FileIO::writeString(fout, writeString, outputSize);
390  }
391  inline void writeCharArray(std::ofstream& fout, char* writeCharArray, Endianness e)
392  {
393  if(e == Endianness::BE_BS || e == Endianness::LE_BS)
395  else
396  return FileIO::writeCharArray(fout, writeCharArray, 0);
397  }
398  inline void writeString(std::ofstream& fout, std::string writeString, Endianness e)
399  {
400  if(e == Endianness::BE_BS || e == Endianness::LE_BS)
402  else
403  return FileIO::writeString(fout, writeString, 0);
404  }
405 
406  inline void write64(std::ofstream& fout, uint64_t writeValue, Endianness e = Endianness::NATIVE)
407  {
408  if(e == Endianness::NATIVE)
409  FileIO::writeNative64(fout, writeValue);
410  else if(e == Endianness::BE)
411  FileIO::writeBigEndian64(fout, writeValue);
412  else if(e == Endianness::LE)
413  FileIO::writeLittleEndian64(fout, writeValue);
414  else if(e == Endianness::BE_BS)
415  FileIO::writeBitSwappedBigEndian64(fout, writeValue);
416  else if(e == Endianness::LE_BS)
417  FileIO::writeBitSwappedLittleEndian64(fout, writeValue);
418  }
419  inline void write32(std::ofstream& fout, uint32_t writeValue, Endianness e = Endianness::NATIVE)
420  {
421  if(e == Endianness::NATIVE)
422  FileIO::writeNative32(fout, writeValue);
423  else if(e == Endianness::BE)
424  FileIO::writeBigEndian32(fout, writeValue);
425  else if(e == Endianness::LE)
426  FileIO::writeLittleEndian32(fout, writeValue);
427  else if(e == Endianness::BE_BS)
428  FileIO::writeBitSwappedBigEndian32(fout, writeValue);
429  else if(e == Endianness::LE_BS)
430  FileIO::writeBitSwappedLittleEndian32(fout, writeValue);
431  }
432  inline void write16(std::ofstream& fout, uint16_t writeValue, Endianness e = Endianness::NATIVE)
433  {
434  if(e == Endianness::NATIVE)
435  FileIO::writeNative16(fout, writeValue);
436  else if(e == Endianness::BE)
437  FileIO::writeBigEndian16(fout, writeValue);
438  else if(e == Endianness::LE)
439  FileIO::writeLittleEndian16(fout, writeValue);
440  else if(e == Endianness::BE_BS)
441  FileIO::writeBitSwappedBigEndian16(fout, writeValue);
442  else if(e == Endianness::LE_BS)
443  FileIO::writeBitSwappedLittleEndian16(fout, writeValue);
444  }
445  inline void write8 (std::ofstream& fout, uint8_t writeValue, Endianness e = Endianness::NATIVE)
446  {
447  if(e == Endianness::NATIVE)
448  FileIO::writeNative8(fout, writeValue);
449  else if(e == Endianness::BE)
450  FileIO::writeBigEndian8(fout, writeValue);
451  else if(e == Endianness::LE)
452  FileIO::writeLittleEndian8(fout, writeValue);
453  else if(e == Endianness::BE_BS)
454  FileIO::writeBitSwappedBigEndian8(fout, writeValue);
455  else if(e == Endianness::LE_BS)
456  FileIO::writeBitSwappedLittleEndian8(fout, writeValue);
457  }
458 }
459 
460 #endif // FILEIO_H
Endianness
< Endianness in byteman is represented not only by big/little endian, but also by potential bit swapp...
Definition: Endianness.h:47
@ BE_BS
Big endian with bit swaps inside each byte.
@ LE_BS
Little endian with bit swaps inside each byte.
@ LE
Little endian ("LE" instead of full-er name, so it does not conflict with linux's reserved endianess ...
@ BE
Big endian ("BE" instead of full-er name, so it does not conflict with linux's reserved endianess wor...
@ NATIVE
System native will always be the fastest endianess to process.
uint64_t NativeToBigEndian64(uint64_t x)
Definition: Endianness.h:156
uint8_t BigEndianToNative8(uint8_t x)
Definition: Endianness.h:178
uint16_t BitSwap16(uint16_t x)
Definition: Endianness.h:216
uint8_t BitSwap8(uint8_t x)
Definition: Endianness.h:212
uint8_t LittleEndianToNative8(uint8_t x)
Definition: Endianness.h:194
uint16_t NativeToLittleEndian16(uint16_t x)
Definition: Endianness.h:165
uint32_t NativeToLittleEndian32(uint32_t x)
Definition: Endianness.h:169
uint64_t BitSwap64(uint64_t x)
Definition: Endianness.h:224
uint32_t BigEndianToNative32(uint32_t x)
Definition: Endianness.h:186
uint64_t BigEndianToNative64(uint64_t x)
Definition: Endianness.h:190
uint64_t NativeToLittleEndian64(uint64_t x)
Definition: Endianness.h:173
uint32_t NativeToBigEndian32(uint32_t x)
Definition: Endianness.h:152
uint16_t NativeToBigEndian16(uint16_t x)
Definition: Endianness.h:148
uint64_t LittleEndianToNative64(uint64_t x)
Definition: Endianness.h:206
uint32_t LittleEndianToNative32(uint32_t x)
Definition: Endianness.h:202
uint32_t BitSwap32(uint32_t x)
Definition: Endianness.h:220
uint16_t LittleEndianToNative16(uint16_t x)
Definition: Endianness.h:198
uint16_t BigEndianToNative16(uint16_t x)
Definition: Endianness.h:182
Definition: FileIO.h:27
void writeCharArray(std::ofstream &fout, char *writeCharArray, size_t outputSize=0)
Definition: FileIO.h:323
uint8_t readNative8(std::ifstream &fin)
Definition: FileIO.h:46
std::string readString(std::ifstream &fin, int stringSize)
Definition: FileIO.h:176
uint64_t read64(std::ifstream &fin, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:119
void writeBitSwappedLittleEndian8(std::ofstream &fout, uint8_t writeValue)
Definition: FileIO.h:316
uint64_t readBitSwappedLittleEndian64(std::ifstream &fin)
Definition: FileIO.h:103
uint64_t readBitSwappedBigEndian64(std::ifstream &fin)
Definition: FileIO.h:86
uint32_t readBigEndian32(std::ifstream &fin)
Definition: FileIO.h:56
uint8_t readBitSwappedLittleEndian8(std::ifstream &fin)
Definition: FileIO.h:115
uint32_t readNative32(std::ifstream &fin)
Definition: FileIO.h:34
void writeBitSwappedBigEndian16(std::ofstream &fout, uint16_t writeValue)
Definition: FileIO.h:285
void writeBigEndian16(std::ofstream &fout, uint16_t writeValue)
Definition: FileIO.h:241
uint32_t readLittleEndian32(std::ifstream &fin)
Definition: FileIO.h:73
void writeBitSwappedLittleEndian32(std::ofstream &fout, uint32_t writeValue)
Definition: FileIO.h:304
char * readBitSwappedStringIntoCharArray(std::ifstream &fin, int stringSize)
Definition: FileIO.h:184
void writeString(std::ofstream &fout, std::string writeString, size_t outputSize=0)
Definition: FileIO.h:332
uint16_t readBigEndian16(std::ifstream &fin)
Definition: FileIO.h:60
void write16(std::ofstream &fout, uint16_t writeValue, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:432
uint64_t readLittleEndian64(std::ifstream &fin)
Definition: FileIO.h:69
void write64(std::ofstream &fout, uint64_t writeValue, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:406
uint32_t readBitSwappedLittleEndian32(std::ifstream &fin)
Definition: FileIO.h:107
uint32_t readBitSwappedBigEndian32(std::ifstream &fin)
Definition: FileIO.h:90
uint16_t readBitSwappedLittleEndian16(std::ifstream &fin)
Definition: FileIO.h:111
void writeBigEndian32(std::ofstream &fout, uint32_t writeValue)
Definition: FileIO.h:236
void writeBitSwappedCharArray(std::ofstream &fout, char *writeCharArray, size_t outputSize=0)
Definition: FileIO.h:344
uint64_t readBigEndian64(std::ifstream &fin)
Definition: FileIO.h:52
void writeLittleEndian32(std::ofstream &fout, uint32_t writeValue)
Definition: FileIO.h:257
std::string readBitSwappedString(std::ifstream &fin, int stringSize)
Definition: FileIO.h:191
void writeLittleEndian8(std::ofstream &fout, uint8_t writeValue)
Definition: FileIO.h:267
uint16_t read16(std::ifstream &fin, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:143
void writeBigEndian8(std::ofstream &fout, uint8_t writeValue)
Definition: FileIO.h:246
void writeNative16(std::ofstream &fout, uint16_t writeValue)
Definition: FileIO.h:222
char * readStringIntoCharArray(std::ifstream &fin, int stringSize)
Definition: FileIO.h:169
void writeBitSwappedLittleEndian64(std::ofstream &fout, uint64_t writeValue)
Definition: FileIO.h:298
void writeLittleEndian16(std::ofstream &fout, uint16_t writeValue)
Definition: FileIO.h:262
void writeBitSwappedString(std::ofstream &fout, std::string writeString, size_t outputSize=0)
Definition: FileIO.h:357
void write8(std::ofstream &fout, uint8_t writeValue, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:445
uint64_t readNative64(std::ifstream &fin)
Definition: FileIO.h:28
void writeNative64(std::ofstream &fout, uint64_t writeValue)
Definition: FileIO.h:214
void writeLittleEndian64(std::ofstream &fout, uint64_t writeValue)
Definition: FileIO.h:252
void writeBitSwappedLittleEndian16(std::ofstream &fout, uint16_t writeValue)
Definition: FileIO.h:310
uint32_t read32(std::ifstream &fin, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:131
void writeNative32(std::ofstream &fout, uint32_t writeValue)
Definition: FileIO.h:218
void writeBigEndian64(std::ofstream &fout, uint64_t writeValue)
Definition: FileIO.h:231
void writeBitSwappedBigEndian64(std::ofstream &fout, uint64_t writeValue)
Definition: FileIO.h:273
uint8_t readBitSwappedBigEndian8(std::ifstream &fin)
Definition: FileIO.h:98
uint16_t readNative16(std::ifstream &fin)
Definition: FileIO.h:40
uint8_t readBigEndian8(std::ifstream &fin)
Definition: FileIO.h:64
uint8_t read8(std::ifstream &fin, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:155
void writeBitSwappedBigEndian32(std::ofstream &fout, uint32_t writeValue)
Definition: FileIO.h:279
uint8_t readLittleEndian8(std::ifstream &fin)
Definition: FileIO.h:81
uint16_t readBitSwappedBigEndian16(std::ifstream &fin)
Definition: FileIO.h:94
void writeBitSwappedBigEndian8(std::ofstream &fout, uint8_t writeValue)
Definition: FileIO.h:291
void writeNative8(std::ofstream &fout, uint8_t writeValue)
Definition: FileIO.h:226
uint16_t readLittleEndian16(std::ifstream &fin)
Definition: FileIO.h:77
void write32(std::ofstream &fout, uint32_t writeValue, Endianness e=Endianness::NATIVE)
Definition: FileIO.h:419