00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __DAE_STLDATABASE__
00010 #define __DAE_STLDATABASE__
00011
00012 #include <stdio.h>
00013
00014 #include <vector>
00015 #include <map>
00016 #include <string>
00017 #include <algorithm>
00018 #include <functional>
00019
00020 #include <dae/daeElement.h>
00021 #include <dae/daeDatabase.h>
00022
00027 class DLLSPEC daeSTLDatabase : public daeDatabase
00028 {
00029 public:
00033 daeSTLDatabase(DAE& dae);
00037 virtual ~daeSTLDatabase();
00038
00039 public:
00040
00041 virtual daeUInt getTypeCount();
00042 virtual daeString getTypeName(daeUInt index);
00043 virtual daeInt setMeta(daeMetaElement *_topMeta);
00044
00045
00046 virtual daeInt insertDocument(daeString name, daeElement* dom, daeDocument** document = NULL, bool zaeRootDocument = false, const std::string& extractedFileURI = "");
00047 virtual daeInt insertDocument(daeString name, daeDocument** document = NULL);
00048 virtual daeInt createDocument(daeString name, daeElement* dom, daeDocument** document = NULL, bool zaeRootDocument = false, const std::string& extractedFileURI = "");
00049 virtual daeInt createDocument(daeString name, daeDocument** document = NULL);
00050 virtual daeInt insertDocument( daeDocument *c );
00051
00052 virtual daeInt removeDocument(daeDocument* document);
00053 virtual daeUInt getDocumentCount();
00054 virtual daeDocument* getDocument(daeUInt index);
00055 virtual daeDocument* getDocument(daeString name, bool skipUriNormalization = false);
00056 virtual daeString getDocumentName(daeUInt index);
00057 virtual daeBool isDocumentLoaded(daeString name);
00058
00059
00060 virtual daeInt insertElement(daeDocument* document, daeElement* element);
00061 virtual daeInt removeElement(daeDocument* document, daeElement* element);
00062 virtual daeInt changeElementID(daeElement* element, daeString newID);
00063 virtual daeInt changeElementSID(daeElement* element, daeString newSID);
00064 virtual daeInt clear();
00065
00066 virtual std::vector<daeElement*> idLookup(const std::string& id);
00067
00068 virtual void typeLookup(daeInt typeID,
00069 std::vector<daeElement*>& matchingElements,
00070 daeDocument* doc = NULL);
00071
00072
00073
00074 virtual void sidLookup(const std::string& sid,
00075 std::vector<daeElement*>& matchingElements,
00076 daeDocument* doc = NULL);
00077
00078
00079 virtual daeUInt getElementCount(daeString name = NULL,
00080 daeString type = NULL,
00081 daeString file = NULL);
00082 virtual daeInt getElement(daeElement** pElement,
00083 daeInt index,
00084 daeString name = NULL,
00085 daeString type = NULL,
00086 daeString file = NULL);
00087
00088 private:
00089
00090 std::map< std::string, std::vector< daeElement* > > elements;
00091
00092 std::multimap<daeInt, daeElement*> typeMap;
00093 typedef std::multimap<daeInt, daeElement*>::iterator typeMapIter;
00094 typedef std::pair<daeInt, daeElement*> typeMapPair;
00095 typedef std::pair<typeMapIter, typeMapIter> typeMapRange;
00096
00097 std::multimap< std::string, daeElement* > elementsIDMap;
00098 typedef std::multimap<std::string, daeElement*>::iterator idMapIter;
00099 typedef std::pair<std::string, daeElement*> idMapPair;
00100 typedef std::pair<idMapIter, idMapIter> idMapRange;
00101
00102 std::multimap< std::string, daeElement* > sidMap;
00103 typedef std::multimap<std::string, daeElement*>::iterator sidMapIter;
00104 typedef std::pair<std::string, daeElement*> sidMapPair;
00105 typedef std::pair<sidMapIter, sidMapIter> sidMapRange;
00106
00107 std::vector<daeDocument*> documents;
00108 daeMetaElement* topMeta;
00109
00110 daeInt insertChildren( daeDocument *c, daeElement *element );
00111 daeInt removeChildren( daeDocument *c, daeElement *element );
00112 };
00113
00114 #endif // __DAE_STLDATABASE__