00001 /* 00002 Copyright (C) 2005-2006 Feeling Software Inc. 00003 MIT License: http://www.opensource.org/licenses/mit-license.php 00004 */ 00005 /* 00006 Based on the FS Import classes: 00007 Copyright (C) 2005-2006 Feeling Software Inc 00008 Copyright (C) 2005-2006 Autodesk Media Entertainment 00009 MIT License: http://www.opensource.org/licenses/mit-license.php 00010 */ 00011 00018 #ifndef _FCD_LIBRARY_ 00019 #define _FCD_LIBRARY_ 00020 00021 class FCDocument; 00022 class FCDEntity; 00023 00037 template <class T> 00038 class FCDLibrary 00039 { 00040 private: 00041 FCDocument* document; 00042 00043 protected: 00045 typedef vector<T*> FCDEntityList; 00046 00050 FCDEntityList entities; 00051 00054 inline FCDocument* GetDocument() { return document; } 00055 inline const FCDocument* GetDocument() const { return document; } 00057 public: 00061 FCDLibrary(FCDocument* document); 00062 00065 virtual ~FCDLibrary(); 00066 00069 T* AddEntity(); 00070 00073 void ReleaseEntity(T* entity); 00074 00079 T* FindDaeId(const string& daeId); 00080 00083 inline bool IsEmpty() const { return entities.empty(); } 00084 00089 virtual FUStatus LoadFromXML(xmlNode* node); 00090 00093 virtual void WriteToXML(xmlNode* node) const; 00094 00097 StringList GetPostProcessCmds() const; 00098 00101 inline size_t GetEntityCount() const { return entities.size(); } 00102 00107 inline T* GetEntity(size_t index) { FUAssert(index < GetEntityCount(), return NULL); return entities.at(index); } 00108 00113 inline const T* GetEntity(size_t index) const { FUAssert(index < GetEntityCount(), return NULL); return entities.at(index); } 00114 }; 00115 00116 #include "FCDocument/FCDLibrary.hpp" 00117 00118 #endif // _FCD_LIBRARY_