OrocosComponentLibrary  2.8.3
CategoryStream.cpp
1 #include "CategoryStream.hpp"
2 #include "Category.hpp"
3 
4 namespace OCL {
5 namespace logging {
6 
7 CategoryStream::CategoryStream(Category* rt_category, log4cpp::Priority::Value priority) :
8  _category(rt_category),
9  _priority(priority)
10 {
11 
12 }
13 
15 {
16  flush();
17 }
18 
20 {
21  _category->log(_priority, oss.str());
22  oss.flush();
23 }
24 
26 {
27  os.flush();
28 
29  return os;
30 }
31 
33  _category(rhs._category),
34  _priority(rhs._priority)
35 {
36  // Must copy the underlying buffer but not the output stream
37  (*this).oss.str(rhs.oss.str());
38 }
39 
40 } // namespace logging
41 } // namespace OCL
42 
CategoryStream(Category *rt_category, log4cpp::Priority::Value priority)
Construct a CategoryStream for given Category with given priority.
This is a utility class which you can use to stream messages into a category object.
virtual ~CategoryStream()
Destructor for CategoryStream which also flushes any remaining data to the Category object...
The Orocos Component Library.
Definition: Component.hpp:43
A real-time capable category.
Definition: Category.hpp:25
void flush()
Flush the contents of the stream buffer to the Category and empties the buffer.