Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_CORE_PROPERTY_MAP_H_
00014 #define _FBXSDK_CORE_PROPERTY_MAP_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/base/fbxmap.h>
00019 #include <fbxsdk/core/fbxproperty.h>
00020 #include <fbxsdk/core/fbxobject.h>
00021
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023
00027 template <class K, class T, class Compare> class FBXSDK_DLL FbxMapExt
00028 {
00030
00031
00032
00033
00034
00035
00037 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00038 private:
00039 typedef FbxMap<K, T, Compare> FbxMapExtDef;
00040 FbxMapExtDef mMap;
00041 #endif // DOXYGEN_SHOULD_SKIP_THIS
00042
00043 public:
00044 typedef typename FbxMapExtDef::RecordType* Iterator;
00045
00047 inline FbxMapExt()
00048 {
00049 }
00050
00055 inline void Add(const K& pKey, const T& pValue)
00056 {
00057 mMap.Insert(pKey, pValue);
00058 }
00059
00064 inline Iterator Find(const K& pKey) const
00065 {
00066 return (Iterator)mMap.Find( pKey );
00067 }
00068
00073 inline Iterator Find(const T& pValue) const
00074 {
00075 Iterator lIterator = GetFirst();
00076 while (lIterator)
00077 {
00078 if (lIterator->GetValue()==pValue)
00079 {
00080 return lIterator;
00081 }
00082 lIterator = GetNext(lIterator);
00083 }
00084 return 0;
00085 }
00086
00090 inline void Remove(Iterator pIterator)
00091 {
00092 if (pIterator) mMap.Remove( pIterator->GetKey() );
00093 }
00094
00098 inline Iterator GetFirst() const
00099 {
00100 return (Iterator)mMap.Minimum();
00101 }
00102
00107 inline Iterator GetNext(Iterator pIterator) const
00108 {
00109 return (Iterator)pIterator ? pIterator->Successor() : 0;
00110 }
00111
00114 inline void Clear()
00115 {
00116 mMap.Clear();
00117 }
00118
00122 inline void Reserve(int pSize)
00123 {
00124 mMap.Reserve( pSize );
00125 }
00126
00130 inline int GetCount() const
00131 {
00132 return mMap.GetSize();
00133 }
00134 };
00135
00139 template <class T, class Compare> class FBXSDK_DLL FbxObjectMap : public FbxMapExt<T,FbxObject*,Compare>
00140 {
00141 public:
00143 inline FbxObjectMap()
00144 {
00145 }
00146
00151 inline FbxObject* Get(typename FbxMapExt<T,FbxObject*,Compare>::Iterator pIterator)
00152 {
00153 return pIterator ? pIterator->GetValue() : 0;
00154 }
00155 };
00156
00160 class FbxMapFbxStringCompare
00161 {
00162 public:
00168 inline int operator()(const FbxString& pKeyA, const FbxString& pKeyB) const
00169 {
00170 return (pKeyA < pKeyB) ? -1 : ((pKeyB < pKeyA) ? 1 : 0);
00171 }
00172 };
00173
00177 class FBXSDK_DLL FbxObjectStringMap : public FbxObjectMap<class FbxString,class FbxMapFbxStringCompare>
00178 {
00179 public:
00181 inline FbxObjectStringMap()
00182 {
00183 }
00184 };
00185
00186 #include <fbxsdk/fbxsdk_nsend.h>
00187
00188 #endif