ScummVM API documentation
Sci::StablePointerArray< T, N > Class Template Reference

#include <lists32.h>

Inheritance diagram for Sci::StablePointerArray< T, N >:
Sci::RectList Sci::ScreenItemList

Public Types

typedef T ** iterator
 
typedef T *const * const_iterator
 
typedef T * value_type
 
typedef uint size_type
 

Public Member Functions

 StablePointerArray (const StablePointerArray &other)
 
void operator= (const StablePointerArray &other)
 
T *const & operator[] (size_type index) const
 
T *& operator[] (size_type index)
 
void add (T *item)
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 
iterator end ()
 
const_iterator end () const
 
void erase (T *item)
 
void erase (iterator &it)
 
void erase_at (size_type index)
 
size_type pack ()
 
size_type max_size () const
 
size_type size () const
 

Detailed Description

template<class T, uint N>
class Sci::StablePointerArray< T, N >

StablePointerArray holds pointers in a fixed-size array that maintains position of erased items until pack is called. It is used by RectList and ScreenItemList. StablePointerArray takes ownership of all pointers that are passed to it and deletes them when calling erase or when destroying the StablePointerArray.

StablePointerArray used to be used for DrawList, until it was discovered that an LSL7 room with many screen items can overflow the fixed array. StablePointerDynamicArray was created below to handle DrawList, while StablePointerArray keeps the performance advantages of fixed arrays on the stack when rendering frames.

Member Function Documentation

◆ add()

template<class T , uint N>
void Sci::StablePointerArray< T, N >::add ( T *  item)
inline

Adds a new pointer to the array.

◆ erase() [1/2]

template<class T , uint N>
void Sci::StablePointerArray< T, N >::erase ( T *  item)
inline

Erases the object pointed to by the given iterator.

◆ erase() [2/2]

template<class T , uint N>
void Sci::StablePointerArray< T, N >::erase ( iterator &  it)
inline

Erases the object pointed to by the given iterator.

◆ erase_at()

template<class T , uint N>
void Sci::StablePointerArray< T, N >::erase_at ( size_type  index)
inline

Erases the object pointed to at the given index.

◆ pack()

template<class T , uint N>
size_type Sci::StablePointerArray< T, N >::pack ( )
inline

Removes freed pointers from the pointer list.

◆ max_size()

template<class T , uint N>
size_type Sci::StablePointerArray< T, N >::max_size ( ) const
inline

The maximum number of elements the container is able to hold.

◆ size()

template<class T , uint N>
size_type Sci::StablePointerArray< T, N >::size ( ) const
inline

The number of populated slots in the array. The size of the array will only go down once pack is called.


The documentation for this class was generated from the following file: