kaydara.h

Go to the documentation of this file.
00001 #ifndef _KAYDARA_H
00002 #define _KAYDARA_H
00003 /**************************************************************************
00004 Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005 All Rights Reserved.
00006 
00007 The coded instructions, statements, computer programs, and/or related 
00008 material (collectively the "Data") in these files contain unpublished 
00009 information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010 protected by Canada and United States of America federal copyright law 
00011 and by international treaties.
00012 
00013 The Data may not be disclosed or distributed to third parties, in whole 
00014 or in part, without the prior written consent of Autodesk, Inc. 
00015 ("Autodesk").
00016 
00017 THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018 ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019 WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020 ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021 OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022 PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023 WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024 FREE.
00025 
00026 IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027 OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028 EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029 DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030 OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031 DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032 LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033 LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034 DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035 BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036 
00037 **************************************************************************/
00038 
00039 // *** if you update this version, make sure to update the other version value in src/motionbuilder/motionbuilder/resource.h
00040 #define K_KERNEL_VERSION    14000 
00041 // ***
00042 
00043 #define K_NO_PROJECTSETTINGS
00044 
00045 /* Product definitions using the Kernel */
00046 #if defined(FB_KERNEL)
00047     #if defined(K_QUICKTIME_PLUGIN)
00048         #define K_NO_FILTER
00049         #define K_NO_PHYSICS
00050     #endif
00051 
00052     #define K_CONFIG_MEMORY
00053 
00054     #define K_NO_VIEWCUBE
00055     #define K_NO_STEERINGWHEEL
00056     #define K_NO_ASSETMNG
00057     #define K_NO_DECK
00058     #define K_NO_FOLDER
00059     #define K_NO_IMAGEOPERATOR
00060     #define K_NO_MANIPULATOR
00061     #define K_NO_NOTE
00062     #define K_NO_OPTICAL
00063     #define K_NO_RENDERER
00064     #define K_NO_PYTHON
00065     #define K_NO_UI
00066     #define K_DISABLE_UI
00067     #define K_NO_UNDO
00068     #define K_NO_CIP
00069     #define K_NO_STEREO
00070     #define K_NO_HUD
00071     #define K_NO_CGFX_SHADER
00072     #define K_NO_ONECLICK
00073 //  #define K_NO_STATIC_FONTS   // OpenGL fonts
00074 // Others not used
00075 //      #define K_NO_ACTOR
00076 //      #define K_NO_CHARACTER
00077 //      #define K_NO_POSE
00078 #endif
00079 
00080 #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
00081     #ifndef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
00082         #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00083     #endif
00084     #ifndef _CRT_NONSTDC_NO_WARNINGS
00085         #define _CRT_NONSTDC_NO_WARNINGS 1
00086     #endif
00087     #ifndef _CRT_SECURE_NO_WARNINGS
00088         #define _CRT_SECURE_NO_WARNINGS 1
00089     #endif
00090     #ifndef _CRT_SECURE_NO_DEPRECATE
00091         #define _CRT_SECURE_NO_DEPRECATE 1
00092     #endif
00093 #endif
00094 
00095 // Memory extra debugging information
00096 // Comment out the next line if a redefinition of the new operator is use.
00097 #define MEMORY_DEBUG
00098 
00099 // Profiling for the application.
00100 // Comment this to remove all profiling code.
00101 #define KPROFILING_CODE_ENABLE
00102 
00103 #if defined(_DEBUG) && !defined(NDEBUG)
00104     #if defined(_MSC_VER) && !defined(_MFC_VER)
00105         #ifdef MEMORY_DEBUG
00106             #undef __cdecl
00107             #define MEMORY_DEBUG_ACTIVE 1
00108             #define _CRTDBG_MAP_ALLOC 1
00109             #include <stdio.h>
00110             #include <string.h>
00111             #include <stdlib.h>
00112             #include <crtdbg.h>
00113             #include <malloc.h>
00114             #include <new>
00115             #include <xdebug>
00116             #include <xlocale>
00117             #include <xiosbase>
00118             #include <xlocnum>
00119             #include <xlocmon>
00120             #include <xtree>
00121 
00122             #define KaydaraNew new( _NORMAL_BLOCK, __FILE__, __LINE__)
00123             #ifndef new
00124                 #define new KaydaraNew
00125             #endif
00126         #else
00127             #include <malloc.h>
00128         #endif
00129     #endif
00130 #endif  
00131 
00132 #ifndef FB_KERNEL
00133     #if !defined(K_ENABLE_STREAM_FCURVE)
00134         #define K_ENABLE_STREAM_FCURVE
00135     #endif
00136 #endif
00137 
00138 #include <karch/arch.h>
00139 #include <karch/types.h>
00140 
00141 #ifndef K_NO_QUICKTIME
00142     #if defined(KARCH_ENV_LINUX) || defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32) || (defined(KARCH_ENV_MACOSX) && defined(KARCH_ARCH_X64))
00143         #define K_NO_QUICKTIME  // No QuickTime implementions for those platforms
00144     #endif
00145 #endif
00146 
00147 #ifndef K_NO_ADVANCEDCONSTRAINTS
00148     #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
00149         #define K_NO_ADVANCEDCONSTRAINTS    // No advance constraints
00150     #endif
00151 #endif
00152 
00153 #ifndef K_NO_PHYSICS
00154     #if defined(KARCH_ENV_CYGWIN) || defined(KARCH_ENV_MING32)
00155         #define K_NO_PHYSICS
00156     #endif
00157 #endif
00158 
00159 #ifndef NULL
00160     #if defined __GNUG__
00161         #define NULL (__null)
00162     #else   
00163         #ifdef __cplusplus
00164             #define NULL    0
00165         #else
00166             #define NULL    ((void *)0)
00167         #endif
00168     #endif
00169 #endif
00170 
00171 #if !defined( _MAX_PATH ) && defined( KARCH_ENV_UNIX )
00172     #define _MAX_PATH 1024
00173 #endif
00174 
00175 #define K_MAX_TEXT_LENGTH 1020 // Max text length, to be used when declaring fixed width char ptrs directly
00176 
00177 #define K_FORWARD( ClassName ) class ClassName; typedef ClassName *H##ClassName
00178 #define K_FORWARD_HI( ClassName ) class ClassName; typedef ClassName *H##ClassName; typedef H##ClassName HI##ClassName
00179 
00180 #define K_SAFE_FREE_PTR( p )            if( p ){ free( p );     (p) = NULL; }
00181 #define K_SAFE_DELETE_PTR( p )          if( p ){ delete (p);    (p) = NULL; }
00182 #define K_SAFE_DELETE_ARRAY_PTR( a )    if( a ){ delete [] (a); (a) = NULL; }
00183 
00184 #define K_SAFE_DESTROY_OBJECT( p )      { if( p ){ (p)->Destroy(); (p) = NULL; } }
00185 
00186 
00187 #ifdef KARCH_ENV_WIN
00188     #define snprintf _snprintf // for stdio.h platform compatibility
00189     #ifndef WIN32_LEAN_AND_MEAN
00190         #define WIN32_LEAN_AND_MEAN  // Defined to speed up compilation
00191     #endif
00192 #else
00193     #include <ctype.h>
00194     #include <stdio.h>
00195     #include <string.h>
00196     #include <stdarg.h>
00197     #include <assert.h>
00198     #include <strings.h>
00199 #endif
00200 
00201 #if defined(KARCH_DEV_MSC)
00202     #if (_MSC_VER >= 1400) // The Visual C++ 2005 compiler version is 1400
00203         //RR: macros defined for the conformant ISO C++ since now the following functions
00204         // are deprecated
00205 
00206         #ifndef stricmp
00207             #define stricmp     _stricmp
00208         #endif
00209         #ifndef strnicmp
00210             #define strnicmp    _strnicmp
00211         #endif
00212         #ifndef itoa
00213             #define itoa        _itoa
00214         #endif
00215         #ifndef getcwd
00216             #define getcwd      _getcwd
00217         #endif
00218         #ifndef getpid
00219             #define getpid      _getpid
00220         #endif
00221         #ifndef fileno
00222             #define fileno      _fileno
00223         #endif
00224         #ifndef fdopen
00225             #define fdopen      _fdopen
00226         #endif
00227     #endif
00228 #else
00229     #define _MSC_EMULATOR
00230 
00231     #if (GCC_VERSION <= 40700) || !defined(__GXX_EXPERIMENTAL_CXX0X__)  // override is supported in GCC 4.7 and higher
00232         #define override        //  Indicates that a method must be an override of a base-class version
00233     #endif
00234 
00235     #define sealed          //  Prevents classes from being used as base classes
00236     #define abstract    =0  //  Indicates functions or classes are abstract 
00237 
00238     #if !defined(_TRUNCATE)
00239         #define _TRUNCATE ((size_t)-1)
00240     #endif
00241     inline int strcpy_s( char* dst,size_t bufsize,const char* src ) 
00242     {
00243         strcpy( dst,src );
00244         return 0;
00245     }
00246     template <size_t bufsize> int strcpy_s( char (&dst)[bufsize], const char *src )
00247     {
00248         return strcpy_s( dst,bufsize,src );
00249     }
00250 
00251     inline int strncpy_s( char* dst,size_t bufsize,const char* src,size_t count )
00252     {
00253         strncpy( dst,src,count );
00254         return 0;
00255     }
00256     template <size_t bufsize> int strncpy_s( char (&dst)[bufsize], const char *src, size_t count )
00257     {
00258         return strncpy_s( dst,bufsize,src,count );
00259     }
00260 
00261     inline int vsprintf_s( char *buffer, size_t bufsize, const char *format, va_list args )
00262     {
00263         return vsprintf( buffer,format, args ); 
00264     }
00265     template <size_t bufsize> int vsprintf_s( char (&buffer)[bufsize], const char *format, va_list args )
00266     {
00267         return vsprintf_s( buffer,bufsize,format, args ); 
00268     }
00269 
00270     inline int sprintf_s( char *buffer, size_t bufsize, const char *format, ... )
00271     {
00272         va_list Arguments;
00273         va_start( Arguments, format);     /* Initialize variable arguments. */
00274         int result = vsprintf_s( buffer,bufsize,format, Arguments ); 
00275         va_end( Arguments );            /* Reset variable arguments.      */
00276         return result;
00277     }
00278     template <size_t bufsize> int sprintf_s( char (&buffer)[bufsize], const char *format, ... )
00279     {
00280         va_list Arguments;
00281         va_start( Arguments, format);     /* Initialize variable arguments. */
00282         int result = vsprintf_s( buffer,bufsize,format, Arguments ); 
00283         va_end( Arguments );            /* Reset variable arguments.      */
00284         return result;
00285     }
00286 
00287     inline int strcat_s( char *dst, size_t bufsize, const char *src )
00288     {
00289         strcat( dst,src );
00290         return 0;
00291     }
00292     template <size_t bufsize> int strcat_s( char (&dst)[bufsize], const char *src )
00293     {
00294         return strcat_s( dst,bufsize,src );
00295     }
00296 
00297     #ifndef strtok_s
00298         #define strtok_s( token,sep,context )   strtok( token,sep )
00299     #endif
00300 
00301     #ifndef strncat_s
00302         #define strncat_s( dst,bufsize,src,len ) strncat( dst,src,len )
00303     #endif
00304 
00305     #ifndef localtime_s
00306         #define localtime_s( _Tm,_Time ) _Tm = localtime( _Time )
00307     #endif
00308 
00309     #ifndef _stricmp
00310         #define _stricmp    strcasecmp
00311     #endif
00312     #ifndef strcmpi
00313         #define strcmpi strcasecmp
00314     #endif
00315     #ifndef _strcmpi
00316         #define _strcmpi strcasecmp
00317     #endif
00318     #ifndef stricmp
00319         #define stricmp strcasecmp
00320     #endif
00321     #ifndef strncmpi
00322         #define strncmpi strncasecmp
00323     #endif
00324     #ifndef strnicmp
00325         #define strnicmp strncasecmp
00326     #endif
00327 
00328     #ifndef _atoi64
00329         #define _atoi64( str ) strtoll( str,NULL,10 )
00330     #endif
00331 
00332     #ifndef _isnan
00333         #define _isnan( x ) isnan( x )
00334     #endif
00335 
00336     inline char* _itoa(int pValue, char* pString, int pRadix)
00337     {
00338         assert(pRadix==10);
00339         if (pString) sprintf(pString,"%d", pValue);
00340         return pString;
00341     }
00342 
00343     #ifndef itoa
00344         #define itoa        _itoa
00345     #endif
00346 #endif
00347 
00348 #if defined(KARCH_ENV_MACOSX)
00349     #include <stdlib.h>
00350 #endif
00351 
00352 // Compiler specific
00353 #if defined(KARCH_DEV_MSC) && !defined(KARCH_DEV_INTEL)
00354     #pragma warning(disable : 4097) // warning C4097: typedef-name 'ClassType' used as synonym for class-name 'KTextTag'
00355     #pragma warning(disable : 4100) // warning C4100: '?' : unreferenced formal parameter
00356     #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union (Level 4) portability  
00357     #pragma warning(disable : 4244) // conversion from 'const double' to 'float', possible loss of data 
00358     #pragma warning(disable : 4481) // warning C4481: nonstandard extension used: override specifier 'override'
00359     #pragma warning(disable : 4514) // unreferenced inline function has been removed (Level 4) optimizer  
00360     #pragma warning(disable : 4660) // template-class specialization 'identifier' is already instantiated (Level 2) compiler
00361     #pragma warning(disable : 4710) // function (X) not expanded  ??? may be good to know
00362     #pragma warning(disable : 4711) // function (X) selected for automatic inline expansion
00363     #pragma warning(disable : 4725) // instruction may be inaccurate on some Pentiums
00364     #pragma warning(disable : 4251) // needs to have dll-interface to be used by clients of class
00365 
00366     #pragma warning(error : 4002)   // too many actual parameters for macro 'identifier'
00367     #pragma warning(error : 4130)   // warning C4130: '==' : logical operation on address of string constant
00368     #pragma warning(error : 4238)   // warning C4238: nonstandard extension used : class rvalue used as lvalue
00369     #pragma warning(error : 4265)   // warning C4265: 'class': class has virtual functions, but destructor is not virtual
00370     #pragma warning(error : 4289)   // warning C4289: nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope
00371     #pragma warning(error : 4311)   // warning C4311: 'type cast' : pointer truncation from 'x *' to 'y'
00372     #pragma warning(error : 4373)   // warning C4373: '%$S': virtual function overrides '%$pS', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
00373     #pragma warning(error : 4431)   // warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
00374     #pragma warning(error : 4510)   // warning C4510: 'class' : default constructor could not be generated
00375     #pragma warning(error : 4551)   // warning C4551: function call missing argument list
00376     #pragma warning(error : 4553)   // warning C4553: '==' : operator has no effect; did you intend '='?
00377     #pragma warning(error : 4700)   // warning C4700: (level 1 and 4) local variable 'name' used without having been initialized
00378     #pragma warning(error : 4701)   // warning C4700: (level 4) local variable 'name' may be used without having been initialized
00379     #pragma warning(error : 4407)   // warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
00380     #pragma warning(error : 4946)   // warning C4946: reinterpret_cast used between related classes: 'class1' and 'class2'
00381     #pragma warning(error : 4996)   // warning C4996: 'function': was declared deprecated
00382 #endif
00383 
00384 #define K_LOCAL_CLASS
00385 
00386 // Deprecated macro, to remind people to stop using certain functions / attributes. 
00387 // Retirement policy, instead of directly remove certain functions / attributes, we
00388 // should declare them to be deprecated first, and then safely removed them at next 
00389 // major release. We add major release version number suffix to the macro to indicate 
00390 // the timing.
00391 
00392 #if defined(KARCH_DEV_GNUC) // GNU compiler
00393     #define K_DEPRECATED_2014 __attribute__((deprecated))
00394 #elif defined(KARCH_DEV_MSC) || defined(KARCH_DEV_INTEL) // Microsoft or Intel compiler
00395     #define K_DEPRECATED_2014 __declspec(deprecated)
00396 #else // Unknown compiler
00397     #define K_DEPRECATED_2014
00398 #endif
00399 
00400 #endif // _KAYDARA_H_
00401 
00402 
00403 
00404