home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Found / FWExcLib / Include / FWExcLog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-21  |  2.7 KB  |  93 lines  |  [TEXT/MPS ]

  1. #if !defined(FWEXCLOG_H) && defined(FW_DEBUG)
  2. #define FWEXCLOG_H
  3. // This entire file is for debugging only
  4. //========================================================================================
  5. //
  6. //    File:                FWExcLog.h
  7. //    Release Version:    $ 1.0d1 $
  8. //
  9. //    Creation Date:        3/28/94
  10. //
  11. //    Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  12. //
  13. //========================================================================================
  14.  
  15. #ifndef   FWCLAINF_H
  16. #include "FWClaInf.h"
  17. #endif
  18.  
  19. #ifndef   FWEXCEPT_H
  20. #include "FWExcept.h"
  21. #endif
  22.  
  23. #ifndef   FWEXCTAS_H
  24. #include "FWExcTas.h"
  25. #endif
  26.  
  27. #ifndef   FWSEXCLO_H
  28. #include "FWSExcLo.h"
  29. #endif
  30.  
  31. //========================================================================================
  32. // CLASS _FW_CExceptionLog
  33. //========================================================================================
  34.  
  35. class _FW_CExceptionLog
  36. {
  37.  
  38. public:
  39.  
  40.     static void Initialize(FW_SPrivExceptionLog& globals);
  41.         // Sets log in valid, non-logging state.
  42.         // Should only be called once at startup.
  43.  
  44.     static void Terminate();
  45.         // Terminates all logging.
  46.         // Should only be called once at application exit.
  47.  
  48.     static void StartLog();
  49.         // Starts (resumes) logging.  Resets trigger count to zero.
  50.         // We increment the logging counter each time StartLog is called.
  51.         // Logging is only enabled when the counter is above 0.
  52.         // Logging requires tracing, so StartLog calls StartTrace.
  53.     
  54.     static unsigned long StopLog();
  55.         // Suspends logging, and calls StopTrace, which may stop tracing.
  56.         // Returns final trigger counter (number of possible exception points).
  57.  
  58.     static void CauseException(unsigned long triggerPoint);
  59.     static void CauseException(FW_ClassReference exceptionClass);
  60.  
  61.     static void LogException(FW_ClassReference  exceptionClass);
  62.     static void TriggerException(FW_ClassReference  exceptionClass, 
  63.                                  const _FW_CException &theException);
  64.                                  
  65.     static FW_SPrivExceptionLog&                GetExceptionLogGlobals();
  66.  
  67. private:
  68.  
  69.     enum
  70.     {
  71.         kExceptionLogGlobalsOffset = 100
  72.     };
  73. };
  74.  
  75. //========================================================================================
  76. // _FW_CExceptionLog inline functions
  77. //========================================================================================
  78.  
  79. //----------------------------------------------------------------------------------------
  80. //    _FW_CExceptionLog::GetExceptionLogGlobals
  81. //----------------------------------------------------------------------------------------
  82.  
  83. inline FW_SPrivExceptionLog& _FW_CExceptionLog::GetExceptionLogGlobals()
  84. {
  85.     FW_SPrivExceptionLog *globals = (FW_SPrivExceptionLog*)
  86.                 FW_CPrivTaskGlobals::GetTaskGlobals(kExceptionLogGlobalsOffset);
  87.     if (globals->gInitialized == 0)
  88.         Initialize(*globals);
  89.     return *globals;
  90. }
  91.  
  92. #endif
  93.