00001 /**************************************************************************************** 00002 00003 Copyright (C) 2012 Autodesk, Inc. 00004 All rights reserved. 00005 00006 Use of this software is subject to the terms of the Autodesk license agreement 00007 provided at the time of installation or download, or which otherwise accompanies 00008 this software in either electronic or hard copy form. 00009 00010 ****************************************************************************************/ 00011 00013 #ifndef _FBXSDK_CORE_QUERY_H_ 00014 #define _FBXSDK_CORE_QUERY_H_ 00015 00016 #include <fbxsdk/fbxsdk_def.h> 00017 00018 #include <fbxsdk/core/base/fbxmap.h> 00019 #include <fbxsdk/core/fbxpropertydef.h> 00020 #include <fbxsdk/core/fbxproperty.h> 00021 00022 #include <fbxsdk/fbxsdk_nsbegin.h> 00023 00024 #define FBXSDK_QUERY_UNIQUE_ID 0x14000000 00025 00026 class FbxQueryOperator; 00027 class FbxQueryOperatorUnary; 00028 class FbxQueryClassId; 00029 class FbxQueryIsA; 00030 class FbxQueryIsProperty; 00031 00036 class FBXSDK_DLL FbxQuery 00037 { 00038 public: 00039 FBXSDK_FRIEND_NEW(); 00040 00042 virtual FbxInt GetUniqueId() const { return FBXSDK_QUERY_UNIQUE_ID; } 00043 00048 virtual bool IsValid(const FbxProperty& pProperty) const; 00049 00054 virtual bool IsEqual(FbxQuery* pOtherQuery) const; 00055 00057 void Ref(); 00058 00060 void Unref(); 00061 00063 // 00064 // WARNING! 00065 // 00066 // Anything beyond these lines may not be documented accurately and is 00067 // subject to change without notice. 00068 // 00070 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00071 protected: 00072 FbxQuery(); 00073 virtual ~FbxQuery(); 00074 00075 private: 00076 class InternalFilter : public FbxConnectionPointFilter 00077 { 00078 public: 00079 InternalFilter(FbxQuery* pQuery); 00080 ~InternalFilter(); 00081 00082 public: 00083 FbxConnectionPointFilter* Ref(); 00084 void Unref(); 00085 FbxInt GetUniqueId() const { return mQuery->GetUniqueId(); } 00086 bool IsValid(FbxConnectionPoint* pConnect) const; 00087 bool IsEqual(FbxConnectionPointFilter* pConnectFilter) const; 00088 00089 FbxQuery* mQuery; 00090 }; 00091 00092 InternalFilter mFilter; 00093 int mRefCount; 00094 00095 friend class FbxProperty; 00096 friend class InternalFilter; 00097 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00098 }; 00099 00123 class FBXSDK_DLL FbxCriteria 00124 { 00125 public: 00126 FBXSDK_FRIEND_NEW(); 00127 00129 FbxCriteria(); 00130 00134 FbxCriteria(const FbxCriteria& pCriteria); 00135 00137 ~FbxCriteria(); 00138 00143 static FbxCriteria ObjectType(FbxClassId pClassId); 00144 00148 static FbxCriteria ObjectIsA(FbxClassId pClassId); 00149 00151 static FbxCriteria IsProperty(); 00152 00156 FbxCriteria& operator=(const FbxCriteria& pCriteria); 00157 00161 FbxCriteria operator&&(const FbxCriteria& pCriteria) const; 00162 00166 FbxCriteria operator||(const FbxCriteria& pCriteria) const; 00167 00169 FbxCriteria operator!() const; 00170 00174 FbxQuery* GetQuery() const; 00175 00177 // 00178 // WARNING! 00179 // 00180 // Anything beyond these lines may not be documented accurately and is 00181 // subject to change without notice. 00182 // 00184 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00185 FbxCriteria(FbxQuery* pQuery) : mQuery(pQuery) 00186 { 00187 } 00188 00189 private: 00190 FbxQuery* mQuery; 00191 00192 static void FreeGlobalCache(); 00193 00194 class ClassIdCompare 00195 { 00196 public: 00197 inline int operator() (const FbxClassId& pKeyA, const FbxClassId& pKeyB) const 00198 { 00199 const FbxClassIdInfo* lKeyA = pKeyA.GetClassIdInfo(); 00200 const FbxClassIdInfo* lKeyB = pKeyB.GetClassIdInfo(); 00201 return (lKeyA > lKeyB) ? 1 : (lKeyA < lKeyB) ? -1 : 0; 00202 } 00203 }; 00204 00205 class ClassIdCache 00206 { 00207 public: 00208 ClassIdCache(); 00209 ~ClassIdCache(); 00210 00211 FbxCriteria* GetObjectType(FbxClassId pClassId); 00212 static ClassIdCache* Get(); 00213 static void Destroy(); 00214 static FbxCriteria::ClassIdCache* mCache; 00215 00216 private: 00217 typedef FbxMap<FbxClassId, FbxCriteria*, ClassIdCompare> CriteriaCacheMap; 00218 CriteriaCacheMap mObjectTypeCriteria; 00219 }; 00220 00221 friend class FbxManager; 00222 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00223 }; 00224 00226 // 00227 // WARNING! 00228 // 00229 // Anything beyond these lines may not be documented accurately and is 00230 // subject to change without notice. 00231 // 00233 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00234 class FBXSDK_DLL FbxQueryOperator : public FbxQuery 00235 { 00236 public: 00237 FBXSDK_FRIEND_NEW(); 00238 00239 enum EType {eAND, eOR}; 00240 00241 static FbxQueryOperator* Create(FbxQuery* pA, EType pOperator, FbxQuery* pB); 00242 virtual FbxInt GetUniqueId() const { return FBXSDK_QUERY_UNIQUE_ID+1; } 00243 virtual bool IsValid(const FbxProperty& pProperty) const; 00244 virtual bool IsEqual(FbxQuery* pOtherQuery) const; 00245 00246 protected: 00247 FbxQueryOperator(FbxQuery* pA, EType pOperator, FbxQuery* pB); 00248 virtual ~FbxQueryOperator(); 00249 00250 private: 00251 FbxQuery *mA, *mB; 00252 EType mOperator; 00253 }; 00254 00255 class FBXSDK_DLL FbxQueryOperatorUnary : public FbxQuery 00256 { 00257 public: 00258 FBXSDK_FRIEND_NEW(); 00259 00260 static FbxQueryOperatorUnary* Create(FbxQuery* pA); 00261 virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+2; } 00262 virtual bool IsValid(const FbxProperty& pProperty) const; 00263 virtual bool IsEqual(FbxQuery* pOtherQuery) const; 00264 00265 protected: 00266 FbxQueryOperatorUnary(FbxQuery* pA); 00267 virtual ~FbxQueryOperatorUnary(); 00268 00269 private: 00270 FbxQuery* mA; 00271 }; 00272 00273 class FBXSDK_DLL FbxQueryClassId : public FbxQuery 00274 { 00275 public: 00276 FBXSDK_FRIEND_NEW(); 00277 00278 static FbxQueryClassId* Create(FbxClassId pClassId); 00279 virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+3; } 00280 virtual bool IsValid(const FbxProperty& pProperty) const; 00281 virtual bool IsEqual(FbxQuery* pOtherQuery) const; 00282 00283 protected: 00284 FbxQueryClassId(FbxClassId pClassId); 00285 00286 private: 00287 FbxClassId mClassId; 00288 }; 00289 00290 class FBXSDK_DLL FbxQueryIsA : public FbxQuery 00291 { 00292 public: 00293 FBXSDK_FRIEND_NEW(); 00294 00295 static FbxQueryIsA* Create(FbxClassId pClassId); 00296 virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+4; } 00297 virtual bool IsValid(const FbxProperty& pProperty) const; 00298 virtual bool IsEqual(FbxQuery* pOtherQuery) const; 00299 00300 protected: 00301 FbxQueryIsA(FbxClassId pClassId); 00302 00303 private: 00304 FbxClassId mClassId; 00305 }; 00306 00307 class FBXSDK_DLL FbxQueryIsProperty : public FbxQuery 00308 { 00309 public: 00310 FBXSDK_FRIEND_NEW(); 00311 00312 static FbxQueryIsProperty* Create(); 00313 virtual FbxInt GetUniqueId() const{ return FBXSDK_QUERY_UNIQUE_ID+5; } 00314 virtual bool IsValid(const FbxProperty& pProperty) const; 00315 virtual bool IsEqual(FbxQuery* pOtherQuery) const; 00316 00317 protected: 00318 FbxQueryIsProperty(); 00319 }; 00320 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00321 00322 #include <fbxsdk/fbxsdk_nsend.h> 00323 00324 #endif /* _FBXSDK_CORE_QUERY_H_ */