FUtils/FUtils.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 
00022 // [January 2007] PLUG_CRT and the CRT memory debugger is not used directly, anymore, at Feeling Software.
00023 // Instead, we rely on the Visual Leak Detector: http://www.codeproject.com/tools/visualleakdetector.asp
00024 
00025 #ifndef _F_UTILS_H_
00026 #define _F_UTILS_H_
00027 
00028 // CRT
00029 #ifdef _WIN32
00030 #ifndef _CRT_SECURE_NO_DEPRECATE
00031 #define _CRT_SECURE_NO_DEPRECATE 1 // MSVS 2005 support.
00032 #endif // _CRT_SECURE_NO_DEPRECATE
00033 #pragma warning(disable:4702)
00034 #endif // _WIN32
00035 
00036 #define NOMINMAX 
00037 #ifdef max
00038 #undef max
00039 #endif // max
00040 #ifdef min
00041 #undef min
00042 #endif // min
00043 
00044 #ifndef FCOLLADA_NOMINMAX
00045 
00046 template<class T>
00047 inline T& max(T& x, T& y) { return (x > y) ? x : y; }
00048 template<class T>
00049 inline const T& max(const T& x, const T& y) { return (x > y) ? x : y; } 
00052 template <class T>
00053 inline T& min(T& x, T& y) { return (x < y) ? x : y; }
00054 template <class T>
00055 inline const T& min(const T& x,const T& y) { return (x < y) ? x : y; } 
00056 #endif // FCOLLADA_NOMINMAX
00057 
00058 #ifdef _WIN32
00059 #pragma warning(default:4702)
00060 #endif
00061 
00062 // Conversion macros
00063 #define UNUSED(a) 
00064 #ifdef _DEBUG
00065 #define UNUSED_NDEBUG(a) a
00066 #else
00067 #define UNUSED_NDEBUG(a) 
00068 #endif // _DEBUG
00069 
00070 // Pre-include the platform-specific macros and definitions
00071 #ifndef _FU_PLATFORMS_H_
00072 #include "FUtils/Platforms.h"
00073 #endif // _FU_PLATFORMS_H_
00074 #ifndef _FU_ASSERT_H_
00075 #include "FUtils/FUAssert.h"
00076 #endif // _FU_ASSERT_H_
00077 
00078 // FMath
00079 #define HAS_VECTORTYPES 
00080 #ifndef _F_MATH_H_
00081 #include "FMath/FMath.h"
00082 #endif // _F_MATH_H_
00083 
00084 // LibXML
00085 #ifndef NO_LIBXML
00086 #define HAS_LIBXML 
00087 #if !defined(FCOLLADA_DLL) || defined(FCOLLADA_INTERNAL)
00088 #define LIBXML_STATIC 
00089 #endif // !FCOLLADA_DLL || !FCOLLADA_INTERNAL
00090 #ifndef __XML_TREE_H__
00091 #include <libxml/tree.h>
00092 #endif // __XML_TREE_H__
00093 #else // NO_LIBXML
00094 typedef struct _xmlNode xmlNode;
00095 #endif // NO_LIBXML
00096 
00097 // SAFE_DELETE Macro set.
00098 #define SAFE_DELETE(ptr) if ((ptr) != NULL) { delete (ptr); (ptr) = NULL; } 
00099 #define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; } 
00100 #define SAFE_FREE(ptr) if (ptr != NULL) { free(ptr); ptr = NULL; } 
00101 #define SAFE_RELEASE(ptr) { if ((ptr) != NULL) { (ptr)->Release(); (ptr) = NULL; } } 
00102 #define CLEAR_POINTER_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE((a)[i]); (a).clear(); } 
00103 #define CLEAR_ARRAY_VECTOR(a) { size_t l = (a).size(); for (size_t i = 0; i < l; ++i) SAFE_DELETE_ARRAY((a)[i]); (a).clear(); } 
00104 #define CLEAR_POINTER_STD_PAIR_CONT(cont, a){ for (cont::iterator it = (a).begin(); it != (a).end(); ++it) SAFE_DELETE((*it).second); (a).clear(); } 
00105 #define CLEAR_POINTER_STD_CONT(cont, a){ for (cont::iterator it = (a).begin(); it != (a).end(); ++it) SAFE_DELETE((*it)); (a).clear(); } 
00107 // Base RTTI object and object container class
00108 #ifndef _FU_OBJECT_TYPE_H_
00109 #include "FUtils/FUObjectType.h"
00110 #endif //_FU_OBJECT_TYPE_H_
00111 #ifndef _FU_OBJECT_H_
00112 #include "FUtils/FUObject.h"
00113 #endif // _FU_OBJECT_H_
00114 #ifndef _FU_TRACKER_H_
00115 #include "FUtils/FUTracker.h"
00116 #endif // _FU_TRACKER_H_
00117 
00118 // More complex utility classes
00119 #ifndef _FU_STRING_H_
00120 #include "FUtils/FUString.h"
00121 #endif // _FU_STRING_H_
00122 #ifndef _FU_CRC32_H_
00123 #include "FUtils/FUCrc32.h"
00124 #endif // _FU_CRC32_H_
00125 #ifndef _FU_DEBUG_H_
00126 #include "FUtils/FUDebug.h"
00127 #endif // _FU_DEBUG_H_
00128 #ifndef _FU_ERROR_H_
00129 #include "FUtils/FUError.h"
00130 #endif // _FU_ERROR_H_
00131 
00132 #ifndef RETAIL
00133 #define ENABLE_TEST 
00134 #endif
00135 
00136 #endif // _F_UTILS_H_

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