27 #ifndef POINTERSLOTSTORAGE_H    28 #define POINTERSLOTSTORAGE_H    34 template <
typename T, 
int SIZE>
    43 #if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719    45 using std::tr1::array;
    60 template <
typename T, 
int SIZE>
    69 #if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719    70     _data.assign(
nullptr);
   113     for (
size_t i = 0; i < SIZE; ++i) {
   114       if (_data[i] == 
nullptr) {
   138     nassertr(num_consecutive > 0, 
false);
   141     if (num_consecutive == 1) {
   146     for (
size_t i = 0; i < SIZE; ++i) {
   147       bool any_taken = 
false;
   148       for (
size_t k = 0; !any_taken && k < num_consecutive; ++k) {
   149         any_taken = _data[i + k] != 
nullptr;
   167     nassertv(slot >= 0 && slot < SIZE);
   168     nassertv(_data[slot] != 
nullptr); 
   169     _data[slot] = 
nullptr;
   173     if ((
int)slot == _max_index) {
   174       while (_max_index >= 0 && !_data[_max_index--]);
   187     for (
size_t i = slot; i < slot + num_consecutive; ++i) {
   203     nassertv(slot >= 0 && slot < SIZE);
   204     nassertv(_data[slot] == 
nullptr); 
   205     nassertv(ptr != 
nullptr); 
   206     _max_index = std::max(_max_index, (
int)slot);
   211   typedef array<T, SIZE> InternalContainer;
   218   typename InternalContainer::iterator 
begin() {
   219     return _data.begin();
   228   typename InternalContainer::iterator 
end() {
   229     return _data.begin() + _max_index + 1;
   235   InternalContainer _data;
   240 #endif // POINTERSLOTSTORAGE_H PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
 
size_t get_num_entries() const
Returns the amount of elements of the container.
 
PointerSlotStorage()
Constructs a new PointerSlotStorage.
 
InternalContainer::iterator end()
Returns an iterator to the end of the container.
 
void reserve_slot(size_t slot, T ptr)
Reserves a slot.
 
Class to keep a list of pointers and nullpointers.
 
void free_consecutive_slots(size_t slot, size_t num_consecutive)
Frees consecutive allocated slots.
 
int get_max_index() const
Returns the maximum index of the container.
 
bool find_consecutive_slots(size_t &slot, size_t num_consecutive) const
Finds free consecutive slots.
 
bool find_slot(size_t &slot) const
Finds a free slot.
 
void free_slot(size_t slot)
Frees an allocated slot.
 
InternalContainer::iterator begin()
Returns an iterator to the begin of the container.