
#include <cklists.h>


Public Member Functions | |
| CkPagedVector () | |
| CkPagedVector (int nEntries) | |
| ~CkPagedVector () | |
| void | init (int nEntries) |
| T & | operator[] (unsigned int i) |
| T | get (unsigned int i) |
| void | pupPage (PUP::er &p, int pg) |
| void | pup (PUP::er &p) |
Private Types | |
| enum | { pageSize = 256u } |
| This is the number of array entries per page. More... | |
Private Member Functions | |
| void | allocatePages (int nEntries) |
| void | allocatePage (int pg) |
Private Attributes | |
| T ** | pages |
| int | nPages |
Useful for saving memory when storing a long array with few used entries. Should be almost as fast as a regular vector.
When nothing is used, this reduces storage space by a factor of pageSize*sizeof(T)/sizeof(T*). For example, an array of 64-bit ints of length 1M takes 8MB; with paging it takes just 32KB, plus 2KB for each used block.
The class T must have a pup routine, a default constructor, and a copy constructor.
Definition at line 575 of file cklists.h.
anonymous enum [private] |
| CkPagedVector< T >::CkPagedVector | ( | ) | [inline] |
| CkPagedVector< T >::CkPagedVector | ( | int | nEntries | ) | [inline] |
Definition at line 596 of file cklists.h.
References CkPagedVector< T >::init().

| CkPagedVector< T >::~CkPagedVector | ( | ) | [inline] |
Definition at line 597 of file cklists.h.
References CkPagedVector< T >::nPages, and CkPagedVector< T >::pages.
| void CkPagedVector< T >::allocatePages | ( | int | nEntries | ) | [inline, private] |
Definition at line 583 of file cklists.h.
References CkPagedVector< T >::nPages, CkPagedVector< T >::pages, and CkPagedVector< T >::pageSize.
Referenced by CkPagedVector< T >::init(), and CkPagedVector< T >::pup().

| void CkPagedVector< T >::allocatePage | ( | int | pg | ) | [inline, private] |
Definition at line 588 of file cklists.h.
References CkPagedVector< T >::pages, and CkPagedVector< T >::pageSize.
Referenced by CkPagedVector< T >::operator[](), and CkPagedVector< T >::pupPage().

| void CkPagedVector< T >::init | ( | int | nEntries | ) | [inline] |
Definition at line 603 of file cklists.h.
References CkPagedVector< T >::allocatePages().
Referenced by CkPagedVector< T >::CkPagedVector().


| T& CkPagedVector< T >::operator[] | ( | unsigned int | i | ) | [inline] |
Definition at line 607 of file cklists.h.
References CkPagedVector< T >::allocatePage(), CkPagedVector< T >::pages, and CkPagedVector< T >::pageSize.

| T CkPagedVector< T >::get | ( | unsigned int | i | ) | [inline] |
Definition at line 616 of file cklists.h.
References CkPagedVector< T >::pages, and CkPagedVector< T >::pageSize.
| void CkPagedVector< T >::pupPage | ( | PUP::er & | p, | |
| int | pg | |||
| ) | [inline] |
Definition at line 622 of file cklists.h.
References CkPagedVector< T >::allocatePage(), PUP::er::isUnpacking(), CkPagedVector< T >::pages, and CkPagedVector< T >::pageSize.
Referenced by CkPagedVector< T >::pup().


| void CkPagedVector< T >::pup | ( | PUP::er & | p | ) | [inline] |
Definition at line 627 of file cklists.h.
References CkPagedVector< T >::allocatePages(), PUP::er::isUnpacking(), CkPagedVector< T >::nPages, CkPagedVector< T >::pages, CkPagedVector< T >::pageSize, and CkPagedVector< T >::pupPage().

T** CkPagedVector< T >::pages [private] |
Definition at line 581 of file cklists.h.
Referenced by CkPagedVector< T >::allocatePage(), CkPagedVector< T >::allocatePages(), CkPagedVector< T >::get(), CkPagedVector< T >::operator[](), CkPagedVector< T >::pup(), CkPagedVector< T >::pupPage(), and CkPagedVector< T >::~CkPagedVector().
int CkPagedVector< T >::nPages [private] |
Definition at line 582 of file cklists.h.
Referenced by CkPagedVector< T >::allocatePages(), CkPagedVector< T >::pup(), and CkPagedVector< T >::~CkPagedVector().
1.5.5