/* Header BitSet Copyright (C) 2019 AleaJactaEst This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef BIT_SET_H #define BIT_SET_H #include "core/reference.h" #include "modules/bitstream/bitstream.h" class BitSet : public Reference { GDCLASS(BitSet, Reference) protected: static void _bind_methods(); private: uint32_t _num_bits; uint32_t _size_byte; uint32_t _mask_last; uint32_t * _data; public: BitSet(); ~BitSet(); int size(); void resize(uint32_t num_bits); void clear(); void clear_data(); void set_bit(uint32_t bit_number); void clear_bit(uint32_t bit_number); void write(uint32_t bit_number, bool value); bool read(uint32_t bit_number); void write_serial(Ref msgout); void read_serial(Ref msgin); String show(); }; #endif