OptLogBase.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 "optimization/Opt_Namespace.h"
  13. /*!
  14. base class for all log classes
  15. */
  16. class OptLogBase
  17. {
  18. public:
  19. /*!
  20. Constructor.
  21. */
  22. OptLogBase();
  23. /*!
  24. Destructor.
  25. */
  26. virtual ~OptLogBase();
  27. /*!
  28. Logs an error
  29. */
  30. void logError(const char* format,...);
  31. /*!
  32. Logs a warning
  33. */
  34. void logWarning(const char* format,...);
  35. /*!
  36. Logs a trace message
  37. */
  38. void logTrace(const char* format,...);
  39. /**! Write parameter vector to output device (file, stdio, etc.)
  40. *
  41. * @param parammatrix parameter matrix
  42. */
  43. // empty for all loger except the ParamLogger
  44. virtual void writeParamsToFile(optimization::matrix_type& parammatrix)
  45. {
  46. }
  47. void init();
  48. protected:
  49. /**! Write error message to an output device (file, stdio, etc.)
  50. */
  51. virtual void writeLogError(const char* szMessage) = 0;
  52. /**! Write warning message to an output device (file, stdio, etc.)
  53. */
  54. virtual void writeLogWarning(const char* szMessage) = 0;
  55. /**! Write trace message to an output device (file, stdio, etc.)
  56. */
  57. virtual void writeLogTrace(const char* szMessage) = 0;
  58. private:
  59. //! Character buffer used to format messages to be logged
  60. char* m_pMessageBuffer;
  61. //! Size of the message format buffer
  62. int m_nMessageBufferSize;
  63. };
  64. #endif