LRAUV  revA
DataReader Class Reference

A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL, which is returned if a dataValue request is made and this Accessor's associated DataElement is unavailable for some reason (not initialized, orphaned, or failed). More...

#include <DataReader.h>

Inheritance diagram for DataReader:
Collaboration diagram for DataReader:

Public Member Functions

 DataReader (Component *owner, DataElement &element, const DataValue *defaultValue, bool deleteDefaultValue=true)
 
 DataReader (Component *owner, DataElement &element, const Unit &defaultUnit)
 
virtual ~DataReader ()
 
const Unit * getDefaultUnit ()
 
bool isUnavailable (void)
 Status and state functions. More...
 
bool isInvalid (void)
 
bool isOrphaned (void)
 
bool isActive (void)
 
bool read (const Unit &unit, unsigned char &readTo)
 Get functions. More...
 
bool read (const Unit &unit, double &readTo)
 
bool read (const Unit &unit, float &readTo)
 
bool read (const Unit &unit, int &readTo)
 
bool read (bool &readTo)
 
bool read (Timespan &readTo)
 
bool read (DataValue &readTo)
 
int asInt (const Unit &unit)
 
double asDouble (const Unit &unit) __attribute__((deprecated))
 
Str asString (const Unit &unit)
 
const Timestamp & getTimestamp (void) const
 Returns the Timestamp of the last write to this reader's DataElement. More...
 
bool wasTouchedSinceLastRun (const Component *component)
 Returns true if the value was touched since the last run of the indicated component. More...
 
virtual void requestData (bool requestingData)
 
virtual void requestData (RequestStrategy requestStrategy)
 
bool isRequestingData (void)
 
RequestStrategy getRequestStrategy (void)
 
void setImplementor (bool implementor=true)
 
bool isImplementor ()
 
- Public Member Functions inherited from DataAccessor
virtual ~DataAccessor ()
 
virtual DataElement & getElement (void) const
 
virtual Component * getOwner (void) const
 
virtual const ElementURI & getUri (void) const
 
AccessorType getAccessorType () const
 
DataAccess * getDataAccess () const
 
Logger::TimePrecisionType getTimePrecision () const
 

Protected Attributes

RequestStrategy requestStrategy_
 
const DataValue * defaultValue_
 
const Unit & defaultUnit_
 
bool deleteDefaultValue_
 
bool implementor_
 
- Protected Attributes inherited from DataAccessor
Component * owner_
 
DataElement & element_
 
AccessorType accessorType_
 
Logger::TimePrecisionType timePrecision_
 
DataAccess * dataAccess_
 

Private Member Functions

 DataReader (const DataReader &old)
 

Additional Inherited Members

- Public Types inherited from DataAccessor
enum  AccessorType { DATA_READER = 0, DATA_WRITER = 1 }
 
enum  RequestStrategy {
  NO_STRATEGY = -1, MIN_POWER, MIN_ERROR, MIN_LATENCY,
  MAX_FREQUENCY, ALL_DEVICES, STRATEGY_COUNT
}
 
- Static Public Member Functions inherited from DataAccessor
static RequestStrategy Str2RequestStrategy (const char *const strategyStr)
 
static const char * RequestStrategy2Str (DataAccessor::RequestStrategy strategy)
 
- Static Public Attributes inherited from DataAccessor
static const char *const REQUEST_STRATEGY_STRS [STRATEGY_COUNT]
 
- Protected Member Functions inherited from DataAccessor
 DataAccessor (Component *owner, DataElement &element, AccessorType accessorType, UniversalDataElement *universal, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS)
 Protected Constructor. More...
 

Detailed Description

A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL, which is returned if a dataValue request is made and this Accessor's associated DataElement is unavailable for some reason (not initialized, orphaned, or failed).

Constructor & Destructor Documentation

DataReader::DataReader ( Component *  owner,
DataElement &  element,
const DataValue *  defaultValue,
bool  deleteDefaultValue = true 
)
DataReader::DataReader ( Component *  owner,
DataElement &  element,
const Unit &  defaultUnit 
)
DataReader::DataReader ( const DataReader &  old)
private

Member Function Documentation

double DataReader::asDouble ( const Unit &  unit)
const Unit * DataReader::getDefaultUnit ( )
RequestStrategy DataReader::getRequestStrategy ( void  )
inline
bool DataReader::isActive ( void  )

References DataAccessor::element_, and DataElement::isActive().

Referenced by VerticalTemperatureHomogeneityIndexCalculator::addSample(), NAL9602::awake(), NAL9602::belowSurfaceThreshold(), ZigZag::calculate(), YoYo::calculate(), CBIT::checkDepth(), GoToSurface::checkPitchAndAltitude(), HorizontalControl::controlHeading(), VerticalControl::controlVertical(), Lane::doRun(), CBIT::empiricalFaultClassification(), PNI_TCM::getMagneticVariation(), NAL9602::goToSleep(), CBIT::handleComponentFaults(), Waypoint::initialize(), Circle::initialize(), HFRadarModelPoint::initialize(), Lane::initialize(), NAL9602::isDataRequested(), ElevatorServo::isNeeded(), RudderServo::isNeeded(), ThrusterServo::isNeeded(), Waypoint::isSatisfied(), Circle::isSatisfied(), KeepStation::isSatisfied(), HFRCMSurfaceCurrentAtVehicleLocation::lookupEmpiricalOrthogonalFunctions(), VerticalControl::overrideVertical(), DVL_micro::processNQ1(), StratificationFrontDetector::readData(), SetSpeed::readParams(), PeakDetectHorizontal::readParams(), PeakDetectVsDepth::readParams(), OffshoreEnvelope::readParams(), WaterDepthEnvelope::readParams(), Lane::readParams(), AltitudeEnvelope::readParams(), TempGradientCalculator::run(), SpeedCalculator::run(), Depth_Keller::run(), SpeedControl::run(), IBIT::run(), VerticalControl::run(), NavChart::run(), HorizontalControl::run(), HFRCMReconstructedInterpolator::run(), HFRCMTimeInterpolator::run(), DepthRateCalculator::run(), Tracking::run(), ElevatorServo::runnable(), MassServo::runnable(), RudderServo::runnable(), BuoyancyServo::runnable(), ThrusterServo::runnable(), AHRS_3DMGX3::runnable(), CTD_NeilBrown::runnable(), AHRS_sp3003D::runnable(), VerticalControl::setMassAndElevator(), VerticalControl::setPitch(), Radio_Surface::shouldBeOn(), Universal_Test::test1DUniversalBlobReadWrite(), Universal_Test::test3DUniversalBlobReadWrite(), Blob_Test::testReadWrite(), and Blob_Test::testReadWriteConversions().

bool DataReader::isImplementor ( )
inline

References implementor_.

Referenced by DataElement::isImplemented().

bool DataReader::isInvalid ( void  )
bool DataReader::isOrphaned ( void  )
bool DataReader::isRequestingData ( void  )
inline
bool DataReader::isUnavailable ( void  )

Status and state functions.

References DataAccessor::element_, and DataElement::isUnavailable().

bool DataReader::read ( const Unit &  unit,
unsigned char &  readTo 
)

Get functions.

References DataValue::copyTo(), defaultValue_, DataAccessor::element_, DataElement::get(), and DataElement::isActive().

Referenced by BuoyancyServo::abovePumpDepth(), VerticalTemperatureHomogeneityIndexCalculator::addSample(), HFRCMVirtualSurfaceDrifter::advect(), NAL9602::belowSurfaceThreshold(), PeakDetectVsDepth::calcSatisfied(), Buoyancy::calcSatisfied(), ZigZag::calculate(), YoYo::calculate(), CBIT::checkDepth(), CBIT::checkLocation(), GoToSurface::checkPitchAndAltitude(), CommandLine::commandConversation(), VerticalControl::controlDepth(), VerticalControl::controlDepthRate(), HorizontalControl::controlHeading(), SpeedControl::controlSpeed(), VerticalControl::controlVertical(), IBIT::ctrlSurfaceCheckPos(), SBIT::ctrlSurfaceCheckPos(), Lane::doRun(), CBIT::empiricalFaultClassification(), ValueClause::evalSide(), LuaAPI::Exec(), VerticalControl::floatAtSurface(), CommandLine::getLines(), PNI_TCM::getMagneticVariation(), AcousticModem_Benthos_ATM900::gotNewQuery(), DAT::gotNewQuery(), HorizontalControl::headingControl(), HFRadarModelCalc::HFRadarModelCalc(), HFRCMSurfaceCurrentAtVehicleLocation::HFRCMSurfaceCurrentAtVehicleLocation(), UniversalFixResidualReporter::initialize(), Circle::initialize(), Point::initialize(), Waypoint::initialize(), NavChartDb::initialize(), HFRadarModelPoint::initialize(), HFRCMSpaceInterpolator::initialize(), HFRCMReconstructedInterpolator::initialize(), HorizontalControl::initialize(), KeepStation::initialize(), Lane::initialize(), MissionItem::initialize(), ElevatorServo::isNeeded(), RudderServo::isNeeded(), BuoyancyServo::isNeeded(), MassServo::isNeeded(), ThrusterServo::isNeeded(), Waypoint::isSatisfied(), Circle::isSatisfied(), HFRadarModelPoint::isSatisfied(), KeepStation::isSatisfied(), HFRadarCompactModelForecaster::loadHistory(), SimulatorUtils::LoadInit(), GoToSurface::loadParams(), HFRCMSurfaceCurrentAtVehicleLocation::lookupEmpiricalOrthogonalFunctions(), VerticalControl::massAndElevatorControl(), CBIT::monitorBatteryTemps(), CBIT::monitorEnvironmentals(), VerticalControl::overrideVertical(), CTD_NeilBrown::preprocessData(), Tracking::processFromDAT(), DVL_micro::processNQ1(), DepthEnvelope::projectDepth(), ExternalSim::publishState(), HFRCMReconstructedInterpolator::publishSurfaceCurrentAtVehicleLocation(), HFRadarModelCalc::publishSurfaceCurrentAtVehicleLocation(), UniversalBlobReader::read(), BlobReader::read(), Rowe_600::readAccuracyConfigs(), ESPComponent::readAdjustableConfigs(), TempGradientCalculator::readConfig(), VerticalTemperatureHomogeneityIndexCalculator::readConfig(), DepthServo::readConfig(), StratificationFrontDetector::readConfig(), Depth_Keller::readConfig(), IBIT::readConfig(), VerticalControl::readConfig(), SBIT::readConfig(), SpeedControl::readConfig(), PitchServo::readConfig(), DVL_micro::readConfig(), PAR_Licor::readConfig(), Onboard::readConfig(), WetLabsBB2FL::readConfig(), AcousticModem_Benthos_ATM900::readConfig(), HorizontalControl::readConfig(), DAT::readConfig(), SCPI::readConfig(), AHRS_3DMGX3::readConfig(), PNI_TCM::readConfig(), CTD_NeilBrown::readConfig(), CANONSampler::readConfig(), PrepareToDive::readConfig(), Batt_Ocean_Server::readConfig(), DataOverHttps::readConfig(), BPC1::readConfig(), EZServoServo::readConfig(), Turner_Cyclops_rhodamine::readConfig(), Rowe_600::readConfig(), Rowe_600LCM::readConfig(), ElevatorServo::readConfig(), RudderServo::readConfig(), CBIT::readConfig(), MassServo::readConfig(), ThrusterServo::readConfig(), BuoyancyServo::readConfig(), AltitudeEnvelope::readConfig(), DepthEnvelope::readConfig(), YoYo::readConfig(), AHRS_sp3003D::readConfig(), NAL9602::readConfig(), Navigator::readConfigs(), ESPComponent::readConfigs(), StratificationFrontDetector::readData(), Navigator::readExternalFix(), Tracking::readFromDAT(), Rowe_600::readInterfaceConfigs(), Rowe_600::readOffsetConfigs(), SetSpeed::readParams(), Point::readParams(), GoToSurface::readParams(), PeakDetectHorizontal::readParams(), PeakDetectVsDepth::readParams(), PrepareToDive::readParams(), Pitch::readParams(), WaterDepthEnvelope::readParams(), OffshoreEnvelope::readParams(), DepthServo::readParams(), PitchServo::readParams(), AltitudeEnvelope::readParams(), Lane::readParams(), DepthEnvelope::readParams(), Pitch::readSettings(), DeadReckonUsingSpeedCalculator::readVehicleVelocity(), DeadReckonWithRespectToWater::readVehicleVelocity(), DeadReckonUsingDVLWaterTrack::readVehicleVelocity(), DeadReckonWithRespectToSeafloor::readVehicleVelocity(), DeadReckonUsingCompactModelForecast::readVehicleVelocity(), DeadReckonUsingMultipleVelocitySources::readVehicleVelocity(), Rowe_600::readWriterConfigs(), UniversalFixResidualReporter::reportFixResidual(), PeakDetectHorizontal::reportPeak(), ReadDataComponent::requestData(), TempGradientCalculator::run(), SpeedCalculator::run(), PAR_Licor::run(), Depth_Keller::run(), IBIT::run(), LoopControl::run(), NavChart::run(), YawRateCalculator::run(), HFRCMSurfaceCurrentAtVehicleLocation::run(), PitchRateCalculator::run(), HFRadarModelPoint::run(), MissionManager::run(), Circle::run(), DepthRateCalculator::run(), InternalSim::run(), ExternalSim::run(), NavigationSim::run(), DepthServo::run(), MissionItem::run(), HFRadarModel::runIfUnsatisfied(), AltitudeEnvelope::runIfUnsatisfied(), DepthEnvelope::runIfUnsatisfied(), ValueDetect::runIfUnsatisfied(), OffshoreEnvelope::runIfUnsatisfied(), WaterDepthEnvelope::runIfUnsatisfied(), MissionItem::runIfUnsatisfied(), ElevatorServo::runnable(), MassServo::runnable(), RudderServo::runnable(), BuoyancyServo::runnable(), ThrusterServo::runnable(), AHRS_3DMGX3::runnable(), CTD_NeilBrown::runnable(), AHRS_sp3003D::runnable(), CBIT::scanGFChan(), VerticalControl::setBuoyancy(), AHRS_sp3003D::setCalMode(), YoYo::setGoingDown(), HorizontalControl::setHeading(), HorizontalControl::setHeadingRate(), VerticalControl::setMassAndElevator(), VerticalControl::setPitch(), VerticalControl::setPitchRate(), Radio_Surface::shouldBeOn(), Component::simulateHardware(), OffshoreEnvelope_Test::testRun(), and WetLabsBB2FL::writeData().

bool DataReader::read ( const Unit &  unit,
double &  readTo 
)
bool DataReader::read ( const Unit &  unit,
float &  readTo 
)
bool DataReader::read ( const Unit &  unit,
int &  readTo 
)
virtual void DataReader::requestData ( RequestStrategy  requestStrategy)
inlinevirtual

Reimplemented in UniversalDataReader.

References requestStrategy_.

void DataReader::setImplementor ( bool  implementor = true)
inline

Member Data Documentation

const Unit& DataReader::defaultUnit_
protected

Referenced by getDefaultUnit().

const DataValue* DataReader::defaultValue_
protected
bool DataReader::deleteDefaultValue_
protected

Referenced by ~DataReader().

bool DataReader::implementor_
protected

Referenced by isImplementor(), and setImplementor().

RequestStrategy DataReader::requestStrategy_
protected

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