Inherits from NSObject
Conforms to NSCopying
Declared in OGWEntityCategory.h

Overview

Categories group entities logically, provide a list of (default) aspects to create for each entity added to this category and categories provide settings for enumeration and other optimizations effective for all entities of a category.

Categories greatly help in limiting enumerations and corresponding tasks to only a specific group of entities. See OGWWorldEntities.

Categories define whether an entity needs to be updated during a simulation step (needsUpdate) and whether these updates can be perfoemed concurrently (updateConcurrently). See OGWWorldSimulation for more info on concurrent updates.

Tasks

Creating a Category

Identification

Options

Pausing updates

Default Aspects

Internal Use Only

Properties

categoryID

The category’s unique identifier.

@property (readonly) GWID categoryID

Return Value

The category’s unique identifier.

Declared In

OGWEntityCategory.h

defaultAspectClasses

The array of default aspect classes automatically added to each entity of this category, in the given order.

@property (readonly) NSArray *defaultAspectClasses

Return Value

The array of default aspect classes automatically added to each entity of this category, in the given order.

Declared In

OGWEntityCategory.h

name

The name of the category.

@property (readonly) NSString *name

Return Value

The name of the category.

Declared In

OGWEntityCategory.h

options

Category options (bit field) affect how entities are processed.

@property (readonly) OGWEntityCategoryOption options

Return Value

Whether the entities in this category need to be updated at all.

Discussion

OGWEntityCategoryOptionNeedsUpdate

  • If YES the entities in this category will be updated provided they have at least one aspect that requests updating through the OGWUpdateableAspect protocol.
  • If NO the entities in this category will not be updated during simulation step. It is assumed they are static entities, or only indirectly moved or updated.

OGWEntityCategoryOptionUpdatesConcurrently

  • If YES the entities in this category will update concurrently on multi-core CPU devices.
  • If NO the entities in this category will be updated sequentially, even on multi-core CPUs.

Warning: Indiscriminate use of concurrent updates can lead to a number of issues. See OGWWorldSimulation for more info on concurrent updates.

Declared In

OGWEntityCategory.h

paused

If YES will not update this category’s entities and their aspects for the time being. Paused entities may still interact with other entities.

@property BOOL paused

Return Value

Whether this category’s entities are currently paused.

Declared In

OGWEntityCategory.h

world

@property (weak) OGWWorld *world

Class Methods

categoryWithName:options:

Creates a category with a name and options.

+ (id)categoryWithName:(NSString *)name options:(OGWEntityCategoryOption)options

Parameters

name

The name of the category.

options

Options for this category. Use 0 to provide no options.

Return Value

A new category.

Declared In

OGWEntityCategory.h

Instance Methods

addDefaultAspectClass:

Adds an aspect class which will automatically be instantiated and added to each entity initialized with this category.

- (void)addDefaultAspectClass:(Class)aspectClass

Parameters

aspectClass

An aspect Class.

Discussion

Note: The aspects are always created in the order they were added. This is the only way to prioritize update order between aspects of a given entity.

Declared In

OGWEntityCategory.h

addDefaultAspectClassesInArray:

Adds an array of aspect classes. The aspects will automatically be instantiated and added to each entity initialized with this category.

- (void)addDefaultAspectClassesInArray:(NSArray *)aspectClasses

Parameters

aspectClasses

An array of aspect Class objects.

Discussion

Note: The aspects are always created in the order they were added. This is the only way to prioritize update order between aspects of a given entity.

Declared In

OGWEntityCategory.h