Function tip_CreateAttribute


Prototype: tip_CreateAttribute(Attribute);
Arguments:

Name: The name of the Attribute. (string)
Value: The value of the Attribute. (CDM_AttributeValue)

C++ API Sections
Tcl API Sections
Description
Return Value
Notes
See Also
Index

Description:

This function will create and return an Attribute object (of type CDM_Attribute). In order to reduce memory requirements, this function will try to locate if an Attribute with exactly the same characteristics (same Name and Attribute value of the same type and value) already exists. In such a case, this (possibly shared) Attribute object will be returned. Else, a new Attribute object will be created and returned.

Special attention should be given to the Attribute value object (specified by the "Value" parameter) so as not to leak memory. This function internally will always increase and then decrease the reference count of this object, meaning that this object may be freed if it has a reference count of 0. If the caller wants to preserve a reference to this object, so as to free it at a later stage through tip_Free or Tcl_DecrRefCount, Tcl_IncrRefCount should be called be called before tip_CreateAttribute is called.

Return Value:

This function will return an Attribute object (of type of CDM_Attribute). This object may be an old, already in use (shared) object or a newly created object, according to the specified parameters.

In case of an error, NULL will be returned and an error message describing the error will be left at the current Tcl interpreter (CDM_Interp). In such a case, the object described by the "Value" parameter won't be altered in any way, leaving the responsibility to free it to the caller.

Notes:

This function is equivelant to CDM_CreateAttribute (C++ API).

See Also:

tip_CreateAttribute


Generated by: petasis@aias on Wed Aug 16 10:31:45 PM EEST 2006.