Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
973 B

7 years ago
7 years ago
  1. /*
  2. * Log.h
  3. *
  4. * Created on: 16.01.2017
  5. * Author: piotrek
  6. */
  7. #ifndef LOG_H_
  8. #define LOG_H_
  9. #include "common.h"
  10. enum LOG_COLOR {
  11. BLACK,
  12. RED,
  13. GREEN,
  14. YELLOW,
  15. BLUE,
  16. MAGENTA,
  17. CYAN,
  18. WHITE
  19. };
  20. class Log
  21. {
  22. int lineNumber;
  23. LOG_COLOR color;
  24. string delimiter;
  25. string *objectName;
  26. pthread_mutex_t *writeMutex;
  27. int delayVal;
  28. public:
  29. Log();
  30. void print(string msg, bool force=false);
  31. void printProgressBar(int lineNumber, int offset, string msg, float percent);
  32. LOG_COLOR getColor() const;
  33. void setColor(LOG_COLOR color);
  34. const string& getDelimiter() const;
  35. void setDelimiter(const string& delimiter);
  36. int getLineNumber() const;
  37. void setLineNumber(int lineNumber);
  38. void setLogParams(int lineNumber, LOG_COLOR color, string delimiter);
  39. static pthread_mutex_t * getMutex();
  40. void delay(int optional=-1);
  41. int getDelay() const;
  42. void setDelay(int delay);
  43. string* getObjectName() const;
  44. void setObjectName(string* objectName);
  45. };
  46. #endif /* LOG_H_ */