NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgRodSensor Class Reference

#include <tgRodSensor.h>

Inheritance diagram for tgRodSensor:
Collaboration diagram for tgRodSensor:

Public Member Functions

 tgRodSensor (tgRod *pRod)
 
virtual ~tgRodSensor ()
 
virtual std::vector< std::string > getSensorDataHeadings ()
 
virtual std::vector< std::string > getSensorData ()
 

Protected Attributes

tgSenseablem_pSens
 

Detailed Description

This class extends tgSensor to sense a tgRod. Its functionality is similar to what was hard-coded in earlier work on tgDataLogger/Observer.

Definition at line 39 of file tgRodSensor.h.

Constructor & Destructor Documentation

tgRodSensor::tgRodSensor ( tgRod pRod)

The constructor for tgRodSensor, will be same as tgSensor, but now with a more specific pointer. This should work, since tgRod is a tgSenseable.

Parameters
[in]pRoda pointer to a tgRod that this sensor will attach itself to.

This class is a sensor for tgRods. Its constructor just calls tgSensor's constructor.

Definition at line 49 of file tgRodSensor.cpp.

tgRodSensor::~tgRodSensor ( )
virtual

A class with virtual member functions must have a virtual destructor. Note that management of the pointer to the tgRod (tgSenseable) is managed by the destructor for tgSensor.

Definition at line 63 of file tgRodSensor.cpp.

Member Function Documentation

std::vector< std::string > tgRodSensor::getSensorData ( )
virtual

The method that collects the actual data from this tgRod.

The original version of this section of code, which output one string, looked like: std::stringstream sensordata; sensordata << com[0] << "," << com[1] << "," << com[2] << "," << orient[0] << "," << orient[1] << "," << orient[2] << "," << m_pRod->mass() << ",";

Implements tgSensor.

Definition at line 121 of file tgRodSensor.cpp.

std::vector< std::string > tgRodSensor::getSensorDataHeadings ( )
virtual

Similarly, this class will implement the two data colleciton methods.

The two methods from tgSensor. A tgRod can return its position and orientation. Also, the previous tgDataObserver recorded the mass of the rod too, so do that here for consistency. (even though mass doesn't change with time.)

Headings should have the following form: The type of sensor, then an open parenthesis "(" and the tags of the specific tgSenseable object, then a ")." and a label for the specific field that will be output in that row. For example, if sensor will be sensing a rod with tags "t4 t5", its label for the X position might be "rod(t4 t5).X"

Implements tgSensor.

Definition at line 73 of file tgRodSensor.cpp.

Member Data Documentation

tgSenseable* tgSensor::m_pSens
protectedinherited

This class stores a pointer to its tgSenseable object. Note that it is protected so that subclasses can access it, but children will still need to cast it against their specific type of tgSenseable (e.g., rod, cable, etc.)

Definition at line 102 of file tgSensor.h.


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