Zserio C++ runtime library  1.1.0
Built for Zserio 2.15.0
FileUtil.h
Go to the documentation of this file.
1 
10 #ifndef ZSERIO_FILE_UTIL_H_INC
11 #define ZSERIO_FILE_UTIL_H_INC
12 
13 #include "zserio/BitBuffer.h"
14 #include "zserio/BitStreamReader.h"
15 #include "zserio/BitStreamWriter.h"
16 
17 namespace zserio
18 {
19 
30 
40 void writeBufferToFile(const uint8_t* buffer, size_t bitSize, BitsTag, const std::string& fileName);
41 
53 inline void writeBufferToFile(const uint8_t* buffer, size_t byteSize, const std::string& fileName)
54 {
55  writeBufferToFile(buffer, byteSize * 8, BitsTag(), fileName);
56 }
57 
68 template <typename ALLOC>
69 inline void writeBufferToFile(const BasicBitBuffer<ALLOC>& bitBuffer, const std::string& fileName)
70 {
71  writeBufferToFile(bitBuffer.getBuffer(), bitBuffer.getBitSize(), BitsTag(), fileName);
72 }
73 
84 inline void writeBufferToFile(const BitStreamWriter& writer, const std::string& fileName)
85 {
86  writeBufferToFile(writer.getWriteBuffer(), writer.getBitPosition(), BitsTag(), fileName);
87 }
88 
89 } // namespace zserio
90 
91 #endif // ZSERIO_FILE_UTIL_H_INC
size_t getBitSize() const
Definition: BitBuffer.h:403
const uint8_t * getBuffer() const
Definition: BitBuffer.h:391
BitPosType getBitPosition() const
const uint8_t * getWriteBuffer() const
zserio::string< PropagatingPolymorphicAllocator< char > > string
Definition: String.h:15
BasicBitBuffer<> BitBuffer
Definition: BitBuffer.h:444
void writeBufferToFile(const uint8_t *buffer, size_t bitSize, BitsTag, const std::string &fileName)
Definition: FileUtil.cpp:10
BitBuffer readBufferFromFile(const std::string &fileName)
Definition: FileUtil.cpp:25