mirror of https://github.com/OpenTTD/OpenTTD
(svn r17838) -Document: the Pool struct's template parameters
parent
a4d054eabc
commit
0ebe525e5b
|
@ -12,6 +12,13 @@
|
||||||
#ifndef POOL_TYPE_HPP
|
#ifndef POOL_TYPE_HPP
|
||||||
#define POOL_TYPE_HPP
|
#define POOL_TYPE_HPP
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for all pools.
|
||||||
|
* @tparam Titem Type of the class/struct that is going to be pooled
|
||||||
|
* @tparam Tindex Type of the index for this pool
|
||||||
|
* @tparam Tgrowth_step Size of growths; if the pool is full increase the size by this amount
|
||||||
|
* @tparam Tmax_size Maximum size of the pool
|
||||||
|
*/
|
||||||
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size>
|
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size>
|
||||||
struct Pool {
|
struct Pool {
|
||||||
static const size_t MAX_SIZE = Tmax_size; ///< Make template parameter accessible from outside
|
static const size_t MAX_SIZE = Tmax_size; ///< Make template parameter accessible from outside
|
||||||
|
@ -64,7 +71,10 @@ struct Pool {
|
||||||
return this->items <= Tmax_size - n;
|
return this->items <= Tmax_size - n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Base class for all PoolItems */
|
/**
|
||||||
|
* Base class for all PoolItems
|
||||||
|
* @tparam Tpool The pool this item is going to be part of
|
||||||
|
*/
|
||||||
template <struct Pool<Titem, Tindex, Tgrowth_step, Tmax_size> *Tpool>
|
template <struct Pool<Titem, Tindex, Tgrowth_step, Tmax_size> *Tpool>
|
||||||
struct PoolItem {
|
struct PoolItem {
|
||||||
Tindex index; ///< Index of this pool item
|
Tindex index; ///< Index of this pool item
|
||||||
|
|
Loading…
Reference in New Issue