BNBEntity

Objective-C

@interface BNBEntity : NSObject

/**
 * Set a new name to the entity. Name could be empty.
 *@param name (string): new entity name.
 */
- (void)setName:(nonnull NSString *)name;

/**@return entity name (string) */
- (nonnull NSString *)getName;

/**
 *add entiy as child to hierarchy
 *@param child (entity): child entity.
 */
- (void)addChild:(nullable BNBEntity *)child;

/**
 *remove entiy as child to hierarchy
 *@param child (entity): child entity.
 */
- (void)removeChild:(nullable BNBEntity *)child;

/**get all child entites list. */
- (nonnull NSArray<BNBEntity *> *)getChildren;

/**remove all child entites list. */
- (void)clearChildren;

/**
 * Perform depth-first traverse of entity tree.
 * Return first found child with name `entityName` or NULL if such an entity doesn't exist.
 *@param entityName (string): name of desired entity
 *@return found entity (entity) or null
 */
- (nullable BNBEntity *)findChildByName:(nonnull NSString *)entityName;

/**@return parent entity and null if given entity is root. */
- (nullable BNBEntity *)getParent;

/**
 *Set enable/disable entity flag. The disabling of the entity is equivalent to removing the entity and all its children from the hierarchy.
 *@param active (bool) activity flag.
 */
- (void)setActive:(BOOL)active;

/**@return activity flag (bool) */
- (BOOL)isActive;

/**
 *Add entity for given layer if it is wasn't added before.
 *@param layer (layer): layer to add.
 */
- (void)addIntoLayer:(nullable BNBLayer *)layer;

/**
 *Removes entity from given layer if it is was added before.
 *@params layer (layer): layer from remove.
 */
- (void)removeFromLayer:(nullable BNBLayer *)layer;

/**returns list of layers in which entity was added. */
- (nonnull NSArray<BNBLayer *> *)getLayers;

/**
 *add given component to entity if component of given type wasn't added before.
 *@param component (component): component to add.
 */
- (void)addComponent:(nullable BNBComponent *)component;

/**
 *check if component of given type was added.
 *@param component_type (component_type): component type to check.
 *@return flag (bool)
 */
- (BOOL)hasComponent:(BNBComponentType)type;

/**
 *get component of given type.
 *@param component_type (component_type): component type to get.
 *@return component of given type (component)
 */
- (nullable BNBComponent *)getComponent:(BNBComponentType)type;

/**
 *remove given component to entity if component of given component was added before.
 *@param component (component): component to remove.
 */
- (void)removeComponent:(nullable BNBComponent *)component;

@end

Swift

class BNBEntity : NSObject

Undocumented

  • Set a new name to the entity. Name could be empty.

    Declaration

    Objective-C

    - (void)setName:(nonnull NSString *)name;

    Swift

    func setName(_ name: String)

    Parameters

    name

    (string): new entity name.

  • Declaration

    Objective-C

    - (nonnull NSString *)getName;

    Swift

    func getName() -> String

    Return Value

    entity name (string)

  • add entiy as child to hierarchy

    Declaration

    Objective-C

    - (void)addChild:(nullable BNBEntity *)child;

    Swift

    func addChild(_ child: BNBEntity?)

    Parameters

    child

    (entity): child entity.

  • remove entiy as child to hierarchy

    Declaration

    Objective-C

    - (void)removeChild:(nullable BNBEntity *)child;

    Swift

    func removeChild(_ child: BNBEntity?)

    Parameters

    child

    (entity): child entity.

  • get all child entites list.

    Declaration

    Objective-C

    - (nonnull NSArray<BNBEntity *> *)getChildren;

    Swift

    func getChildren() -> [BNBEntity]
  • remove all child entites list.

    Declaration

    Objective-C

    - (void)clearChildren;

    Swift

    func clearChildren()
  • Perform depth-first traverse of entity tree. Return first found child with name entityName or NULL if such an entity doesn’t exist.

    Declaration

    Objective-C

    - (nullable BNBEntity *)findChildByName:(nonnull NSString *)entityName;

    Swift

    func findChild(byName entityName: String) -> BNBEntity?

    Parameters

    entityName

    (string): name of desired entity

    Return Value

    found entity (entity) or null

  • Declaration

    Objective-C

    - (nullable BNBEntity *)getParent;

    Swift

    func getParent() -> BNBEntity?

    Return Value

    parent entity and null if given entity is root.

  • Set enable/disable entity flag. The disabling of the entity is equivalent to removing the entity and all its children from the hierarchy.

    Declaration

    Objective-C

    - (void)setActive:(BOOL)active;

    Swift

    func setActive(_ active: Bool)

    Parameters

    active

    (bool) activity flag.

  • Declaration

    Objective-C

    - (BOOL)isActive;

    Swift

    func isActive() -> Bool

    Return Value

    activity flag (bool)

  • Add entity for given layer if it is wasn’t added before.

    Declaration

    Objective-C

    - (void)addIntoLayer:(nullable BNBLayer *)layer;

    Swift

    func add(into layer: BNBLayer?)

    Parameters

    layer

    (layer): layer to add.

  • Removes entity from given layer if it is was added before. @params layer (layer): layer from remove.

    Declaration

    Objective-C

    - (void)removeFromLayer:(nullable BNBLayer *)layer;

    Swift

    func remove(from layer: BNBLayer?)
  • returns list of layers in which entity was added.

    Declaration

    Objective-C

    - (nonnull NSArray<BNBLayer *> *)getLayers;

    Swift

    func getLayers() -> [BNBLayer]
  • add given component to entity if component of given type wasn’t added before.

    Declaration

    Objective-C

    - (void)addComponent:(nullable BNBComponent *)component;

    Swift

    func add(_ component: BNBComponent?)

    Parameters

    component

    (component): component to add.

  • check if component of given type was added.

    Declaration

    Objective-C

    - (BOOL)hasComponent:(BNBComponentType)type;

    Swift

    func hasComponent(_ type: BNBComponentType) -> Bool

    Parameters

    component_type

    (component_type): component type to check.

    Return Value

    flag (bool)

  • get component of given type.

    Declaration

    Objective-C

    - (nullable BNBComponent *)getComponent:(BNBComponentType)type;

    Swift

    func getComponent(_ type: BNBComponentType) -> BNBComponent?

    Parameters

    component_type

    (component_type): component type to get.

    Return Value

    component of given type (component)

  • remove given component to entity if component of given component was added before.

    Declaration

    Objective-C

    - (void)removeComponent:(nullable BNBComponent *)component;

    Swift

    func remove(_ component: BNBComponent?)

    Parameters

    component

    (component): component to remove.