OrocosComponentLibrary  2.9.0
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
TcpReporting Class Reference

A component which writes data reports to a tcp/ip socket. More...

#include <TcpReporting.hpp>

Inheritance diagram for TcpReporting:
ReportingComponent

Public Types

typedef RTT::DataFlowInterface::Ports Ports
 

Public Member Functions

 TcpReporting (std::string fr_name="ReportingComponent")
 Create a reporting component which starts up a server. More...
 
bool configureHook ()
 Implementation of base::TaskCore::configureHook(). More...
 
bool startHook ()
 
void stopHook ()
 
const RTT::PropertyBag * getReport ()
 Return a property bag.
 
bool addMarshaller (RTT::marsh::MarshallInterface *headerM, RTT::marsh::MarshallInterface *bodyM)
 Adds a Plugin to receive incomming data. More...
 
bool removeMarshallers ()
 Remove and delete all added Marshallers.
 
Script Methods
virtual void cleanupHook ()
 Implementation of base::TaskCore::cleanupHook(). More...
 
virtual bool screenComponent (const std::string &comp)
 Write state information of a component. More...
 
bool reportComponent (const std::string &component)
 Report all the data ports of a component.
 
bool unreportComponent (const std::string &component)
 Unreport the data ports of a component.
 
bool reportPort (const std::string &component, const std::string &port)
 Report a specific data port of a component.
 
bool unreportPort (const std::string &component, const std::string &port)
 Unreport a specific data port of a component.
 
bool reportData (const std::string &component, const std::string &dataname)
 Report a specific data source of a component.
 
bool unreportData (const std::string &component, const std::string &datasource)
 Unreport a specific data source of a component.
 
bool copydata ()
 This real-time function makes copies of the data to be reported. More...
 
void snapshot ()
 Copy the reported data and trigger the generation of a sampling line.
 
void cleanReport ()
 Implementation of base::TaskCore::configureHook(). More...
 

Protected Types

enum  T_Types {
  T_QualName = 0, T_PortDS, T_DataType, T_Property,
  T_Port, T_NewData, T_Tracked
}
 Use these to index DTupple objects.
 
typedef boost::tuple< std::string, RTT::base::DataSourceBase::shared_ptr, std::string, RTT::base::PropertyBase *, RTT::base::InputPortInterface *, bool, bool > DTupple
 tuple that describes each sample. More...
 
typedef std::vector< DTuppleReports
 Stores the 'datasource' of all reported items as properties.
 
typedef std::vector< std::pair< boost::shared_ptr< RTT::marsh::MarshallInterface >, boost::shared_ptr< RTT::marsh::MarshallInterface > > > Marshallers
 

Protected Member Functions

bool screenImpl (const std::string &comp, std::ostream &output)
 This method writes out the status of a component's interface.
 
bool reportDataSource (std::string tag, std::string type, RTT::base::DataSourceBase::shared_ptr origm, RTT::base::InputPortInterface *ipi, bool)
 
bool unreportDataSource (std::string tag)
 
void makeReport2 ()
 
virtual void updateHook ()
 This not real-time function processes the copied data.
 

Protected Attributes

RTT::SocketMarshallerfbody
 marsh::MarshallInterface
 
Reports root
 
Marshallers marshallers
 
RTT::PropertyBag report
 
bool snapshotted
 Used to communicate between snapshot() and updateHook() if updateHook needs to make a copy.
 
RTT::Property< std::string > config
 
RTT::Property< bool > writeHeader
 
RTT::Property< bool > decompose
 
RTT::Property< bool > insnapshot
 
RTT::Property< bool > synchronize_with_logging
 
RTT::Property< PropertyBag > report_data
 
RTT::ConnPolicy report_policy
 
bool onlyNewData
 
RTT::os::TimeService::ticks starttime
 
RTT::Property< RTT::os::TimeService::Seconds > timestamp
 
RTT::internal::DataSource< bool >::shared_ptr mchecker
 If false, a sequence size has changed.
 

Detailed Description

A component which writes data reports to a tcp/ip socket.

It can serve different clients. It uses a ASCI-based protocol.

Usage

Authentication of the client:

The server accepts different kinds of commands. Before these commands are available for the client, the client has to authenticate itself.

Getting Help:

The client can get the available commands

and the syntax for each command.

Getting a list of available data:

The client can get the names of all the available data.

Subscribe to Data:

The client has to send the server the names of the available data he wants to get. Only the subscribed data will be send to the client.

Unsubscribe to Data:

The client can cancel a subscription.

Getting a list of the subscriptions:

The client can ask for the subscriptions he has made.

Start/stop streaming the data:

The client can start and stop the streaming of the subscribed data.

Close the connection with the server:

The client can close the connection with the server.

When an error occures:

When an error occurs because of wrong syntax the server will answer with an error message.

The streaming data:

When the streaming is started the server will send the following message at each timeframe.

Definition at line 170 of file TcpReporting.hpp.

Member Typedef Documentation

typedef boost::tuple<std::string, RTT::base::DataSourceBase::shared_ptr, std::string,RTT::base::PropertyBase*,RTT::base::InputPortInterface*,bool,bool> DTupple
protectedinherited

tuple that describes each sample.

Uses get<N>() to read it: @0 The qualified name of the data (componentname.portname) @1 The data source of the data. Always returns the last value. @2 A copy command to copy from this data source to another one @3 The target data source for the copy operation @4 The type of the data, "Data" (props and attrs) or "Port". @5 'newdata': The new data flag. Flags if the DataSource contains new data. @6 'tracked': True if this source may lead to additional data. If false, the source in itself will not cause to a re-scan. Used in copydata() to allow ports to be rescanned, while props and attrs never cause this (they always have newdata, but this is ignored).

Definition at line 204 of file ReportingComponent.hpp.

Constructor & Destructor Documentation

TcpReporting ( std::string  fr_name = "ReportingComponent")

Create a reporting component which starts up a server.

Parameters
fr_nameName of the TCP reporting component.
portPort to listen on.

Definition at line 214 of file TcpReporting.cpp.

Member Function Documentation

bool addMarshaller ( RTT::marsh::MarshallInterface *  headerM,
RTT::marsh::MarshallInterface *  bodyM 
)
inherited

Adds a Plugin to receive incomming data.

The marshallers become owned by this component.

Parameters
headerA marshaller which writes out a header when this component is started. May be null (0).
bodyA marshaller wich will get periodically a serialisation request to process incomming data. May be null(0).

example: addMarshaller( new HeaderMarshaller(), new ContentsMarshaller() );

Definition at line 216 of file ReportingComponent.cpp.

Referenced by TcpReporting::configureHook(), and ConsoleReporting::ConsoleReporting().

void cleanReport ( )
inherited

Implementation of base::TaskCore::configureHook().

Calls load().

Definition at line 643 of file ReportingComponent.cpp.

Referenced by ReportingComponent::updateHook().

void cleanupHook ( )
virtualinherited

Implementation of base::TaskCore::cleanupHook().

Calls store() and clears the reporting configuration.

Definition at line 237 of file ReportingComponent.cpp.

bool configureHook ( )
virtual

Implementation of base::TaskCore::configureHook().

Calls load().

Reimplemented from ReportingComponent.

Definition at line 232 of file TcpReporting.cpp.

References ReportingComponent::addMarshaller(), TcpReporting::fbody, and ReportingComponent::removeMarshallers().

bool copydata ( )
inherited

This real-time function makes copies of the data to be reported.

Returns
true if new data is available.

Definition at line 597 of file ReportingComponent.cpp.

References ReportingComponent::mchecker, and OCL::memberDecomposition().

Referenced by ReportingComponent::unreportData(), and ReportingComponent::updateHook().

bool screenComponent ( const std::string &  comp)
virtualinherited

Write state information of a component.

This method must be overridden by a subclass to be useful.

Reimplemented in FileReporting, and ConsoleReporting.

Definition at line 301 of file ReportingComponent.cpp.

Referenced by ReportingComponent::ReportingComponent().


The documentation for this class was generated from the following files: