00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ORO_REPORTING_COMPONENT_HPP
00029 #define ORO_REPORTING_COMPONENT_HPP
00030
00031
00032 #include <boost/tuple/tuple.hpp>
00033
00034 #include <rtt/Property.hpp>
00035 #include <rtt/PropertyBag.hpp>
00036 #include <rtt/Marshaller.hpp>
00037 #include <rtt/TimeService.hpp>
00038 #include <rtt/TaskContext.hpp>
00039
00040 #include <rtt/RTT.hpp>
00041
00042 #include <ocl/OCL.hpp>
00043
00044 namespace OCL
00045 {
00081 class ReportingComponent
00082 : public RTT::TaskContext
00083 {
00084 protected:
00088 bool screenImpl( const std::string& comp, std::ostream& output);
00089 public:
00090
00091 typedef RTT::DataFlowInterface::Ports Ports;
00092
00096 ReportingComponent( std::string name = "Reporting" );
00097
00098 virtual ~ReportingComponent();
00099
00112 bool addMarshaller( RTT::Marshaller* headerM, RTT::Marshaller* bodyM);
00113
00117 bool removeMarshallers();
00118
00128 virtual bool configureHook();
00129
00134 virtual void cleanupHook();
00135
00140 virtual bool screenComponent( const std::string& comp );
00141
00145 bool reportComponent( const std::string& component );
00146
00150 bool unreportComponent( const std::string& component );
00151
00155 bool reportPort(const std::string& component, const std::string& port );
00156
00160 bool unreportPort(const std::string& component, const std::string& port );
00161
00165 bool reportData(const std::string& component,const std::string& dataname);
00166
00170 bool unreportData(const std::string& component,const std::string& datasource);
00171
00176 void snapshot();
00177
00178 void cleanReport();
00179
00182 protected:
00183 typedef boost::tuple<std::string,
00184 RTT::DataSourceBase::shared_ptr,
00185 boost::shared_ptr<RTT::CommandInterface>,
00186 RTT::DataSourceBase::shared_ptr,
00187 std::string> DTupple;
00191 typedef std::vector<DTupple> Reports;
00192 Reports root;
00193
00194 bool reportDataSource(std::string tag, std::string type, RTT::DataSourceBase::shared_ptr orig);
00195
00196 bool unreportDataSource(std::string tag);
00197
00198 virtual bool startHook();
00199
00200 void makeReport();
00201
00205 virtual void updateHook();
00206
00207 virtual void stopHook();
00208
00209 typedef std::vector< std::pair<boost::shared_ptr<RTT::Marshaller>, boost::shared_ptr<RTT::Marshaller> > > Marshallers;
00210 Marshallers marshallers;
00211 RTT::PropertyBag report;
00212
00213 RTT::Property<bool> autotrigger;
00214 RTT::Property<std::string> config;
00215 RTT::Property<bool> writeHeader;
00216 RTT::Property<bool> decompose;
00217 RTT::Property<bool> synchronize_with_logging;
00218 RTT::Property<PropertyBag> report_data;
00219
00220 RTT::TimeService::ticks starttime;
00221 RTT::Property<RTT::TimeService::Seconds> timestamp;
00222
00223 };
00224
00225 }
00226
00227 #endif