v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3Identifiable Class Reference

#import <CC3Identifiable.h>

Inheritance diagram for CC3Identifiable:
Inheritance graph
[legend]

Instance Methods

(void) - __deprecated
 
(id) - copy
 
(id) - copyAsClass:
 
(void) - copyUserDataFrom:
 
(id) - copyWithName:
 
(id) - copyWithName:asClass:
 
(id) - copyWithZone:withName:
 
(id) - copyWithZone:withName:asClass:
 
(BOOL) - deriveNameFrom:
 
(BOOL) - deriveNameFrom:usingSuffix:
 
(NSString *) - fullDescription
 
(id) - init
 
(id) - initAtIndex:fromPODResource:
 
(void) - initUserData
 
(id) - initWithName:
 
(id) - initWithTag:
 
(id) - initWithTag:withName:
 
(GLuint) - nextTag
 
(void) - populateFrom:
 

Class Methods

(GLint) + instanceCount
 
(void) + resetTagAllocation
 

Properties

NSObject *sharedUserData __deprecated
 
NSString * name
 
NSString * nameSuffix
 
GLint podIndex
 
BOOL shouldIncludeInDeepCopy
 
GLuint tag
 
NSObject * userData
 
- Properties inherited from <CC3Cacheable>
NSString * name
 

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.

You can assign your own data to instances of CC3Identifiable or its subclasses through the userData property.

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

Method Documentation

- (void) __deprecated
- (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.

The returned instance is retained. It is the responsiblity of the caller to manage the lifecycle of the returned instance and perform the corresponding invocation of the release method at the appropriate time.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

The copy... methods 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,

Subclasses that extend copying should not override this method, but should override the populateFrom: method instead.

Implemented in CC3Node.

- (id) copyAsClass: (Class)  aClass

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

The new copy will be an instance of the specified class, will have the same name as this instance, and will have a unique tag.

Care should be taken when choosing the class to be instantiated. If the class is different than that of this instance, the populateFrom: method of that class must be compatible with the contents of this instance.

The returned instance is retained. It is the responsiblity of the caller to manage the lifecycle of the returned instance and perform the corresponding invocation of the release method at the appropriate time.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

The copy... methods 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,

Subclasses that extend copying should not override this method, but should override the populateFrom: method instead.

- (void) copyUserDataFrom: (CC3Identifiable *)  another

Invoked automatically after this instance has been created as a copy of the specified instance, to copy the userData property from the original instance to this instance.

In this abstract class, this method simply sets the userData property of this instance to the object returned from the same property in the specified original instance, without creating a copy of the userData object. If you need the userData object to be copied as well, you can override this method by subclassing, or by adding extention categories to the concrete subclasses of CC3Identifiable, (CC3Node, CC3Mesh, CC3Material, CC3Texture, etc.), to copy the userData object and assign it to the new instance.

- (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.

The returned instance is retained. It is the responsiblity of the caller to manage the lifecycle of the returned instance and perform the corresponding invocation of the release method at the appropriate time.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

The copy... methods 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,

Subclasses that extend copying should not override this method, but should override the populateFrom: method instead.

Implemented in CC3Node.

- (id) copyWithName: (NSString *)  aName
asClass: (Class)  aClass 

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

The new copy will be an instance of the specified class, will have its name set to the specified name, and will have a unique tag.

Care should be taken when choosing the class to be instantiated. If the class is different than that of this instance, the populateFrom: method of that class must be compatible with the contents of this instance.

The returned instance is retained. It is the responsiblity of the caller to manage the lifecycle of the returned instance and perform the corresponding invocation of the release method at the appropriate time.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

The copy... methods 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,

Subclasses that extend copying should not override this method, but should override the populateFrom: method instead.

- (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.

The returned instance is retained. It is the responsiblity of the caller to manage the lifecycle of the returned instance and perform the corresponding invocation of the release method at the appropriate time.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

The copy... methods 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,

Subclasses that extend copying should not override this method, but should override the populateFrom: method instead.

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

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

The new copy will be an instance of the specified class, will have its name set to the specified name, and will have a unique tag.

Care should be taken when choosing the class to be instantiated. If the class is different than that of this instance, the populateFrom: method of that class must be compatible with the contents of this instance.

The returned instance is retained. It is the responsiblity of the caller to manage the lifecycle of the returned instance and perform the corresponding invocation of the release method at the appropriate time.

This copy operation is a deep copy. Copies of most of the content of the original will be created as well. For structural subclasses, such as CC3Node, copies will be made of each structual element (eg- child nodes). Some exceptions are made. For instance, copies are generally not made for fixed, voluminous content such as mesh data. In addition, subclasses may excuse themselves from being copied through the shouldIncludeInDeepCopy property.

The copy... methods 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,

Subclasses that extend copying should not override this method, but should override the populateFrom: method instead.

- (BOOL) deriveNameFrom: (CC3Identifiable *)  another

If this instance does not already have a name, it is derived from the name of the specified other CC3Identifiable, if it has one.

If this instance has a name already, or if the other CC3Identifiable does not have a name, the name of this instance is not changed.

Typically, this is invoked when one CC3Identifiable is added as a component to another.

This implementation concatenates the value of the nameSuffix property of this instance onto the name of the specified CC3Identifiable, and sets that into the name property of this instance. If a subclass returns nil from the nameSuffix property, no name is generated.

Returns whether the name of this instance was changed.

- (BOOL) deriveNameFrom: (CC3Identifiable *)  another
usingSuffix: (NSString *)  suffix 

If this instance does not already have a name, it is derived from the name of the specified other CC3Identifiable, if it has one.

If this instance has a name already, or if the other CC3Identifiable does not have a name, the name of this instance is not changed.

Typically, this is invoked when one CC3Identifiable is added as a component to another.

This implementation concatenates the value of the specified suffix onto the name of the specified CC3Identifiable, and sets that into the name property of this instance.

Returns whether the name of this instance was changed.

- (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.

Reimplemented from <CC3Object>.

Implemented in CC3ShaderProgram.

- (id) init

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

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

Implemented in CC3GLFramebuffer, and CC3Light.

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

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

Provided by category CC3Identifiable(PVRPOD).

- (void) initUserData

Invoked automatically from the init* family of methods to initialize the userData property of this instance.

This implementation simply sets the userData property to nil. You can override this method in a subclass or by creating extension categories for the concrete subclasses, (CC3Node, CC3Mesh, CC3Material, CC3Texture, etc.), if the userData can be initialized and retained in a self-contained manner.

Alternately, you can leave this method unimplemented, and set the userData property from outside this instance.

- (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.

Implemented in CC3Light.

- (id) initWithTag: (GLuint)  aTag

Initializes this unnamed instance with the specified tag.

Implemented in CC3Light.

- (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.

Implemented in CC3Light.

+ (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) populateFrom: (CC3Identifiable *)  another

Template method that populates this instance from the specified other instance.

This method is invoked automatically during object copying via the copy or copyWithZone: method. In most situations, the application should use the copy method, and should never need to invoke this method directly.

Subclasses that add additional instance state (instance variables) should extend copying by overriding this method to copy that additional state. Superclass that override this method should be sure to invoke the superclass implementation to ensure that superclass state is copied as well.

+ (void) resetTagAllocation

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

Property Documentation

- (NSObject* sharedUserData) __deprecated
readwritenonatomicretain
Deprecated:
Use userData instead. The userData and sharedUserData properties are now the same.
- (NSString*) name
readwritenonatomicretain

An arbitrary name for this object.

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.

In general, names need not be unique, are not automatically assigned, and leaving the name as nil is acceptable.

Some subclasses are designed so that their instances can be cached. For instances of those subclasses, the name is required, and must be unique.

- (NSString*) nameSuffix
readnonatomicretain

Returns a string to concatenate to the name of another CC3Identifiable to automatically create a useful name for this instance.

This property is used by the deriveNameFrom: method.

This implementation simply raises an assertion exception. Each concrete subclass should override this property to return a useful identifiable name suffix. A subclass can return nil from this property to indicate that automatic naming should not be performed.

- (GLint) podIndex
readwritenonatomicassign

The index of this object in the POD resource data.

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

Provided by category CC3Identifiable(PVRPOD).

- (BOOL) shouldIncludeInDeepCopy
readnonatomicassign

Returns whether this instance should be included in a deep copy.

This method simply returns YES by default, and in most cases this is sufficient. However, for some structural subclasses (notably subclasses of CC3Node) it may be desirable to not copy some components.

This property is not universally automatically applied or honoured. It is up to the invoker and invokee to agree on when to make use of this property.

- (GLuint) tag
readwritenonatomicassign

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.

- (NSObject*) userData
readwritenonatomicretain

Application-specific data associated with this object.

You can use this property to add any additional information you want to an instance of CC3Identifiable or its concrete subclasses (CC3Node, CC3Mesh, CC3Material, CC3Texture, etc.).

If you have non-object data to attach, such as a structure, or a pointer to data in a memory space (perhaps loaded from a file), you can wrap it in an instance of NSData and attach it here.

To assist in managing this data, the methods initUserData is invoked automatically during the initialization and deallocation of each instance of this class. You can override this method by subclassing, or by adding extention categories to the concrete subclasses of CC3Identifiable, (CC3Node, CC3Mesh, CC3Material, CC3Texture, etc.), to create or retrieve the data, and attach it to the new instance.

When copying instances of CC3Identifiable and its subclasses, the copyUserDataFrom: method is invoked in the new copy so that it can copy the data from the original instance to the new instance copy.

In this abstract class, the copyUserDataFrom: method simply sets the userData property of the copy to the object returned from the same property in the original instance, without creating a copy of the userData object. If you need the userData object to be copied as well, you can override the copyUserDataFrom: method by subclassing, or by adding extention categories to the concrete subclasses of CC3Identifiable, (CC3Node, CC3Mesh, CC3Material, CC3Texture, etc.), to copy the userData object and assign it to the new instance.


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