ConsoleReporting.cpp
Go to the documentation of this file.
00001 
00002 #include "ConsoleReporting.hpp"
00003 #include <rtt/Logger.hpp>
00004 #include "TableMarshaller.hpp"
00005 #include "NiceHeaderMarshaller.hpp"
00006 
00007 #include "ocl/Component.hpp"
00008 ORO_LIST_COMPONENT_TYPE(OCL::ConsoleReporting)
00009 
00010 namespace OCL
00011 {
00012     using namespace RTT;
00013     using namespace std;
00014 
00015     ConsoleReporting::ConsoleReporting(std::string fr_name /*= "Reporting"*/, std::ostream& console /*= std::cerr*/)
00016         : ReportingComponent( fr_name ),
00017           mconsole( console )
00018     {
00019     }
00020 
00021         bool ConsoleReporting::startHook()
00022         {
00023             RTT::Logger::In in("ConsoleReporting::startup");
00024             if (mconsole) {
00025                 RTT::marsh::MarshallInterface* fheader;
00026                 RTT::marsh::MarshallInterface* fbody;
00027                 if ( this->writeHeader)
00028                     fheader = new RTT::NiceHeaderMarshaller<std::ostream>( mconsole );
00029                 else
00030                     fheader = 0;
00031                 fbody = new RTT::TableMarshaller<std::ostream>( mconsole );
00032 
00033                 this->addMarshaller( fheader, fbody );
00034             } else {
00035                 log(Error) << "Could not write to console for reporting."<<RTT::endlog();
00036             }
00037 
00038             return ReportingComponent::startHook();
00039         }
00040 
00041         void ConsoleReporting::stopHook()
00042         {
00043             ReportingComponent::stopHook();
00044 
00045             this->removeMarshallers();
00046         }
00047 
00048         bool ConsoleReporting::screenComponent( const std::string& comp)
00049         {
00050             if ( !mconsole )
00051                 return false;
00052             return this->screenImpl( comp, mconsole );
00053         }
00054 }
00055 


ocl
Author(s): OCL Development Team
autogenerated on Thu Jan 2 2014 11:38:08