OptLogBase.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //////////////////////////////////////////////////////////////////////
  2. //
  3. // OptLogBase.h: interface of the Log class.
  4. //
  5. // Written By: Matthias Wacker
  6. //
  7. //////////////////////////////////////////////////////////////////////
  8. #ifndef _OPT_LOG_BASE_H_
  9. #define _OPT_LOG_BASE_H_
  10. #include <string>
  11. #include <sstream>
  12. #include "core/optimization/blackbox/Definitions_core_opt.h"
  13. namespace OPTIMIZATION {
  14. /*!
  15. base class for all log classes
  16. */
  17. class OptLogBase
  18. {
  19. public:
  20. /*!
  21. Constructor.
  22. */
  23. OptLogBase();
  24. /*!
  25. Destructor.
  26. */
  27. virtual ~OptLogBase();
  28. /*!
  29. Logs an error
  30. */
  31. void logError(const char* format,...);
  32. /*!
  33. Logs a warning
  34. */
  35. void logWarning(const char* format,...);
  36. /*!
  37. Logs a trace message
  38. */
  39. void logTrace(const char* format,...);
  40. /**! Write parameter vector to output device (file, stdio, etc.)
  41. *
  42. * @param parammatrix parameter matrix
  43. */
  44. // empty for all loger except the ParamLogger
  45. virtual void writeParamsToFile(OPTIMIZATION::matrix_type& parammatrix)
  46. {
  47. }
  48. void init();
  49. protected:
  50. /**! Write error message to an output device (file, stdio, etc.)
  51. */
  52. virtual void writeLogError(const char* szMessage) = 0;
  53. /**! Write warning message to an output device (file, stdio, etc.)
  54. */
  55. virtual void writeLogWarning(const char* szMessage) = 0;
  56. /**! Write trace message to an output device (file, stdio, etc.)
  57. */
  58. virtual void writeLogTrace(const char* szMessage) = 0;
  59. private:
  60. //! Character buffer used to format messages to be logged
  61. char* m_pMessageBuffer;
  62. //! Size of the message format buffer
  63. int m_nMessageBufferSize;
  64. };
  65. } // namespace
  66. #endif