33 explicit PalettePool(std::bitset<pal::num_pals> available_indexes);
42 return (available_indexes_ & ~checked_out_).any();
52 [[nodiscard]]
bool is_available(std::size_t hardware_index)
const;
65 [[nodiscard]] std::size_t
checkout();
95 std::bitset<pal::num_pals> available_indexes_;
96 std::bitset<pal::num_pals> checked_out_;
97 std::vector<std::size_t> checkout_stack_;
Manages allocation of hardware palette indexes with stack-based checkout semantics.
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.
bool has_available_pal() const
Checks if there is at least one available pal that can be checked out.