OrocosComponentLibrary  2.7.0
CategoryStream.hpp
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 
00019 class OCL_API CategoryStream
00020 {
00021 public:
00022 
00029     CategoryStream(Category* rt_category, log4cpp::Priority::Value priority);
00030 
00036     CategoryStream(const CategoryStream & rhs);
00037 
00042     virtual ~CategoryStream();
00043 
00048     void flush();
00049 
00055     template<typename T> CategoryStream& operator<<(const T& t) 
00056     {
00057          if (_priority != log4cpp::Priority::NOTSET) 
00058          {
00059              (oss) << t;
00060          }
00061          return *this;
00062      }
00063 
00064 private:
00065 
00066     Category* _category;
00067     log4cpp::Priority::Value _priority;
00068     RTT::rt_ostringstream oss;
00069 
00070 };
00071 
00072 
00073 } // namespace logging
00074 } // namespace OCL
00075 
00076 #endif // CATEGORY_STREAM_HPP