Public Member Functions | Static Public Member Functions | Properties

CC3Identifiable Class Reference

This is a base subclass for any class that uses tags or names to identify individual instances. More...

#import <CC3Identifiable.h>

Inheritance diagram for CC3Identifiable:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(id) - copy
(id) - copyWithName:
(id) - copyWithZone:withName:
(NSString *) - fullDescription
(id) - init
(id) - initAtIndex:fromPODResource:
(id) - initWithName:
(id) - initWithTag:
(id) - initWithTag:withName:
(GLuint) - nextTag

Static Public Member Functions

(GLint) + instanceCount
(void) + resetTagAllocation

Properties

NSString * name
int podIndex
GLuint tag

Detailed Description

This is a base subclass for any class that uses tags or names to identify individual instances.

Instances can be initialized with either or both a tag and a name. Instances initialized without an explcit tag will have a unique tag automatically generated and assigned.

When overriding initialization, subclasses typically need only override the most generic initializer, initWithTag:withName:.


Member Function Documentation

- (id) copy

Returns a newly allocated (retained) copy of this instance.

The new copy will have the same name as this instance, but will have a unique tag.

This method may often be used to duplicate an instance many times, to create large number of similar instances to populate a game. To help you verify that you are correctly releasing and deallocating all these copies, you can use the instanceCount class method to get a current count of the total number of instances of all subclasses of CC3Identifiable,

Implemented in CC3Node.

- (id) copyWithName: (NSString *)  aName

Returns a newly allocated (retained) copy of this instance.

The new copy will have its name set to the specified name, and will have a unique tag.

Implemented in CC3Node.

- (id) copyWithZone: (NSZone *)  zone
withName: (NSString *)  aName 

Returns a newly allocated (retained) copy of this instance.

The new copy will have its name set to the specified name, and will have a unique tag.

- (NSString*) fullDescription

Returns a string containing a more complete description of this object.

This implementation simply invokes the description method. Subclasses with more substantial content can override to provide much more information.

- (id) init

Initializes this unnamed instance with an automatically generated unique tag value.

The tag value will be generated automatically via the method nextTag.

- (id) initAtIndex: (int)  aPODIndex
fromPODResource: (CC3PODResource *)  aPODRez 

Initializes this instance from the data of this type at the specified index within the specified POD resource.

- (id) initWithName: (NSString *)  aName

Initializes this instance with the specified name and an automatically generated unique tag value.

The tag value will be generated automatically via the method nextTag.

- (id) initWithTag: (GLuint)  aTag

Initializes this unnamed instance with the specified tag.

- (id) initWithTag: (GLuint)  aTag
withName: (NSString *)  aName 

Initializes this instance with the specified tag and name.

When overriding initialization, subclasses typically need only override this initializer.

+ (GLint) instanceCount

Indicates the total number of active instances, over all subclasses, that have been allocated and initialized, but not deallocated.

This can be useful when creating hordes of 3D objects, to verify that your application is properly deallocating them again when you are done with them.

- (GLuint) nextTag

Returns a unique tag value to identify instances.

This value is unique across all instances of all subclasses. The initial value returned will be one, and subsequent calls will increment the value retuned on each call. The starting value can be reset back to one via the resetTagAllocation method.

+ (void) resetTagAllocation

Resets the allocation of new tags to resume at one again.


Property Documentation

- (NSString *) name [read, write, retain]

An arbitrary name for this node.

It is not necessary to give all identifiable objects a name, but can be useful for retrieving objects at runtime, and for identifying objects during development. Names need not be unique, are not automatically assigned, and leaving the name as nil is acceptable.

- (int) podIndex [read, write, assign]

The index of this object in the POD resource data.

This generally means the podIndex'th type of object of the class.

- (GLuint) tag [read, write, assign]

An arbitrary identification.

Useful for keeping track of instances. Unique tags are not explicitly required, but are highly recommended. In most cases, it is best to just let the tag be assigned automatically by using an initializer that does not explicitly set the tag.


The documentation for this class was generated from the following file: