LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
readwritetools.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 *
8 * @file readwritetools.h
9 * @author Besancon Romaric (besanconr@zoe.cea.fr)
10 * @date Fri Nov 7 2003
11 * @version $Id$
12 * copyright Copyright (C) 2003-2012 by CEA LIST
13 * Project misc
14 *
15 * @brief contains helper functions for binary read/write
16 *
17 *
18 ***********************************************************************/
19
20#ifndef LIMA_COMMONS_MISC_READWRITETOOLS_H
21#define LIMA_COMMONS_MISC_READWRITETOOLS_H
22
23#include "common/LimaCommon.h"
24
25#include <iostream>
26
27namespace Lima {
28namespace Common {
29namespace Misc {
30
32//(one byte for numbers in [0-127], two bytes for numbers in [128-16383] etc.
33
41LIMA_DATA_EXPORT uint64_t readCodedInt(std::istream& file);
42
49LIMA_DATA_EXPORT void writeCodedInt(std::ostream& file, const uint64_t number);
50
52
53
55//(knowning that the integer is less than 256, useful for enum values)
56
64LIMA_DATA_EXPORT uint8_t readOneByteInt(std::istream& file);
65
72LIMA_DATA_EXPORT void writeOneByteInt(std::ostream& file, const uint8_t number);
73
75
76} // end namespace
77} // end namespace
78} // end namespace
79
80#endif
#define LIMA_DATA_EXPORT
Definition LimaCommon.h:128
uint8_t readOneByteInt(std::istream &file)
read a integer coded on one byte in a file
uint64_t readCodedInt(std::istream &file)
read a integer coded in variable-byte format in a file
void writeOneByteInt(std::ostream &file, const uint8_t number)
write a integer coded on one byte format in a file
void writeCodedInt(std::ostream &file, const uint64_t number)
write a integer coded in variable-byte format in a file
NAUTITIA.