COLLADA 1.4 DOM: daeElement Class Reference

COLLADA

daeElement Class Reference

#include <daeElement.h>

Inheritance diagram for daeElement:

Inheritance graph
[legend]
Collaboration diagram for daeElement:

Collaboration graph
[legend]
List of all members.

Detailed Description

The daeElement class represents an instance of a COLLADA "Element"; it is the main base class for the COLLADA Dom.

Features of this class include:

  • Uses factory concepts defined via daeMetaElement
  • Composed of attributes, content elements and content values
  • Reference counted via daeSmartRef
  • Contains information for XML base URI, and XML containing element

Public Types

enum  IntegrationState { int_uninitialized, int_created, int_converted, int_finished }
 An enum that describes the state of user integration with this object. More...

Public Member Functions

 daeElement ()
 Element Constructor.
virtual ~daeElement ()
 Element Destructor.
void release () const
 Decrements the reference count and deletes the object if reference count is zero.
void ref () const
 Increments the reference count of this element.
void resolve ()
 Resolves all fields of type daeURI.
void setup (daeMetaElement *meta)
 Sets up a daeElement.
daeBool placeElement (daeElement *element)
 Places an element as a child of this element.
daeBool placeElementAt (daeInt index, daeElement *element)
 This function searches through the list of potential child elements (fields) checking for a matching element type where this element can be added.
daeBool removeChildElement (daeElement *element)
 Removes the specified element from it parent, the this element.
virtual daeBool setAttribute (daeString attrName, daeString attrValue)
 Looks up an attribute field via its meta name and assign its value as the attrValue String.
daeCollectiongetCollection ()
 Finds the database collection associated with this element.
void setCollection (daeCollection *c)
 Sets the database collection associated with this element.
daeURIgetDocumentURI ()
 Gets the URI of the document containing this element, note that this is NOT the URI of the element.
daeSmartRef< daeElementcreateElement (daeString className)
 Creates an element via the element factory system.
daeElementcreateAndPlace (daeString className)
 Creates a subelement via createElement() and places it via placeElement().
daeElementcreateAndPlaceAt (daeInt index, daeString className)
 Create a sub-element via createElement and place it via placeElementAt This also automatically inserts the new element at the specified index in the _contents of it's parent, if the parent has one.
daeElementgetXMLParentElement ()
 Gets the container element for this element.
daeMetaElementgetMeta ()
 Gets the associated Meta information for this element.
daeIntegrationObjectgetIntObject (IntegrationState from_state=int_converted, IntegrationState to_state=int_uninitialized)
 Gets the integration object associated with this daeElement object.
daeString getTypeName () const
 Gets the element type name for this element.
daeString getElementName () const
 Gets this element's name.
void setElementName (daeString nm)
 Sets this element's name.
daeString getID () const
 Gets the element ID if it exists.
void getChildren (daeTArray< daeSmartRef< daeElement > > &array)
 Gets the children/sub-elements of this element.
daeSmartRef< daeElementclone (daeString idSuffix=NULL, daeString nameSuffix=NULL)
 Clones/deep copies this daeElement and all of it's subtree.

Static Public Member Functions

static daeBool removeFromParent (daeElement *element)
 Removes the specified element from its parent element.
static void resolveAll ()
 Resolves all daeURIs yet to be resolved in all daeElements that have been created.
static void release (const daeElement *elem)
 Releases the element passed in.
static void ref (const daeElement *elem)
 Increments the reference counter for the element passed in.
static void appendResolveElement (daeElement *elem)
 Appends the passed in element to the list of elements that need to be resolved.

Public Attributes

 DAE_ALLOC
 Macro that defines new and delete overrides for this class.

Protected Member Functions

 daeElement (const daeElement &cpy)
virtual daeElementoperator= (const daeElement &cpy)

Protected Attributes

daeMetaElement_meta
daeString _elementName

Member Enumeration Documentation

enum daeElement::IntegrationState
 

An enum that describes the state of user integration with this object.

Enumerator:
int_uninitialized  The user integration is not initialized.
int_created  The user integration object has been created.
int_converted  The user integration object has been converted.
int_finished  The user integration object is completed.


Constructor & Destructor Documentation

daeElement::daeElement  ) 
 

Element Constructor.

Note:
This should not be used externally. Use factories to create elements

daeElement::~daeElement  )  [virtual]
 

Element Destructor.

Note:
This should not be used externally, if daeSmartRefs are being used.


Member Function Documentation

void daeElement::appendResolveElement daeElement elem  )  [static]
 

Appends the passed in element to the list of elements that need to be resolved.

The elements in this list will be resolved during resolveAll().

Parameters:
elem Element to add to the list of elements waiting for their daeURIs to be resolved.

daeSmartRef< daeElement > daeElement::clone daeString  idSuffix = NULL,
daeString  nameSuffix = NULL
 

Clones/deep copies this daeElement and all of it's subtree.

Parameters:
idSuffix A string to append to the copied element's ID, if one exists. Default is no ID mangling.
nameSuffix A string to append to the copied element's name, if one exists. Default is no name mangling.
Returns:
Returns a daeElement smartref of the copy of this element.

daeElement * daeElement::createAndPlace daeString  className  ) 
 

Creates a subelement via createElement() and places it via placeElement().

Automatically adds the new element to the _contents of its parent, if the parent has one. This is the primary method used to construct the COLLADA dom hierarchy.

Parameters:
className - Class name of the subelement to create.
Returns:
Returns the created daeElement, if it was successfully created.

daeElement * daeElement::createAndPlaceAt daeInt  index,
daeString  className
 

Create a sub-element via createElement and place it via placeElementAt This also automatically inserts the new element at the specified index in the _contents of it's parent, if the parent has one.

This is useful when constructing the COLLADA dom hierarchy

Parameters:
index the position in the _contents array the newly created element is to be placed at
className - the className of the sub-element to be created
Returns:
the created element if it was in fact successfully created.

daeElementRef daeElement::createElement daeString  className  ) 
 

Creates an element via the element factory system.

This creation is based only on potential child elements of this element.

Parameters:
className Class name of the subelement to create.
Returns:
Returns the created daeElement, if it was successfully created.

void daeElement::getChildren daeTArray< daeSmartRef< daeElement > > &  array  ) 
 

Gets the children/sub-elements of this element.

This is a helper function used to easily access an element's children without the use of the _meta objects. This function adds the convenience of the _contents array to elements that do not contain a _contents array.

Parameters:
array The return value. An elementref array to append this element's children to.

daeCollection* daeElement::getCollection  )  [inline]
 

Finds the database collection associated with this element.

Returns:
Returns the daeCollection representing the containing file or database group.

daeURI * daeElement::getDocumentURI  ) 
 

Gets the URI of the document containing this element, note that this is NOT the URI of the element.

Returns:
Returns a pointer to the daeURI of the document containing this element.

daeString daeElement::getElementName  )  const
 

Gets this element's name.

Returns:
Returns the string for the name.
Remarks:
This function returns NULL if the element's name is identical to it's type's name.

daeString daeElement::getID  )  const
 

Gets the element ID if it exists.

Returns:
Returns the value of the ID attribute, if there is such an attribute on this element type.

the string for the element ID if it exists.

daeIntegrationObject * daeElement::getIntObject IntegrationState  from_state = int_converted,
IntegrationState  to_state = int_uninitialized
 

Gets the integration object associated with this daeElement object.

See daeIntegrationObject for more details. Integration Objects can be automatically created and associated with the COLLADA dom via the meta-factory mechanism and can be very useful for using the API to integrate with COLLADA.

Parameters:
from_state Specifies where in the conversion process from COLLADA you are interested. A full conversion is the default.
to_state Specifies where in the conversion process to COLLADA you are interested. No conversion is the default.
Returns:
Returns the daeIntegrationObject associated with this COLLADA element instance.

daeMetaElement* daeElement::getMeta  )  [inline]
 

Gets the associated Meta information for this element.

This Meta also acts as a factory. See daeMetaElement documentation for more information.

Returns:
Returns the associated meta information.

daeString daeElement::getTypeName  )  const
 

Gets the element type name for this element.

Returns:
Returns the string for the type name.

daeElement* daeElement::getXMLParentElement  )  [inline]
 

Gets the container element for this element.

If createAndPlace() was used to create the element, its parent is the the caller of createAndPlace().

Returns:
Returns the parent element, if this is not the top level element.

daeBool daeElement::placeElement daeElement element  ) 
 

Places an element as a child of this element.

This function searches through the list of potential child element fields in this element, checking for a matching element type where the new element can be added. If a match of type is found, the element* is assigned or appended to that field, based on whether it is a single child or an array of children. This automatically adds the new element to the _contents of its parent, if the parent has one.

Parameters:
element Element to be placed in the this container.
Returns:
Returns true if the element was successfully placed, false otherwise.

daeBool daeElement::placeElementAt daeInt  index,
daeElement element
 

This function searches through the list of potential child elements (fields) checking for a matching element type where this element can be added.

If a match of type is found, the element* is assigned or appended to that field (based on whether it is a single child or an array of children. If the parent element contains a _contents array, element will be placed at the specified index, otherwise element gets placed among elements of the same type.

Parameters:
index is the place in the _contents array to insert element.
element is the element to be placed in the 'this' container.
Returns:
return whether or not the element was successfully placed.

static void daeElement::ref const daeElement elem  )  [inline, static]
 

Increments the reference counter for the element passed in.

This function is a static wrapper that invokes elem->ref() on the passed in element, if it is not NULL.

Parameters:
elem Element to call ref() for, if the element exists.

void daeElement::ref  )  const [inline]
 

Increments the reference count of this element.

Note:
Should not be used externally if daeSmartRefs are being used, they call it automatically.

static void daeElement::release const daeElement elem  )  [inline, static]
 

Releases the element passed in.

This function is a static wrapper that invokes elem->release() on the passed in element, if it is not NULL.

Parameters:
elem Element to call release() for, if the element exists.

void daeElement::release  )  const
 

Decrements the reference count and deletes the object if reference count is zero.

Note:
Should not be used externally if daeSmartRefs are being used, they call it automatically.

daeBool daeElement::removeChildElement daeElement element  ) 
 

Removes the specified element from it parent, the this element.

This function is the opposite of placeElement(). It removes the specified element from the _contents array, and from wherever else it appears inside of the this element. Use this function instead of clear(), remove() or delete() if you want to keep the _contents field up-to-date.

Parameters:
element Element to be removed in the this container.
Returns:
Returns true if the element was successfully removed, false otherwise.

static daeBool daeElement::removeFromParent daeElement element  )  [inline, static]
 

Removes the specified element from its parent element.

This function is the opposite of placeElement(). It removes the specified element from both the _contents array and from wherever else it appears inside of its parent. The function itself finds the parent, and is defined as a static method, since removing the element from its parent may result in the deletion of the element. If the element has no parent, nothing is done.

Use this function instead of clear(), remove() or delete() if you want to keep _contents up-to-date.

Parameters:
element Element to remove from its parent container, the function finds the parent element.
Returns:
Returns true if the element was successfully removed, false otherwise.

void daeElement::resolve  ) 
 

Resolves all fields of type daeURI.

This is done via database query of the URI.

void daeElement::resolveAll  )  [static]
 

Resolves all daeURIs yet to be resolved in all daeElements that have been created.

This is used as part of post-parsing process of a COLLADA instance document, which results in a new collection in the database.

daeBool daeElement::setAttribute daeString  attrName,
daeString  attrValue
[virtual]
 

Looks up an attribute field via its meta name and assign its value as the attrValue String.

Parameters:
attrName Attribute to set.
attrValue String-based value to apply to the attribute.
Returns:
Returns true if the attribute was found and the value was set, false otherwise.

Reimplemented in domAny.

void daeElement::setCollection daeCollection c  ) 
 

Sets the database collection associated with this element.

Parameters:
c The daeCollection to associate with this element.

void daeElement::setElementName daeString  nm  ) 
 

Sets this element's name.

Parameters:
nm Specifies the string to use as the element's name.
Remarks:
Use caution when using this function since you can easily create invalid COLLADA documents.

void daeElement::setup daeMetaElement meta  ) 
 

Sets up a daeElement.

Called on all daeElements as part of their initialization.

Parameters:
meta Meta element to use to configure this element.
Note:
Should not be called externally.


The documentation for this class was generated from the following files:
  • C:/SVN_wf/COLLADA_DOM/include/dae/daeElement.h
  • C:/SVN_wf/COLLADA_DOM/src/dae/daeElement.cpp

©2005 Sony Computer Entertainment Inc.. All Rights Reserved.
Generated on Fri Feb 10 16:46:59 2006 for COLLADA 1.4 DOM by doxygen 1.4.3