Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
A map based on Data.IntMap.Strict
. O(log(n)) for most operations.
Instances
ExplMembers IO (Map c) Source # | |
Defined in Apecs.Stores | |
ExplDestroy IO (Map c) Source # | |
Defined in Apecs.Stores | |
ExplSet IO (Map c) Source # | |
ExplGet IO (Map c) Source # | |
ExplInit IO (Map c) Source # | |
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
ExplMembers IO s => ExplMembers IO (Cache n s) Source # | |
Defined in Apecs.Stores | |
ExplDestroy IO s => ExplDestroy IO (Cache n s) Source # | |
Defined in Apecs.Stores | |
ExplSet IO s => ExplSet IO (Cache n s) Source # | |
ExplGet IO s => ExplGet IO (Cache n s) Source # | |
(ExplInit IO s, KnownNat n, Cachable s) => ExplInit IO (Cache n s) Source # | |
(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.
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.
For example, we can get a global component with get 0
or get 1
or even get undefined
.