Packet that contains data sent by a signal. The data can be either explicit, or implicit.
More...
template<typename InterfaceType>
class GenericDataPacketPtr< InterfaceType >
Packet that contains data sent by a signal. The data can be either explicit, or implicit.
Explicit data is contained within a signal's buffer, accessible through getRawData
, while implicit packets do not carry any data. Their values are calculated given a rule, packet offset, and the index of a sample within the data buffer.
To obtain implicitly calculated, or scaled values, getData
should be used. The data descriptor and sample count provide information about the type and amount of data available at the obtained address.
|
daq::DataDescriptorPtr | getDataDescriptor () const |
| Gets the signal descriptor of the signal that sent the packet at the time of sending. More...
|
|
daq::SizeT | getSampleCount () const |
| Gets the number of samples in the packet. More...
|
|
daq::NumberPtr | getOffset () const |
| Gets current packet offset. This offset is later applied to the data rule used by a signal to calculate actual data value. This value is usually a time or other domain value. Packet offset is particularly useful when one wants to transfer a gap in otherwise equidistant samples. If we have a linear data rule, defined by equation f(x) = k*x + n, then the data value will be calculated by the equation g(x) = offset + f(x). More...
|
|
void * | getData () const |
| Gets the calculated/scaled data address of the packet. More...
|
|
void * | getRawData () const |
| Gets a pointer to the raw packet data. nullptr if the signal's data rule is implicit. More...
|
|
daq::SizeT | getDataSize () const |
| Gets size of data buffer in bytes. More...
|
|
daq::SizeT | getRawDataSize () const |
| Gets size of raw data buffer in bytes. More...
|
|
daq::GenericDataPacketPtr< daq::IDataPacket > | getDomainPacket () const |
| Gets the associated domain Data packet. More...
|
|
daq::Int | getPacketId () const |
| Gets the unique packet id. More...
|
|
daq::BaseObjectPtr | getLastValue (const daq::TypeManagerPtr &typeManager=nullptr) const |
| Gets the data packet last value. More...
|
|
daq::BaseObjectPtr | getValueByIndex (daq::SizeT index, const daq::TypeManagerPtr &typeManager=nullptr) const |
| Gets the data packet last value. More...
|
|
Gets the calculated/scaled data address of the packet.
- Returns
- The address of the data.
getData
uses the packet's data descriptor to calculate the values as follows:
- If the data rule is implicit, it uses the packet offset and sample count to calculate the data according to the rule.
- If the data rule is explicit:
- If the data is a Struct, it returns a pointer to the raw data.
- If no Post scaling is defined, it simply returns a pointer to the raw data.
- If the Post scaling is defined, it scales the data and returns a pointer to the scaled data.
The data should be cast to the appropriate type, as defined by the data descriptor, and read while keeping the data dimensions in mind.
daq::BaseObjectPtr getLastValue |
( |
const daq::TypeManagerPtr & |
typeManager = nullptr | ) |
const |
|
inline |
Gets the data packet last value.
- Returns
- The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function.
- Parameters
-
If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension.
daq::BaseObjectPtr getValueByIndex |
( |
daq::SizeT |
index, |
|
|
const daq::TypeManagerPtr & |
typeManager = nullptr |
|
) |
| const |
|
inline |
Gets the data packet last value.
- Returns
- The IBaseObject value can be a nullptr if there is no value, or if the data type is not supported by the function.
- Parameters
-
[in] | index | Index of the sample to obtain. |
| typeManager | Optional ITypeManager value can be provided to enable getLastValue for IStruct. |
If a value is assigned, it can be cast based on the signal description to IFloat if the type is Float32 or Float64, to IInteger if the type is Int8 through Int64 or UInt8 through UInt64, to IComplexNumber if the type is ComplexFloat32 or ComplexFloat64, to IRange if the type is RangeInt64, to IStruct if the type is Struct, and to IList of the forementioned types if there is exactly one dimension.