COLLADA 1.4 DOM: daeDatabase Class Reference

COLLADA

daeDatabase Class Reference

#include <daeDatabase.h>

Inheritance diagram for daeDatabase:

Inheritance graph
[legend]
List of all members.

Detailed Description

The daeDatabase class implements the COLLADA runtime database interface.

Public Member Functions

virtual ~daeDatabase ()
 Destructor.
virtual daeInt setMeta (daeMetaElement *_topMeta)=0
 Sets the top meta object.
Collections
virtual daeInt insertCollection (daeString name, daeElement *dom, daeCollection **collection=NULL)=0
 Creates a new collection, defining its root as the dom object; returns an error if the collection name already exists.
virtual daeInt insertCollection (daeString name, daeCollection **collection=NULL)=0
 Creates a new domCOLLADA root element and a new collection; returns an error if the collection name already exists.
virtual daeInt createCollection (daeString name, daeElement *dom, daeCollection **collection=NULL)=0
 Creates a new collection, defining its root as the dom object; returns an error if the collection name already exists.
virtual daeInt createCollection (daeString name, daeCollection **collection=NULL)=0
 Creates a new domCOLLADA root element and a new collection; returns an error if the collection name already exists.
virtual daeInt insertCollection (daeCollection *c)=0
 Inserts an already existing collection into the database.
virtual daeInt removeCollection (daeCollection *collection)=0
 Removes a collection from the database.
virtual daeUInt getCollectionCount ()=0
 Gets the number of collections.
virtual daeCollectiongetCollection (daeUInt index)=0
 Gets a collection based on the collection index.
virtual daeCollectiongetCollection (daeString name)=0
 Gets a collection based on the collection name.
virtual daeString getCollectionName (daeUInt index)=0
 Gets a collection name.
virtual daeBool isCollectionLoaded (daeString name)=0
 Indicates if a collection is loaded or not.
Elements
virtual daeUInt getTypeCount ()=0
 Gets the number of types in the database.
virtual daeString getTypeName (daeUInt index)=0
 Retrieves the name of a type of object inserted in the database.
virtual daeInt insertElement (daeCollection *collection, daeElement *element)=0
 Inserts a daeElement into the runtime database.
virtual daeInt removeElement (daeCollection *collection, daeElement *element)=0
 Removes a daeElement from the runtime database; not implemented in the reference STL implementation.
virtual daeInt clear ()=0
 Unloads all of the collections of the runtime database.
virtual void validate ()=0
 Optimizes the database.
Queries
virtual daeUInt getElementCount (daeString name=NULL, daeString type=NULL, daeString file=NULL)=0
 Gets the number of daeElement objects that match the search criteria Any combination of search criteria can be NULL, if a criterion is NULL all the parameters will match for this criterion.
virtual daeInt getElement (daeElement **pElement, daeInt index, daeString name=NULL, daeString type=NULL, daeString file=NULL)=0
 Returns the daeElement which matches the search criteria.
virtual daeInt queryElement (daeElement **pElement, daeString genericQuery)=0
 Returns the daeElement which matches the genericQuery parameter; not implemented.

Member Function Documentation

virtual daeInt daeDatabase::clear  )  [pure virtual]
 

Unloads all of the collections of the runtime database.

This function frees all the dom* objects and integration objects created so far, except any objects on which you still have a smart pointer reference (daeSmartRef).

Returns:
Returns DAE_OK if all collections successfully unloaded, otherwise returns a negative value as defined in daeError.h.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::createCollection daeString  name,
daeCollection **  collection = NULL
[pure virtual]
 

Creates a new domCOLLADA root element and a new collection; returns an error if the collection name already exists.

Parameters:
name Name of the new collection, must be a valid URI.
collection Pointer to a daeCollection pointer that receives the collection created
Returns:
Returns DAE_OK if the collection was created successfully, otherwise returns a negative value as defined in daeError.h.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::createCollection daeString  name,
daeElement dom,
daeCollection **  collection = NULL
[pure virtual]
 

Creates a new collection, defining its root as the dom object; returns an error if the collection name already exists.

Parameters:
name Name of the new collection, must be a valid URI.
dom Existing domCOLLADA root element of the collection
collection Pointer to a daeCollection pointer that receives the collection created
Returns:
Returns DAE_OK if the collection was created successfully, otherwise returns a negative value as defined in daeError.h.
Note:
The daeElement passed in as dom should always be a domCOLLADA object, the API may enforce this in the future.

Implemented in daeSTLDatabase.

virtual daeCollection* daeDatabase::getCollection daeString  name  )  [pure virtual]
 

Gets a collection based on the collection name.

Parameters:
name The name of the collection as a URI.
Returns:
Returns a pointer to the collection, or NULL if not found.
Note:
If the URI contains a fragment, the fragment is stripped off.

Implemented in daeSTLDatabase.

virtual daeCollection* daeDatabase::getCollection daeUInt  index  )  [pure virtual]
 

Gets a collection based on the collection index.

Parameters:
index Index of the collection to get.
Returns:
Returns a pointer on the collection, or NULL if not found.

Implemented in daeSTLDatabase.

virtual daeUInt daeDatabase::getCollectionCount  )  [pure virtual]
 

Gets the number of collections.

Returns:
Returns the number of collections.

Implemented in daeSTLDatabase.

virtual daeString daeDatabase::getCollectionName daeUInt  index  )  [pure virtual]
 

Gets a collection name.

Parameters:
index Index of the collection to get.
Returns:
Returns the name of the collection at the given index.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::getElement daeElement **  pElement,
daeInt  index,
daeString  name = NULL,
daeString  type = NULL,
daeString  file = NULL
[pure virtual]
 

Returns the daeElement which matches the search criteria.

Any combination of search criteria can be NULL, if a criterion is NULL all the parameters will match for this criterion. The function operates on the set of assets that match the name, type and file search criteria, with the index parameter indicating which asset within the set is returned. Calling daeElement(&pElement,index) without search criteria returns the daeElement number index in the database without any consideration of name, type or collection. Criteria can not be specified with wildcards, either a criterion is set and it will have to match, or it is not set and all daeElements match for this criterion. The default database search is roughly in log2(n). Maximum performance is obtained when querying by type and a name. Any other combination results in a slight overhead, but the overall search time remains around log2(n).

Parameters:
pElement Pointer of a daeElement* which receives the found daeElement if the search succeeds
index Index within the set of daeElements that match the search criteria
name Name or id of the daeElement, for example "mycube1", can be NULL
type Type of the daeElement to get, this can be any COLLADA tag such as <geometry> or <library>, can be NULL
file Name of the collection or file, for example, "myCollection.xml", can be NULL
Returns:
Returns DAE_OK upon success, returns DAE_ERR_QUERY_NO_MATCH if there is no match, otherwise, returns a negative value as defined in daeError.h.

Implemented in daeSTLDatabase.

virtual daeUInt daeDatabase::getElementCount daeString  name = NULL,
daeString  type = NULL,
daeString  file = NULL
[pure virtual]
 

Gets the number of daeElement objects that match the search criteria Any combination of search criteria can be NULL, if a criterion is NULL all the parameters will match for this criterion.

Hence getElementCount() called without parameters returns the total number of daeElement objects in the database. Criteria can not be specified with wildcards, either a criterion is set and it will have to match, or it is not set and all daeElements match for this criterion.

Parameters:
name Name or id of the daeElement, for example, "mycube1", can be NULL
type Type of daeElement to find, this can be any COLLADA tag such as <geometry> or <library>, can be NULL
file Name of the collection or file, for example, "myCollection.xml", can be NULL
Returns:
Returns the number of elements matching this query.

Implemented in daeSTLDatabase.

virtual daeUInt daeDatabase::getTypeCount  )  [pure virtual]
 

Gets the number of types in the database.

Returns:
Returns the number of different types of objects inserted in the database.

Implemented in daeSTLDatabase.

virtual daeString daeDatabase::getTypeName daeUInt  index  )  [pure virtual]
 

Retrieves the name of a type of object inserted in the database.

Parameters:
index Index of the type; must be between 0 and daeDatabase::getTypeCount()-1
Returns:
Returns the name of the type, NULL if the index is invalid.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::insertCollection daeCollection c  )  [pure virtual]
 

Inserts an already existing collection into the database.

Parameters:
c The collection to insert.
Returns:
Returns DAE_OK if the collection was inserted successfully, otherwise returns a negative value as defined in daeError.h.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::insertCollection daeString  name,
daeCollection **  collection = NULL
[pure virtual]
 

Creates a new domCOLLADA root element and a new collection; returns an error if the collection name already exists.

Parameters:
name Name of the new collection, must be a valid URI.
collection Pointer to a daeCollection pointer that receives the collection created
Returns:
Returns DAE_OK if the collection was created successfully, otherwise returns a negative value as defined in daeError.h.
Deprecated:
This function will be removed in future versions.
Please use createCollection.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::insertCollection daeString  name,
daeElement dom,
daeCollection **  collection = NULL
[pure virtual]
 

Creates a new collection, defining its root as the dom object; returns an error if the collection name already exists.

Parameters:
name Name of the new collection, must be a valid URI.
dom Existing domCOLLADA root element of the collection
collection Pointer to a daeCollection pointer that receives the collection created
Returns:
Returns DAE_OK if the collection was created successfully, otherwise returns a negative value as defined in daeError.h.
Note:
The daeElement passed in as dom should always be a domCOLLADA object, the API may enforce this in the future.
Deprecated:
This function will be removed in future versions.
Please use createCollection.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::insertElement daeCollection collection,
daeElement element
[pure virtual]
 

Inserts a daeElement into the runtime database.

Parameters:
collection Collection in which the daeElement lives.
element daeElement to insert in the database
Returns:
Returns DAE_OK if element successfully inserted, otherwise returns a negative value as defined in daeError.h.

Implemented in daeSTLDatabase.

virtual daeBool daeDatabase::isCollectionLoaded daeString  name  )  [pure virtual]
 

Indicates if a collection is loaded or not.

Parameters:
name Name of the collection as a URI.
Returns:
Returns true if the collection is loaded, false otherwise.
Note:
If the URI contains a fragment, the fragment is stripped off.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::queryElement daeElement **  pElement,
daeString  genericQuery
[pure virtual]
 

Returns the daeElement which matches the genericQuery parameter; not implemented.

Parameters:
pElement Element to return.
genericQuery Generic query
Returns:
Returns DAE_OK if it succeeds, returns DAE_ERR_QUERY_NO_MATCH if there is no match, otherwise returns a negative value as defined in daeError.h.
Note:
This function is not implemented.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::removeCollection daeCollection collection  )  [pure virtual]
 

Removes a collection from the database.

Parameters:
collection Collection to remove from the database
Returns:
Returns DAE_OK if the collection was successfully removed, otherwise returns a negative value as defined in daeError.h.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::removeElement daeCollection collection,
daeElement element
[pure virtual]
 

Removes a daeElement from the runtime database; not implemented in the reference STL implementation.

Parameters:
collection Collection in which the daeElement lives.
element Element to remove.
Returns:
Returns DAE_OK if element successfully removed, otherwise returns a negative value as defined in daeError.h.
Note:
This function is not implemented in the reference STL implementation.

Implemented in daeSTLDatabase.

virtual daeInt daeDatabase::setMeta daeMetaElement _topMeta  )  [pure virtual]
 

Sets the top meta object.

Called by dae::setDatabase() when the database changes. It passes to this function the top meta object, which is the root of a hierarchy of daeMetaElement objects. This top meta object is capable of creating any of the root objects in the DOM tree.

Parameters:
_topMeta Top meta object to use to create objects to fill the database.
Returns:
Returns DAE_OK if successful, otherwise returns a negative value defined in daeError.h.

Implemented in daeSTLDatabase.

virtual void daeDatabase::validate  )  [pure virtual]
 

Optimizes the database.

This function takes time; it is called by the interface at the end of a load operation. Some databases cannot be queried when items are being inserted; for instance, they may need to be sorted. All database search functions call validate(); you should not need to call this function directly.

Implemented in daeSTLDatabase.


The documentation for this class was generated from the following file:
  • C:/SVN_wf/COLLADA_DOM/include/dae/daeDatabase.h

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