FileReporting.cpp
Go to the documentation of this file.
1 
2 #include "FileReporting.hpp"
3 #include <rtt/RTT.hpp>
4 #include <rtt/Logger.hpp>
5 #include "TableMarshaller.hpp"
7 
8 
9 #include "ocl/Component.hpp"
11 
12 namespace OCL
13 {
14  using namespace RTT;
15  using namespace std;
16 
17  FileReporting::FileReporting(const std::string& fr_name)
18  : ReportingComponent( fr_name ),
19  repfile("ReportFile","Location on disc to store the reports.", "reports.dat")
20  {
21  this->properties()->addProperty( repfile );
22  }
23 
25  {
26  mfile.open( repfile.get().c_str() );
27  if (mfile) {
28  if ( this->writeHeader)
30  else
31  fheader = 0;
33 
34  this->addMarshaller( fheader, fbody );
35  } else {
36  log(Error) << "Could not open file "+repfile.get()+" for reporting."<<endlog();
37  }
38 
40  }
41 
43  {
45 
46  this->removeMarshallers();
47  if (mfile)
48  mfile.close();
49  }
50 
51  bool FileReporting::screenComponent( const std::string& comp)
52  {
53  Logger::In in("FileReporting::screenComponent");
54  ofstream file( (comp + ".screen").c_str() );
55  if (!file)
56  return false;
57  return this->screenImpl( comp, file );
58  }
59 
60 }
RTT::marsh::MarshallInterface * fheader
DataSourceType get() const
std::ofstream mfile
bool addMarshaller(RTT::marsh::MarshallInterface *headerM, RTT::marsh::MarshallInterface *bodyM)
RTT::Property< bool > writeHeader
RTT::Property< std::string > repfile
bool screenComponent(const std::string &comp)
Property< T > & addProperty(const std::string &name, T &attr)
Error
bool screenImpl(const std::string &comp, std::ostream &output)
A Component for periodically reporting Component Port contents to a human readable text format...
PropertyBag * properties()
ORO_LIST_COMPONENT_TYPE(OCL::logging::GenerationalFileAppender)
RTT::marsh::MarshallInterface * fbody


ocl
Author(s): OCL Development Team
autogenerated on Mon Mar 23 2020 04:47:19