29 explicit PalettePool(std::bitset<palette::num_palettes> available_indexes);
36 return (available_indexes_ & ~checked_out_).any();
44 [[nodiscard]]
bool is_available(std::size_t hardware_index)
const;
55 [[nodiscard]] std::size_t
checkout();
81 std::bitset<palette::num_palettes> available_indexes_;
82 std::bitset<palette::num_palettes> checked_out_;
83 std::vector<std::size_t> checkout_stack_;
Manages allocation of hardware palette indexes with stack-based checkout semantics.
bool has_available_palette() const
Checks if there is at least one available palette that can be checked out.
std::size_t checkout()
Checks out the next available hardware palette index.
void checkin()
Returns the most recently checked-out hardware palette index index to the pool.
bool is_available(std::size_t hardware_index) const
Checks if a specific index is available for checkout.