src/necsus/compiletime/archetype

Search:
Group by:

Types

Archetype[T] = ref object
  name*: string
A archetype of values that can be stored together
ArchetypeSet[T] = ref object
A set of all known archetypes

Procs

proc `$`[T](archetype: Archetype[T]): string
Stringify a Archetype
proc `==`[T](a, b: Archetype[T]): bool
Determine archetype equality
proc archArchSymbolDef[T](archetype: Archetype[T]): NimNode
Builds the code for defining an archetype symbol
proc archetypeFor[T](archs: ArchetypeSet[T]; components: openArray[T]): Archetype[
    T]
Returns the archetype to use for a set of components
proc asStorageTuple(archetype: Archetype[ComponentDef]): NimNode {....raises: [],
    tags: [], forbids: [].}
Creates the tuple type for storing an archetype
proc asTupleDir(arch: Archetype[ComponentDef]): TupleDirective {....raises: [],
    tags: [], forbids: [].}
Convert an archetype to a TupleDirective
proc calculateSize(arch: Archetype[ComponentDef]): Option[NimNode] {.
    ...raises: [KeyError], tags: [], forbids: [].}
Calculates the storage size required to store the components of an archetype
proc contains[T](archetype: Archetype[T]; value: T): bool
Whether an archetype contains all the given value
proc contains[T](archetypes: ArchetypeSet[T]; archetype: Archetype[T]): bool
proc containsAllOf[T](archetype: Archetype[T]; others: openArray[T]): bool
Whether an archetype contains all the given values
proc containsAnyOf[T](archetype: Archetype[T]; others: openArray[T]): bool
Whether an archetype contains any the given values
proc dumpAnalysis[T](archetypes: ArchetypeSet[T])
Prints an analysis of the archetypes in a set
proc hasAccessories(arch: Archetype): bool
Returns whether there are any accessories in this archetype
proc hash[T](archetype: Archetype[T]): Hash
Create a hash describing a archetype
proc ident(archetype: Archetype[ComponentDef]): NimNode {....raises: [], tags: [],
    forbids: [].}
Creates a variable for referencing an archetype store
proc idSymbol[T](archetype: Archetype[T]): NimNode
Returns a unique symbol containing an ID for this archetype
proc indexOf[T](archetype: Archetype[T]; value: T): int
Whether an archetype contains all the given value
proc isAccessory[T](arch: Archetype[T]; value: T): bool
Whether a specific value is an accessory
proc len[T](archetypes: ArchetypeSet[T]): int
proc matches(arch: Archetype; filter: BitsFilter): bool
Whether this archetype can fulfill the given filter
proc newArchetype[T](values: openArray[T]; accessories: Bits): Archetype[T]
Create an archetype
proc newArchetypeSet[T](values: openArray[Archetype[T]]; accessories: Bits): ArchetypeSet[
    T]
Creates a set of archetypes
proc readableName(arch: Archetype[ComponentDef]): string {....raises: [], tags: [],
    forbids: [].}
Returns a readable name that describes an archetype
proc removeAndAdd[T](archetype: Archetype[T]; remove: Bits; add: openArray[T]): seq[
    T]
proc values[T](archetype: Archetype[T]): seq[T]
Produces all the archetype values

Iterators

iterator items[T](archetype: Archetype[T]): T
Produces all the archetype values
iterator items[T](archetypes: ArchetypeSet[T]): Archetype[T]
Produces all the archetypes