#include <daeSTLDatabase.h>
Public Member Functions | |
virtual daeInt | changeElementID (daeElement *element, daeString newID) |
virtual daeInt | changeElementSID (daeElement *element, daeString newSID) |
virtual daeInt | clear () |
virtual daeInt | createDocument (daeString name, daeDocument **document=NULL) |
virtual daeInt | createDocument (daeString name, daeElement *dom, daeDocument **document=NULL, bool zaeRootDocument=false, const std::string &extractedFileURI="") |
daeSTLDatabase (DAE &dae) | |
virtual daeDocument * | getDocument (daeString name, bool skipUriNormalization=false) |
virtual daeDocument * | getDocument (daeUInt index) |
virtual daeUInt | getDocumentCount () |
virtual daeString | getDocumentName (daeUInt index) |
virtual daeInt | getElement (daeElement **pElement, daeInt index, daeString name=NULL, daeString type=NULL, daeString file=NULL) |
virtual daeUInt | getElementCount (daeString name=NULL, daeString type=NULL, daeString file=NULL) |
virtual daeUInt | getTypeCount () |
virtual daeString | getTypeName (daeUInt index) |
virtual std::vector< daeElement * > | idLookup (const std::string &id) |
virtual daeInt | insertDocument (daeDocument *c) |
virtual daeInt | insertDocument (daeString name, daeDocument **document=NULL) |
virtual daeInt | insertDocument (daeString name, daeElement *dom, daeDocument **document=NULL, bool zaeRootDocument=false, const std::string &extractedFileURI="") |
virtual daeInt | insertElement (daeDocument *document, daeElement *element) |
virtual daeBool | isDocumentLoaded (daeString name) |
virtual daeInt | removeDocument (daeDocument *document) |
virtual daeInt | removeElement (daeDocument *document, daeElement *element) |
virtual daeInt | setMeta (daeMetaElement *_topMeta) |
virtual void | sidLookup (const std::string &sid, std::vector< daeElement * > &matchingElements, daeDocument *doc=NULL) |
virtual void | typeLookup (daeInt typeID, std::vector< daeElement * > &matchingElements, daeDocument *doc=NULL) |
virtual | ~daeSTLDatabase () |
Private Types | |
typedef std::multimap < std::string, daeElement * > ::iterator | idMapIter |
typedef std::pair< std::string, daeElement * > | idMapPair |
typedef std::pair< idMapIter, idMapIter > | idMapRange |
typedef std::multimap < std::string, daeElement * > ::iterator | sidMapIter |
typedef std::pair< std::string, daeElement * > | sidMapPair |
typedef std::pair< sidMapIter, sidMapIter > | sidMapRange |
typedef std::multimap< daeInt, daeElement * >::iterator | typeMapIter |
typedef std::pair< daeInt, daeElement * > | typeMapPair |
typedef std::pair< typeMapIter, typeMapIter > | typeMapRange |
Private Member Functions | |
daeInt | insertChildren (daeDocument *c, daeElement *element) |
daeInt | removeChildren (daeDocument *c, daeElement *element) |
Private Attributes | |
std::vector< daeDocument * > | documents |
std::map< std::string, std::vector< daeElement * > > | elements |
std::multimap< std::string, daeElement * > | elementsIDMap |
std::multimap< std::string, daeElement * > | sidMap |
daeMetaElement * | topMeta |
std::multimap< daeInt, daeElement * > | typeMap |
The daeSTLDatabase
class derives from daeDatabase
and implements the default database.
Definition at line 27 of file daeSTLDatabase.h.
typedef std::multimap<std::string, daeElement*>::iterator daeSTLDatabase::idMapIter [private] |
Definition at line 98 of file daeSTLDatabase.h.
typedef std::pair<std::string, daeElement*> daeSTLDatabase::idMapPair [private] |
Definition at line 99 of file daeSTLDatabase.h.
typedef std::pair<idMapIter, idMapIter> daeSTLDatabase::idMapRange [private] |
Definition at line 100 of file daeSTLDatabase.h.
typedef std::multimap<std::string, daeElement*>::iterator daeSTLDatabase::sidMapIter [private] |
Definition at line 103 of file daeSTLDatabase.h.
typedef std::pair<std::string, daeElement*> daeSTLDatabase::sidMapPair [private] |
Definition at line 104 of file daeSTLDatabase.h.
typedef std::pair<sidMapIter, sidMapIter> daeSTLDatabase::sidMapRange [private] |
Definition at line 105 of file daeSTLDatabase.h.
typedef std::multimap<daeInt, daeElement*>::iterator daeSTLDatabase::typeMapIter [private] |
Definition at line 93 of file daeSTLDatabase.h.
typedef std::pair<daeInt, daeElement*> daeSTLDatabase::typeMapPair [private] |
Definition at line 94 of file daeSTLDatabase.h.
typedef std::pair<typeMapIter, typeMapIter> daeSTLDatabase::typeMapRange [private] |
Definition at line 95 of file daeSTLDatabase.h.
daeSTLDatabase::daeSTLDatabase | ( | DAE & | dae | ) |
Constructor
virtual daeSTLDatabase::~daeSTLDatabase | ( | ) | [virtual] |
Destructor
virtual daeInt daeSTLDatabase::changeElementID | ( | daeElement * | element, | |
daeString | newID | |||
) | [virtual] |
Updates the database to reflect a change to the ID of a daeElement
.
element | daeElement whose ID is going to change. | |
newID | The ID that will be assigned to the element. |
DAE_OK
if the database was successfully updated, otherwise returns a negative value as defined in daeError.h. Implements daeDatabase.
virtual daeInt daeSTLDatabase::changeElementSID | ( | daeElement * | element, | |
daeString | newSID | |||
) | [virtual] |
Updates the database to reflect a change to the sid of a daeElement
.
element | daeElement whose sid is going to change. | |
newSID | The sid that will be assigned to the element. |
DAE_OK
if the database was successfully updated, otherwise returns a negative value as defined in daeError.h. Implements daeDatabase.
virtual daeInt daeSTLDatabase::clear | ( | ) | [virtual] |
Unloads all of the documents of the runtime database. This function frees all the dom*
objects created so far, except any objects on which you still have a smart pointer reference (daeSmartRef
).
DAE_OK
if all documents successfully unloaded, otherwise returns a negative value as defined in daeError.h. Implements daeDatabase.
virtual daeInt daeSTLDatabase::createDocument | ( | daeString | name, | |
daeDocument ** | document = NULL | |||
) | [virtual] |
Creates a new domCOLLADA
root element and a new document; returns an error if the document name already exists.
name | Name of the new document, must be a valid URI. | |
document | Pointer to a daeDocument pointer that receives the document created |
Implements daeDatabase.
virtual daeInt daeSTLDatabase::createDocument | ( | daeString | name, | |
daeElement * | dom, | |||
daeDocument ** | document = NULL , |
|||
bool | zaeRootDocument = false , |
|||
const std::string & | extractedFileURI = "" | |||
) | [virtual] |
Creates a new document, defining its root as the dom
object; returns an error if the document name already exists.
name | Name of the new document, must be a valid URI. | |
dom | Existing domCOLLADA root element of the document | |
document | Pointer to a daeDocument pointer that receives the document created | |
zaeRootDocument | Indicates if the new document is the root document of a ZAE archive. | |
extractedFileURI | URI to extracted dae file. |
DAE_OK
if the document was created successfully, otherwise returns a negative value as defined in daeError.h. daeElement
passed in as dom
should always be a domCOLLADA
object, the API may enforce this in the future. Implements daeDatabase.
virtual daeDocument* daeSTLDatabase::getDocument | ( | daeString | name, | |
bool | skipUriNormalization = false | |||
) | [virtual] |
Gets a document based on the document name.
name | The name of the document as a URI. | |
skipUriNormalization | Use the document name as is; don't normalize it first. This is mostly for improved performance. |
Implements daeDatabase.
virtual daeDocument* daeSTLDatabase::getDocument | ( | daeUInt | index | ) | [virtual] |
Gets a document based on the document index.
index | Index of the document to get. |
Implements daeDatabase.
virtual daeUInt daeSTLDatabase::getDocumentCount | ( | ) | [virtual] |
Gets a document name.
index | Index of the document to get. |
Implements daeDatabase.
virtual daeInt daeSTLDatabase::getElement | ( | daeElement ** | pElement, | |
daeInt | index, | |||
daeString | name = NULL , |
|||
daeString | type = NULL , |
|||
daeString | file = NULL | |||
) | [virtual] |
Implements daeDatabase.
virtual daeUInt daeSTLDatabase::getElementCount | ( | daeString | name = NULL , |
|
daeString | type = NULL , |
|||
daeString | file = NULL | |||
) | [virtual] |
Implements daeDatabase.
virtual daeUInt daeSTLDatabase::getTypeCount | ( | ) | [virtual] |
Implements daeDatabase.
Implements daeDatabase.
virtual std::vector<daeElement*> daeSTLDatabase::idLookup | ( | const std::string & | id | ) | [virtual] |
Lookup elements by ID, searching through all documents.
id | The ID to match on. |
Implements daeDatabase.
daeInt daeSTLDatabase::insertChildren | ( | daeDocument * | c, | |
daeElement * | element | |||
) | [private] |
virtual daeInt daeSTLDatabase::insertDocument | ( | daeDocument * | c | ) | [virtual] |
Inserts an already existing document into the database.
c | The document to insert. |
Implements daeDatabase.
virtual daeInt daeSTLDatabase::insertDocument | ( | daeString | name, | |
daeDocument ** | document = NULL | |||
) | [virtual] |
Creates a new domCOLLADA
root element and a new document; returns an error if the document name already exists.
name | Name of the new document, must be a valid URI. | |
document | Pointer to a daeDocument pointer that receives the document created |
Implements daeDatabase.
virtual daeInt daeSTLDatabase::insertDocument | ( | daeString | name, | |
daeElement * | dom, | |||
daeDocument ** | document = NULL , |
|||
bool | zaeRootDocument = false , |
|||
const std::string & | extractedFileURI = "" | |||
) | [virtual] |
Creates a new document, defining its root as the dom
object; returns an error if the document name already exists.
name | Name of the new document, must be a valid URI. | |
dom | Existing domCOLLADA root element of the document | |
document | Pointer to a daeDocument pointer that receives the document created | |
zaeRootDocument | Indicates if the new document is the root document of a ZAE archive. | |
extractedFileURI | URI to extracted dae file. |
DAE_OK
if the document was created successfully, otherwise returns a negative value as defined in daeError.h. daeElement
passed in as dom
should always be a domCOLLADA
object, the API may enforce this in the future. Implements daeDatabase.
virtual daeInt daeSTLDatabase::insertElement | ( | daeDocument * | document, | |
daeElement * | element | |||
) | [virtual] |
Inserts a daeElement
into the runtime database.
document | Document in which the daeElement lives. | |
element | daeElement to insert in the database |
DAE_OK
if element successfully inserted, otherwise returns a negative value as defined in daeError.h. Implements daeDatabase.
Indicates if a document is loaded or not.
name | Name of the document as a URI. |
Implements daeDatabase.
daeInt daeSTLDatabase::removeChildren | ( | daeDocument * | c, | |
daeElement * | element | |||
) | [private] |
virtual daeInt daeSTLDatabase::removeDocument | ( | daeDocument * | document | ) | [virtual] |
Removes a document from the database.
document | Document to remove from the database |
Implements daeDatabase.
virtual daeInt daeSTLDatabase::removeElement | ( | daeDocument * | document, | |
daeElement * | element | |||
) | [virtual] |
Removes a daeElement
from the runtime database; not implemented in the reference STL implementation.
document | Document in which the daeElement lives. | |
element | Element to remove. |
DAE_OK
if element successfully removed, otherwise returns a negative value as defined in daeError.h. Implements daeDatabase.
virtual daeInt daeSTLDatabase::setMeta | ( | daeMetaElement * | _topMeta | ) | [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.
_topMeta | Top meta object to use to create objects to fill the database. |
Implements daeDatabase.
virtual void daeSTLDatabase::sidLookup | ( | const std::string & | sid, | |
std::vector< daeElement * > & | matchingElements, | |||
daeDocument * | doc = NULL | |||
) | [virtual] |
Same as the previous method, but the results are returned via a parameter instead of a return value, for extra efficiency.
sid | The sid to match on. | |
matchingElements | The array of matching elements. | |
doc | The document to search in, or NULL to search in all documents. Note - This function currently isn't implemented in the default database. |
Implements daeDatabase.
virtual void daeSTLDatabase::typeLookup | ( | daeInt | typeID, | |
std::vector< daeElement * > & | matchingElements, | |||
daeDocument * | doc = NULL | |||
) | [virtual] |
Same as the previous method, but returns the array of matching elements via a reference parameter for additional efficiency.
typeID | The type to match on, e.g. domNode::ID(). | |
matchingElements | The array of matching elements. | |
doc | The document to search in, or NULL to search in all documents. |
Implements daeDatabase.
std::vector<daeDocument*> daeSTLDatabase::documents [private] |
Definition at line 107 of file daeSTLDatabase.h.
std::map< std::string, std::vector< daeElement* > > daeSTLDatabase::elements [private] |
Definition at line 90 of file daeSTLDatabase.h.
std::multimap< std::string, daeElement* > daeSTLDatabase::elementsIDMap [private] |
Definition at line 97 of file daeSTLDatabase.h.
std::multimap< std::string, daeElement* > daeSTLDatabase::sidMap [private] |
Definition at line 102 of file daeSTLDatabase.h.
daeMetaElement* daeSTLDatabase::topMeta [private] |
Definition at line 108 of file daeSTLDatabase.h.
std::multimap<daeInt, daeElement*> daeSTLDatabase::typeMap [private] |
Definition at line 92 of file daeSTLDatabase.h.