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/marsh/MarshallInterface.hpp>
00037 #include <rtt/os/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::marsh::MarshallInterface* headerM, RTT::marsh::MarshallInterface* 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
00177 bool copydata();
00178
00182 void snapshot();
00183
00184 void cleanReport();
00185
00188 protected:
00202 typedef boost::tuple<std::string,
00203 RTT::base::DataSourceBase::shared_ptr,
00204 boost::shared_ptr<RTT::base::ActionInterface>,
00205 RTT::base::DataSourceBase::shared_ptr,
00206 std::string,bool,bool> DTupple;
00210 typedef std::vector<DTupple> Reports;
00211 Reports root;
00212
00213 bool reportDataSource(std::string tag, std::string type, RTT::base::DataSourceBase::shared_ptr origm, bool);
00214
00215 bool unreportDataSource(std::string tag);
00216
00217 virtual bool startHook();
00218
00219 void makeReport();
00220
00224 virtual void updateHook();
00225
00226 virtual void stopHook();
00227
00228 typedef std::vector< std::pair<boost::shared_ptr<RTT::marsh::MarshallInterface>, boost::shared_ptr<RTT::marsh::MarshallInterface> > > Marshallers;
00229 Marshallers marshallers;
00230 RTT::PropertyBag report;
00231
00232 RTT::Property<bool> snapshotOnly;
00233 RTT::Property<std::string> config;
00234 RTT::Property<bool> writeHeader;
00235 RTT::Property<bool> decompose;
00236 RTT::Property<bool> synchronize_with_logging;
00237 RTT::Property<PropertyBag> report_data;
00238 RTT::Property<std::string> null;
00239
00240 RTT::os::TimeService::ticks starttime;
00241 RTT::Property<RTT::os::TimeService::Seconds> timestamp;
00242
00243 };
00244
00245 }
00246
00247 #endif