Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
A map based on Data.IntMap.Strict
. O(log(n)) for most operations.
Instances
MonadIO m => ExplMembers m (Map c) Source # | |
Defined in Apecs.Stores | |
MonadIO m => ExplDestroy m (Map c) Source # | |
Defined in Apecs.Stores explDestroy :: Map c -> Int -> m () Source # | |
MonadIO m => ExplSet m (Map c) Source # | |
MonadIO m => ExplGet m (Map c) Source # | |
MonadIO m => ExplInit m (Map c) Source # | |
Defined in Apecs.Stores | |
Cachable (Map s) Source # | |
Defined in Apecs.Stores | |
type Elem (Map c) Source # | |
Defined in Apecs.Stores |
data Cache (n :: Nat) s Source #
A cache around another store. Caches store their members in a fixed-size vector, so operations run in O(1). Caches can provide huge performance boosts, especially for large numbers of components. The cache size is given as a type-level argument.
Note that iterating over a cache is linear in cache size, so sparsely populated caches might actually decrease performance. In general, the exact size of the cache does not matter as long as it reasonably approximates the number of components present.
The cache uses entity (-2) to internally represent missing entities, so be wary when manually manipulating entities.
Instances
(MonadIO m, ExplMembers m s) => ExplMembers m (Cache n s) Source # | |
Defined in Apecs.Stores | |
(MonadIO m, ExplDestroy m s) => ExplDestroy m (Cache n s) Source # | |
Defined in Apecs.Stores explDestroy :: Cache n s -> Int -> m () Source # | |
(MonadIO m, ExplSet m s) => ExplSet m (Cache n s) Source # | |
(MonadIO m, ExplGet m s) => ExplGet m (Cache n s) Source # | |
(MonadIO m, ExplInit m s, KnownNat n, Cachable s) => ExplInit m (Cache n s) Source # | |
Defined in Apecs.Stores | |
(KnownNat n, Cachable s) => Cachable (Cache n s) Source # | |
Defined in Apecs.Stores | |
type Elem (Cache n s) Source # | |
Defined in Apecs.Stores |
A Unique contains zero or one component.
Writing to it overwrites both the previous component and its owner.
Its main purpose is to be a Map
optimized for when only ever one component inhabits it.
Instances
MonadIO m => ExplMembers m (Unique c) Source # | |
Defined in Apecs.Stores | |
MonadIO m => ExplDestroy m (Unique c) Source # | |
Defined in Apecs.Stores explDestroy :: Unique c -> Int -> m () Source # | |
MonadIO m => ExplSet m (Unique c) Source # | |
MonadIO m => ExplGet m (Unique c) Source # | |
MonadIO m => ExplInit m (Unique c) Source # | |
Defined in Apecs.Stores | |
type Elem (Unique c) Source # | |
Defined in Apecs.Stores |
A Global
contains exactly one component.
The initial value is mempty
from the component's Monoid
instance.
When operating on a Global, any entity arguments are ignored.
A Global component can be read with get 0
or get 1
or even get undefined
.
This means that you can read and write Globals while cmap
ping over other components.
The integer global
is defined as -1, and can be used to make operations on a global explicit, i.e. 'Time t <- get global'.