00001 #ifndef CATEGORY_STREAM_HPP
00002 #define CATEGORY_STREAM_HPP 1
00003
00004 #include <ocl/OCL.hpp>
00005 #include <log4cpp/Priority.hh>
00006 #include <rtt/rt_string.hpp>
00007
00008 namespace OCL {
00009 namespace logging {
00010
00011 class OCL_API Category;
00012
00013 class OCL_API CategoryStream
00014 {
00015 public:
00016
00023 CategoryStream(Category* rt_category, log4cpp::Priority::Value priority);
00024
00030 CategoryStream(const CategoryStream & rhs);
00031
00035 virtual ~CategoryStream();
00036
00041 void flush();
00042
00048 template<typename T> CategoryStream& operator<<(const T& t)
00049 {
00050 if (_priority != log4cpp::Priority::NOTSET)
00051 {
00052 (oss) << t;
00053 }
00054 return *this;
00055 }
00056
00057 private:
00058
00059 Category* _category;
00060 log4cpp::Priority::Value _priority;
00061 RTT::rt_ostringstream oss;
00062
00063 };
00064
00065
00066 }
00067 }
00068
00069 #endif // CATEGORY_STREAM_HPP