00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00021 #ifndef _FCD_LIBRARY_
00022 #define _FCD_LIBRARY_
00023
00024 #ifndef __FCD_OBJECT_H_
00025 #include "FCDocument/FCDObject.h"
00026 #endif // __FCD_OBJECT_H_
00027 #ifndef _FU_PARAMETER_H_
00028 #include "FUtils/FUParameter.h"
00029 #endif // _FU_PARAMETER_H_
00030
00031 class FCDocument;
00032 class FCDAsset;
00033 class FCDEntity;
00034 class FCDExtra;
00035
00049 template <class T>
00050 class FCOLLADA_EXPORT FCDLibrary : public FCDObject
00051 {
00052 private:
00053 DeclareObjectType(FCDObject);
00054
00058 DeclareParameterContainer(T, entities, FC("Entities"));
00059
00060
00061 DeclareParameterRef(FCDExtra, extra, FC("Extra Tree"));
00062
00063
00064 DeclareParameterRef(FCDAsset, asset, FC("Asset Tag"));
00065
00066 public:
00070 FCDLibrary(FCDocument* document);
00071
00073 virtual ~FCDLibrary();
00074
00077 T* AddEntity();
00078
00084 void AddEntity(T* entity);
00085
00090 T* FindDaeId(const fm::string& daeId) { return const_cast<T*>(const_cast<const FCDLibrary*>(this)->FindDaeId(daeId)); }
00091 const T* FindDaeId(const fm::string& daeId) const;
00095 inline bool IsEmpty() const { return entities.empty(); }
00096
00099 inline size_t GetEntityCount() const { return entities.size(); }
00100
00105 inline T* GetEntity(size_t index) { FUAssert(index < GetEntityCount(), return NULL); return entities.at(index); }
00106 inline const T* GetEntity(size_t index) const { FUAssert(index < GetEntityCount(), return NULL); return entities.at(index); }
00113 FCDAsset* GetAsset(bool create = true);
00114 inline const FCDAsset* GetAsset() const { return asset; }
00118 inline FCDExtra* GetExtra() { return extra; }
00119 inline const FCDExtra* GetExtra() const { return extra; }
00120 };
00121
00122 #endif // _FCD_LIBRARY_