OrocosComponentLibrary  2.9.0
ConsoleReporting.cpp
1 
2 #include "ConsoleReporting.hpp"
3 #include <rtt/Logger.hpp>
4 #include "TableMarshaller.hpp"
5 #include "NiceHeaderMarshaller.hpp"
6 
7 #include "ocl/Component.hpp"
8 ORO_LIST_COMPONENT_TYPE(OCL::ConsoleReporting)
9 
10 namespace OCL
11 {
12  using namespace RTT;
13  using namespace std;
14 
15  ConsoleReporting::ConsoleReporting(std::string fr_name /*= "Reporting"*/, std::ostream& console /*= std::cerr*/)
16  : ReportingComponent( fr_name ),
17  mconsole( console )
18  {
19  }
20 
21  bool ConsoleReporting::startHook()
22  {
23  RTT::Logger::In in("ConsoleReporting::startup");
24  if (mconsole) {
25  RTT::marsh::MarshallInterface* fheader;
26  RTT::marsh::MarshallInterface* fbody;
27  if ( this->writeHeader)
29  else
30  fheader = 0;
32 
33  this->addMarshaller( fheader, fbody );
34  } else {
35  log(Error) << "Could not write to console for reporting."<<RTT::endlog();
36  }
37 
38  return ReportingComponent::startHook();
39  }
40 
41  void ConsoleReporting::stopHook()
42  {
43  ReportingComponent::stopHook();
44 
45  this->removeMarshallers();
46  }
47 
48  bool ConsoleReporting::screenComponent( const std::string& comp)
49  {
50  if ( !mconsole )
51  return false;
52  return this->screenImpl( comp, mconsole );
53  }
54 }
55 
bool addMarshaller(RTT::marsh::MarshallInterface *headerM, RTT::marsh::MarshallInterface *bodyM)
Adds a Plugin to receive incomming data.
A component which writes data reports to a console.
STL namespace.
bool screenComponent(const std::string &comp)
Writes the interface status of comp to the console.
This file contains the macros and definitions to create dynamically loadable components.
bool removeMarshallers()
Remove and delete all added Marshallers.
The Orocos Component Library.
Definition: Component.hpp:43
A marsh::MarshallInterface for generating headers usable for interpretation by plot programs...
A Component for periodically reporting Component Port contents to a human readable text format...
A marsh::MarshallInterface for generating a stream of numbers, ordered in columns.
std::ostream & mconsole
Console to write reports to.
bool screenImpl(const std::string &comp, std::ostream &output)
This method writes out the status of a component&#39;s interface.
Definition: Category.hpp:10