Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

at_os.h

Go to the documentation of this file.
00001 //
00002 // The Austria library is copyright (c) Gianni Mariani 2004.
00003 // 
00004 // Grant Of License.  Grants to LICENSEE the non-exclusive right to use the Austria
00005 // library subject to the terms of the LGPL.
00006 // 
00007 // A copy of the license is available in this directory or one may be found at this URL:
00008 //      http://www.gnu.org/copyleft/lesser.txt
00009 // 
00015 #ifndef x_at_os_h_x
00016 #define x_at_os_h_x 1
00017 
00018 #include "at_exports.h"
00019 
00020 // Austria namespace
00021 namespace at
00022 {
00023         
00031 #ifndef AT_DebugBuild
00032 #ifdef NDEBUG
00033 #define AT_DebugBuild 0
00034 #else
00035 #define AT_DebugBuild 1
00036 #endif
00037 #endif
00038 
00039 // ======== OSTraitsBase ============================================
00045 class AUSTRIA_EXPORT OSTraitsBase
00046 {
00047     friend class UnitTestAssertModifier;
00048     
00049         // An address that is guaranteed to cause an access violation.
00050         static char * m_accessViolationAddr;
00051 
00052     static bool     m_running_test_case;
00053 
00054     public:
00055 
00056 
00057     // ======== GetAccVioAddr =========================================
00064     static inline char * GetAccVioAddr()
00065     {
00066         return m_accessViolationAddr;
00067     }
00068 
00069 
00070     // ======== GetRunningTestCase ====================================
00077     static inline bool GetRunningTestCase()
00078     {
00079         return m_running_test_case;
00080     }
00081 
00082         // ======== AT_OSAssert ===========================================
00087         static inline bool AT_OSAssert( bool i_assertion, const char * i_file, int i_line )
00088         {
00089         
00090                 if ( ! i_assertion )
00091                 {
00092             if ( m_running_test_case )
00093             {
00094                 TestCaseAssert( i_file, i_line );
00095             }
00096                         * m_accessViolationAddr = 0;
00097                 }
00098                 return true;
00099         }
00100 
00101 
00102     // ======== TestCaseAssert ========================================
00111         static void TestCaseAssert( const char * i_file, int i_line );    
00112 
00113     // ======== TestCaseAbort =========================================
00121         static void TestCaseAbort( const char * i_file, int i_line );    
00122 
00123         enum {
00129                 DebugBuild = AT_DebugBuild
00130         };
00131 
00137     static const char           * m_default_temp_dir;
00138 
00139 #if defined(WIN32) || defined(_WIN32)
00140 
00141 #define AT_ATOMIC_H "at_win32_atomic.h"
00142 #define AT_THREAD_H "at_win32_thread.h"
00143 #define AT_THREAD_CCP_I "at_win32_thread_cpp.i"
00144 
00145     static const char   m_directory_separator = '\\';
00146     
00147 #else
00148 
00149 #define AT_ATOMIC_H "at_gx86_atomic.h"
00150 #define AT_THREAD_H "at_gx86_thread.h"
00151 #define AT_THREAD_CCP_I "at_gx86_thread_cpp.i"
00152 
00153     static const char   m_directory_separator = '/';
00154     
00155 #endif
00156         
00157 };
00158 
00159 }; // namespace
00160 
00161 #endif // x_at_os_h_x
00162 

Generated for Austria by doxygen and MakeXS at Sun Oct 24 17:35:34 PDT 2004