Grok 12.0.1
IBitIO.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2024 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include <cstdint>
19
20namespace grk
21{
25class IBitIO
26{
27 public:
28 virtual ~IBitIO() {}
29
34 virtual size_t numBytes() = 0;
35
41 virtual bool write(uint32_t v, uint32_t n) = 0;
42 virtual bool write(uint32_t v) = 0;
48 virtual void read(uint32_t* bits, uint8_t n) = 0;
53 virtual uint8_t read(void) = 0;
58 virtual bool flush() = 0;
62 virtual void inalign() = 0;
63};
64
65} // namespace grk
Bit input/output.
Definition IBitIO.h:26
virtual bool flush()=0
Flush bits.
virtual bool write(uint32_t v, uint32_t n)=0
Write bits.
virtual size_t numBytes()=0
Number of bytes written.
virtual void read(uint32_t *bits, uint8_t n)=0
Read bits.
virtual void inalign()=0
Passes the ending bits (coming from flushing)
virtual uint8_t read(void)=0
Read bit.
virtual bool write(uint32_t v)=0
virtual ~IBitIO()
Definition IBitIO.h:28
Copyright (C) 2016-2024 Grok Image Compression Inc.
Definition ICacheable.h:20
void grk_read(const uint8_t *buffer, TYPE *value, uint32_t numBytes)
Definition BufferedStream.h:239