#include <unit_cache.h>
CUnitCache::CUnitCache |
( |
| ) |
|
|
inline |
void CUnitCache::clear |
( |
| ) |
|
|
inline |
template<typename _T >
CUnit* CUnitCache::find |
( |
const _T & |
pred | ) |
const |
|
inline |
Find the first unit in a tile cache for which a predicate is true.
- Parameters
-
pred | A predicate object vith bool operator()(const CUnit *). |
- Returns
- The first unit u in the cache such that
pred(u)
is true, or NULL if no such unit exists.
template<typename _T >
void CUnitCache::for_each |
( |
const _T |
functor | ) |
|
|
inline |
Apply a function to every element of a cache.
- Parameters
-
functor | A unary function object vith void operator()(CUnit *). |
- Returns
- count of visited element.
Applies the function object f
to each element in the cache. functor
must not modify the order of the cache.
template<typename _T >
int CUnitCache::for_each_if |
( |
const _T & |
functor | ) |
|
|
inline |
Apply a function to every element of a cache.
- Parameters
-
functor | A unary function object vith bool operator()(CUnit *). |
- Returns
- count of visited element.
Applies the function object f
to each element in the cache. functor
must not modify the order of the cache. If functor
return false then loop is exited.
void CUnitCache::Insert |
( |
CUnit * |
unit | ) |
|
|
inline |
Insert new unit into tile cache.
- Parameters
-
unit | Unit pointer to place in cache. |
bool CUnitCache::InsertS |
( |
CUnit * |
unit | ) |
|
|
inline |
Insert new unit into tile cache. Sorted version for binary searching.
- Parameters
-
unit | Unit pointer to place in cache. |
- Returns
- false if unit is already in cache and nothing is added.
CUnit* CUnitCache::operator[] |
( |
const unsigned int |
index | ) |
const |
|
inline |
CUnit* CUnitCache::operator[] |
( |
const unsigned int |
index | ) |
|
|
inline |
CUnit* CUnitCache::Remove |
( |
const unsigned int |
index | ) |
|
|
inline |
Remove unit on index from unit cache.
- Parameters
-
index | Unit index to remove from container. |
- Returns
- pointer to removed element.
bool CUnitCache::Remove |
( |
CUnit *const |
unit | ) |
|
|
inline |
Remove unit from unit cache.
- Parameters
-
unit | Unit pointer to remove from container. |
void CUnitCache::RemoveS |
( |
CUnit *const |
unit | ) |
|
|
inline |
Remove unit from unit cache.
- Parameters
-
unit | Unit pointer to remove from container. |
size_t CUnitCache::size |
( |
| ) |
const |
|
inline |
std::vector<CUnit *> CUnitCache::Units |
The documentation for this class was generated from the following file:
(C) Copyright 1998-2012 by The