FCDocument/FCDLibrary.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2005-2007 Feeling Software Inc.
00003     Portions of the code are:
00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
00005     
00006     MIT License: http://www.opensource.org/licenses/mit-license.php
00007 */
00008 /*
00009     Based on the FS Import classes:
00010     Copyright (C) 2005-2006 Feeling Software Inc
00011     Copyright (C) 2005-2006 Autodesk Media Entertainment
00012     MIT License: http://www.opensource.org/licenses/mit-license.php
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     // Extra information for the entity.
00061     DeclareParameterRef(FCDExtra, extra, FC("Extra Tree"));
00062 
00063     // Asset information for the entity.
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_

Generated on Thu Feb 14 16:58:34 2008 for FCollada by  doxygen 1.4.6-NO