LRAUV  revA
UniversalDataReader.h
Go to the documentation of this file.
1 
10 #ifndef UNIVERSALDATAREADER_H_
11 #define UNIVERSALDATAREADER_H_
12 
13 #include "data/BlobReader.h"
14 #include "data/DataReader.h"
16 
27 {
28 public:
29  UniversalDataReader( Component* owner, UniversalDataElement& universalElement,
30  const DataValue* defaultValue,
31  bool deleteDefaultValue = true );
32 
33  UniversalDataReader( Component* owner, UniversalDataElement& universalElement,
34  const Unit& defaultUnit );
35 
36  virtual ~UniversalDataReader();
37 
42  float getAccuracy( const Unit& unit );
43 
48  float getWrittenAccuracy( const Unit& unit );
49 
50  virtual void requestData( bool requestingData )
51  {
52  requestData( requestingData ? MIN_POWER : NO_STRATEGY );
53  }
54 
55  void requestData( RequestStrategy requestStrategy );
56 
58  {
59  return universalElement_;
60  }
61 
62 protected:
63 
64 private:
65  // Note that the copy constructor below is private and not given a body.
66  // Any attempt to call it will return a compiler error.
67  UniversalDataReader( const UniversalDataReader& old ); // disallow copy constructor
68 
69  // This is just for convenience -- it's the same thing as element_
71 
72 };
73 
75 {
76 public:
77 
79  {}
80 
81  // Re-implement abstract method from AbstractBlobReader
82  virtual bool read( DataValue& readTo )
83  {
84  return DataReader::read( readTo );
85  }
86 
87  // Re-implement abstract method from AbstractBlobReader
88  virtual const ElementURI& getUri( void ) const
89  {
90  return DataReader::getUri();
91  }
92 
93 protected:
94 
95  friend class Component;
96 
98  const Unit& defaultUnit )
99  : UniversalDataReader( owner, universalElement, defaultUnit ),
101  {}
102 
103 };
104 
105 #endif /*UNIVERSALDATAREADER_H_*/
float getWrittenAccuracy(const Unit &unit)
Returns the DataElement's accuracy at the time of the last write;.
Definition: UniversalDataReader.cpp:53
Contains the BlobReader class definition.
Contains the UniversalDataElement class declaration.
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: UniversalDataReader.h:26
Implementation of a DataElement as a "UniversalDataElement".
Definition: UniversalDataElement.h:29
Contains the DataReader class definition.
A DataAccessor that reads values from the Slate Contains a default dataValue that must not be NULL...
Definition: DataReader.h:30
virtual ~UniversalBlobReader()
Definition: UniversalDataReader.h:78
UniversalDataElement & universalElement_
Definition: UniversalDataReader.h:70
Definition: DataAccessor.h:44
Definition: DataAccessor.h:43
UniversalDataReader(Component *owner, UniversalDataElement &universalElement, const DataValue *defaultValue, bool deleteDefaultValue=true)
Definition: UniversalDataReader.cpp:14
virtual const ElementURI & getUri(void) const
Definition: DataAccessor.cpp:49
A DataValue is an abstract base class for a data value and associated engineering units of the value...
Definition: DataValue.h:35
Definition: UniversalDataReader.h:74
virtual const ElementURI & getUri(void) const
Definition: UniversalDataReader.h:88
UniversalBlobReader(Component *owner, UniversalDataElement &universalElement, const Unit &defaultUnit)
Definition: UniversalDataReader.h:97
virtual bool read(DataValue &readTo)
Definition: UniversalDataReader.h:82
Abstract Base class for software components.
Definition: Component.h:53
bool read(const Unit &unit, unsigned char &readTo)
Get functions.
Definition: DataReader.cpp:82
Definition: BlobReader.h:21
virtual ~UniversalDataReader()
Definition: UniversalDataReader.cpp:30
virtual void requestData(bool requestingData)
Definition: UniversalDataReader.h:50
Code unit that represents a unique name for a DataElement.
Definition: ElementURI.h:27
float getAccuracy(const Unit &unit)
Returns the DataElement's current accuracy (i.e., for the next write)
Definition: UniversalDataReader.cpp:34
Code that represents an engineering unit.
Definition: Unit.h:24
UniversalDataElement & getUniversalElement()
Definition: UniversalDataReader.h:57
RequestStrategy
Definition: DataAccessor.h:41