LoggingEvent.cpp
Go to the documentation of this file.
1 #include "LoggingEvent.hpp"
2 #include <log4cpp/Priority.hh>
4 #include <cstdio>
5 
6 using namespace RTT;
7 
8 namespace OCL {
9 namespace logging {
10 
11 LoggingEvent::LoggingEvent() :
12  categoryName(""),
13  message(""),
14  priority(log4cpp::Priority::NOTSET),
15  timeStamp()
16 {
17  threadName[0] = '\0'; // ensure is terminated
18 }
19 
21  categoryName(toCopy.categoryName),
22  message(toCopy.message),
23  priority(toCopy.priority),
24  timeStamp(toCopy.timeStamp)
25 {
26  memcpy(threadName, toCopy.threadName, THREADNAME_SIZE);
27 }
28 
30  const rt_string& message,
32  categoryName(categoryName),
33  message(message),
34  priority(priority),
35  timeStamp()
36 {
39 }
40 
41 LoggingEvent::LoggingEvent(const std::string& c,
42  const rt_string& m,
44  /* Optimization with std::string to prevent need to walk null-terminated
45  * string.
46  */
47  categoryName(c.c_str(), c.size()),
48  message(m),
49  priority(priority),
50  timeStamp()
51 {
54 }
55 
57 {
58  if (&rhs != this) // prevent self-copy
59  {
61  message = rhs.message;
62  priority = rhs.priority;
64  timeStamp = rhs.timeStamp;
65  }
66  return *this;
67 }
68 
70 {
71 }
72 
74 {
76  makeString(this->message),
77  makeString(""), // not used
78  this->priority,
79  this->threadName,
80  this->timeStamp);
81 }
82 
83 
84 // namespaces
85 }
86 }
A mirror of log4cpp::LoggingEvent, except using real-time capable strings.
log4cpp::Priority::Value priority
log4cpp::TimeStamp timeStamp
std::string makeString(const RTT::rt_string &str)
std::basic_string< char, std::char_traits< char >, RTT::os::rt_allocator< char > > rt_string
static const size_t THREADNAME_SIZE
const LoggingEvent & operator=(const LoggingEvent &rhs)
static std::string getThreadId()
char threadName[THREADNAME_SIZE]
LoggingEvent()
Create with empty values.
static const char * categoryName
log4cpp::LoggingEvent toLog4cpp()


ocl
Author(s): OCL Development Team
autogenerated on Wed Jun 26 2019 19:26:27