Debian Codegraph @

src/LercLib/BitMask.h

raw symbols SCIP
1 /*
2 Copyright 2015 - 2026 Esri
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 A local copy of the license and additional notices are located with the
17 source distribution at:
18
19 http://github.com/Esri/lerc/
20
21 Contributors: Thomas Maurer
22 */
23
24 #ifndef BITMASK_H
25 #define BITMASK_Hcxx . . $ `src/LercLib/BitMask.h:25:9`!
26
27 #include "Defines.h"cxx . . $ `<file>/src/LercLib/Defines.h`/
28 #include <cstddef>
29 #include <cstdint>
30
31 NAMESPACE_LERC_STARTcxx . . $ LercNS/
32
33 /** BitMask - Convenient and fast access to binary mask bits
34 *
35 */
36
37 class BitMaskcxx . . $ LercNS/BitMask#
38 {
39 public:
40 BitMaskcxx . . $ LercNS/BitMask#BitMask(49f6e7a06ebc5aa8).() : m_pBitscxx . . $ LercNS/BitMask#m_pBits.(nullptr), m_nColscxx . . $ LercNS/BitMask#m_nCols.(0), m_nRowscxx . . $ LercNS/BitMask#m_nRows.(0) {}
41 BitMaskcxx . . $ LercNS/BitMask#BitMask(3e454b8ccf442868).(int nCols, int nRows) : m_pBitscxx . . $ LercNS/BitMask#m_pBits.(nullptr), m_nColscxx . . $ LercNS/BitMask#m_nCols.(0), m_nRowscxx . . $ LercNS/BitMask#m_nRows.(0) { SetSizecxx . . $ LercNS/BitMask#SetSize(cf9ef193275fa6d8).(nCols, nRows); }
42 BitMaskcxx . . $ LercNS/BitMask#BitMask(99ea2fc795a214ed).(const BitMaskcxx . . $ LercNS/BitMask#& src);
43 ~cxx . . $ LercNS/BitMask#`~BitMask`(ced63f7c635d850d).BitMaskcxx . . $ LercNS/BitMask#() { Clearcxx . . $ LercNS/BitMask#Clear(49f6e7a06ebc5aa8).(); }
44
45 BitMaskcxx . . $ LercNS/BitMask#& operatorcxx . . $ LercNS/BitMask#`operator=`(7ed6a81e88dd5cab).= (const BitMaskcxx . . $ LercNS/BitMask#& src);
46
47 // 1: valid, 0: not valid
48 Bytecxx . . $ LercNS/Byte# IsValidcxx . . $ LercNS/BitMask#IsValid(7c969c143e367631).(int64_tcxx . . $ int64_t# k) const { return (m_pBitscxx . . $ LercNS/BitMask#m_pBits.[k >> 3] & Bitcxx . . $ LercNS/BitMask#Bit(86ac75ffba967412).(k)) > 0; }
49 Bytecxx . . $ LercNS/Byte# IsValidcxx . . $ LercNS/BitMask#IsValid(e78c3acd18cf7e8b).(int row, int col) const { return IsValidcxx . . $ LercNS/BitMask#IsValid(7c969c143e367631).((int64_tcxx . . $ int64_t#)row * m_nColscxx . . $ LercNS/BitMask#m_nCols. + col); }
50
51 void SetValidcxx . . $ LercNS/BitMask#SetValid(32107cb1e3ffb1ae).(int64_tcxx . . $ int64_t# k) const { m_pBitscxx . . $ LercNS/BitMask#m_pBits.[k >> 3] |= Bitcxx . . $ LercNS/BitMask#Bit(86ac75ffba967412).(k); }
52 void SetValidcxx . . $ LercNS/BitMask#SetValid(db7b78144a373e11).(int row, int col) const { SetValidcxx . . $ LercNS/BitMask#SetValid(32107cb1e3ffb1ae).((int64_tcxx . . $ int64_t#)row * m_nColscxx . . $ LercNS/BitMask#m_nCols. + col); }
53
54 void SetInvalidcxx . . $ LercNS/BitMask#SetInvalid(32107cb1e3ffb1ae).(int64_tcxx . . $ int64_t# k) const { m_pBitscxx . . $ LercNS/BitMask#m_pBits.[k >> 3] &= ~Bitcxx . . $ LercNS/BitMask#Bit(86ac75ffba967412).(k); }
55 void SetInvalidcxx . . $ LercNS/BitMask#SetInvalid(db7b78144a373e11).(int row, int col) const { SetInvalidcxx . . $ LercNS/BitMask#SetInvalid(32107cb1e3ffb1ae).((int64_tcxx . . $ int64_t#)row * m_nColscxx . . $ LercNS/BitMask#m_nCols. + col); }
56
57 void SetAllValidcxx . . $ LercNS/BitMask#SetAllValid(83f5f38750778ac8).() const;
58 void SetAllInvalidcxx . . $ LercNS/BitMask#SetAllInvalid(83f5f38750778ac8).() const;
59
60 bool SetSizecxx . . $ LercNS/BitMask#SetSize(cf9ef193275fa6d8).(int nCols, int nRows);
61
62 int GetWidthcxx . . $ LercNS/BitMask#GetWidth(455f465bc33b4cdf).() const { return m_nColscxx . . $ LercNS/BitMask#m_nCols.; }
63 int GetHeightcxx . . $ LercNS/BitMask#GetHeight(455f465bc33b4cdf).() const { return m_nRowscxx . . $ LercNS/BitMask#m_nRows.; }
64 size_t Sizecxx . . $ LercNS/BitMask#Size(fe4d2d262d4164a8).() const { int64_tcxx . . $ int64_t# n = ((int64_tcxx . . $ int64_t#)m_nColscxx . . $ LercNS/BitMask#m_nCols. * m_nRowscxx . . $ LercNS/BitMask#m_nRows. + 7) >> 3; return n >= 0 ? (size_t)n : 0; }
65 const Bytecxx . . $ LercNS/Byte#* Bitscxx . . $ LercNS/BitMask#Bits(7eb257f306f79f97).() const { return m_pBitscxx . . $ LercNS/BitMask#m_pBits.; }
66 Bytecxx . . $ LercNS/Byte#* Bitscxx . . $ LercNS/BitMask#Bits(37d8967d10cb1e7b).() { return m_pBitscxx . . $ LercNS/BitMask#m_pBits.; }
67 static Bytecxx . . $ LercNS/Byte# Bitcxx . . $ LercNS/BitMask#Bit(86ac75ffba967412).(int64_tcxx . . $ int64_t# k) { return (1 << 7) >> (k & 7); }
68
69 int64_tcxx . . $ int64_t# CountValidBitscxx . . $ LercNS/BitMask#CountValidBits(57a65ae535d7db84).() const;
70 void Clearcxx . . $ LercNS/BitMask#Clear(49f6e7a06ebc5aa8).();
71
72 private:
73 Bytecxx . . $ LercNS/Byte#* m_pBitscxx . . $ LercNS/BitMask#m_pBits.;
74 int m_nColscxx . . $ LercNS/BitMask#m_nCols., m_nRowscxx . . $ LercNS/BitMask#m_nRows.;
75 };
76
77 NAMESPACE_LERC_ENDcxx . . $ `src/LercLib/Defines.h:36:9`!
78
79 #endif