FUtils/FUtils.h

Go to the documentation of this file.
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 
00019 #ifndef _F_UTILS_H_
00020 #define _F_UTILS_H_
00021 
00022 // STL
00023 #ifdef _WIN32
00024 #pragma warning(disable:4702)
00025 #endif
00026 #include <string>
00027 #include <vector>
00028 #include <set>
00029 #include <xtree>
00030 #include <map>
00031 #include <algorithm>
00032 #ifdef _WIN32
00033 #pragma warning(default:4702)
00034 #endif
00035 
00036 // Pre-include the platform-specific macros and definitions
00037 #include "FUtils/Platforms.h"
00038 #include "FUtils/FUAssert.h"
00039 
00040 // PLUG_CRT enforces CRT memory checks every 128 allocations
00041 // and CRT memory leaks output
00042 #if defined(_DEBUG) && defined(WIN32) && defined(MEMORY_DEBUG)
00043 #define PLUG_CRT
00044 #ifdef PLUG_CRT
00045 #include <crtdbg.h>
00046 #define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)
00047 #define new DEBUG_CLIENTBLOCK
00048 #endif // PLUG_CRT
00049 #endif // _DEBUG & WIN32 & MEMORY_DEBUG
00050 
00051 // FMath
00052 #define HAS_VECTORTYPES 
00053 #include "FMath/FMath.h"
00054 
00055 // LibXML
00056 #ifndef NO_LIBXML
00057 #define HAS_LIBXML 
00058 #define LIBXML_STATIC 
00059 #include <libxml/tree.h>
00060 #else
00061 typedef struct _xmlNode xmlNode;
00062 #endif
00063 typedef vector<struct _xmlNode*> xmlNodeList; 
00065 // SAFE_DELETE Macro set.
00066 #define SAFE_DELETE(ptr) if ((ptr) != NULL) { delete (ptr); (ptr) = NULL; } 
00067 #define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; } 
00068 #define SAFE_FREE(ptr) if (ptr != NULL) { free(ptr); ptr = NULL; } 
00069 #define SAFE_RELEASE(ptr) if ((ptr) != NULL) { (ptr)->Release(); (ptr) = NULL; } 
00070 #define CLEAR_POINTER_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE((a)[i]); (a).clear(); } 
00071 #define CLEAR_POINTER_MAP(mapT, a) { for (mapT::iterator it = (a).begin(); it != (a).end(); ++it) SAFE_DELETE((*it).second); (a).clear(); } 
00073 // Conversion macros
00074 #define UNUSED(a) 
00075 #ifdef _DEBUG
00076 #define UNUSED_NDEBUG(a) a
00077 #else
00078 #define UNUSED_NDEBUG(a) 
00079 #endif // _DEBUG
00080 
00081 #undef min
00082 #define min(a, b) std::min(a, b) 
00083 #undef max
00084 #define max(a, b) std::max(a, b) 
00086 // More complex utility classes
00087 #include "FUtils/FUString.h"
00088 #include "FUtils/FUCrc32.h"
00089 #include "FUtils/FUDebug.h"
00090 #include "FUtils/FUStatus.h"
00091 
00097 template <class T>
00098 bool IsEquivalent(const T& v1, const T& v2) { return v1 == v2; }
00099 
00100 #endif // _F_UTILS_H_

Generated on Fri May 12 16:44:39 2006 for FCollada by  doxygen 1.4.6-NO