|
DUDS
|
Distributed Update of Data from Something
|
Extracts data from a Conversation without modifying the Conversation or copying from it. More...
#include <ConversationExtractor.hpp>
Public Member Functions | |
| ConversationExtractor () | |
| Constructs with nothing to extract. More... | |
| ConversationExtractor (const Conversation &con) | |
| Constructs to extract from the given Conversation. More... | |
| ConversationExtractor (const ConversationPart &cp) | |
| Must use functions that specifiy either big or little endian. More... | |
| void | advance (std::size_t bytes) |
| Advance the given number of bytes within the current conversation part. More... | |
| bool | end () const |
| Returns true when all the extractible conversation data has been extracted. More... | |
| void | nextPart () |
| Advances to the next extractible part. More... | |
| template<typename Int > | |
| void | read (Int &i) |
| Reads an integer in the endianess flagged in the conversation part. More... | |
| template<typename Int > | |
| void | read (Int *a, std::size_t count) |
| Reads an array of integers in the endianess flagged in the conversation part. More... | |
| template<typename Int , std::size_t N> | |
| void | read (Int(&a)[N]) |
| Reads an array of integers in the endianess flagged in the conversation part. More... | |
| void | read (char *dest, std::size_t len) |
| Reads by using std::memcpy() to copy data. More... | |
| template<class Cont , typename Iter > | |
| void | read (Cont &cont, Iter &start, std::size_t len) |
| Reads by inserting bytes into a container. More... | |
| template<typename Int > | |
| void | readBe (Int &i) |
| Reads an integer in big-endian form. More... | |
| template<typename Int > | |
| void | readBe (Int *a, std::size_t count) |
| Reads an array of integers in big-endian form. More... | |
| template<typename Int , std::size_t N> | |
| void | readBe (Int(&a)[N]) |
| Reads an array of integers in big-endian form. More... | |
| template<typename Int > | |
| void | readLe (Int &i) |
| Reads an integer in little-endian form. More... | |
| template<typename Int > | |
| void | readLe (Int *a, std::size_t count) |
| Reads an array of integers in little-endian form. More... | |
| template<typename Int , std::size_t N> | |
| void | readLe (Int(&a)[N]) |
| Reads an array of integers in little-endian form. More... | |
| std::size_t | remaining () const |
| Returns the number of bytes remaining in the current conversation part. More... | |
| void | reset () |
| Prepares the object to extract another time from the same Conversation object used previously. More... | |
| void | reset (const Conversation &con) |
| Prepares the object to extract from the given Conversation. More... | |
| void | reset (const ConversationPart &cp) |
| Must use functions that specify either big or little endian. More... | |
Private Member Functions | |
| void | set () |
| Sets internal data to read from the begining of extractible data stored in Conversation c. More... | |
Private Attributes | |
| const Conversation * | c |
| The Conversation object with the parts to read. More... | |
| Conversation::PartVector::const_iterator | piter |
| Iterator to the current part being read. More... | |
| const char * | pos |
| Pointer to the next byte to read. More... | |
| std::size_t | remain |
| The remaining number of bytes to read in the part referenced by piter. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename Int > | |
| ConversationExtractor & | operator>> (ConversationExtractor &ce, Int &i) |
| Extraction operator to read an integer from a Conversation through a ConversationExtractor object. More... | |
| template<typename Int , std::size_t N> | |
| ConversationExtractor & | operator>> (ConversationExtractor &ce, Int(&a)[N]) |
| Extraction operator to read an array of integers from a Conversation through a ConversationExtractor object. More... | |
Extracts data from a Conversation without modifying the Conversation or copying from it.
All conversation parts flagged as extractible (see ConversationPart::MpfExtract) are visited in order. The conversation data is extracted directly from the ConversationPart objects in the originating Conversation object.
Definition at line 49 of file ConversationExtractor.hpp.
|
inline |
Constructs with nothing to extract.
Use reset(const Conversation &) to to extract from a Conversation.
Definition at line 77 of file ConversationExtractor.hpp.
|
inline |
Constructs to extract from the given Conversation.
| con | The Conversation to read. |
Definition at line 82 of file ConversationExtractor.hpp.
|
inline |
Must use functions that specifiy either big or little endian.
Definition at line 88 of file ConversationExtractor.hpp.
| void duds::hardware::interface::ConversationExtractor::advance | ( | std::size_t | bytes | ) |
Advance the given number of bytes within the current conversation part.
This can be used to skip data rather than read all extractible data. If the number of bytes to advance equals the number of bytes left in the part, it will advance to the begining of the next extractible part, or set the end conditions. It cannot be used in a single call to advance to the end of a part and past the begining of the next.
| bytes | The number of bytes to advance within the current part. It must not be greater than the value returned by remaining(). |
| ConversationReadPastEnd | The requested number of bytes is greater than the number left in the current part. The read position is left unchanged. |
Definition at line 35 of file ConversationExtractor.cpp.
Referenced by read().
|
inline |
Returns true when all the extractible conversation data has been extracted.
Definition at line 130 of file ConversationExtractor.hpp.
| void duds::hardware::interface::ConversationExtractor::nextPart | ( | ) |
Advances to the next extractible part.
If there isn't another extractible part, the end conditions will be set and end() will return true.
| ConversationReadPastEnd | The extractor is already at the end. |
| ConversationNotSet | A Conversation was never set. This can happen if the default constructor was used. |
Definition at line 68 of file ConversationExtractor.cpp.
|
inline |
Reads an integer in the endianess flagged in the conversation part.
The integer may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| i | The integer that will receive the value. |
| ConversationReadPastEnd | The integer type is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 234 of file ConversationExtractor.hpp.
Referenced by duds::hardware::interface::operator>>().
|
inline |
Reads an array of integers in the endianess flagged in the conversation part.
The integer array may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| a | The start of the destination integer array. |
| count | The number of elements in the array. |
| ConversationReadPastEnd | The array is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 359 of file ConversationExtractor.hpp.
|
inline |
Reads an array of integers in the endianess flagged in the conversation part.
The integer array may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| N | The number of elements in the array. |
| a | The start of the destination integer array. |
| ConversationReadPastEnd | The array is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 385 of file ConversationExtractor.hpp.
| void duds::hardware::interface::ConversationExtractor::read | ( | char * | dest, |
| std::size_t | len | ||
| ) |
Reads by using std::memcpy() to copy data.
The data may not span conversation parts; it must be contained in a single part.
| dest | The start of the destination buffer. |
| len | The number of bytes to copy. |
| ConversationReadPastEnd | Fewer than len bytes remain in the current part. The read position is left unchanged. |
Definition at line 89 of file ConversationExtractor.cpp.
|
inline |
Reads by inserting bytes into a container.
The data may not span conversation parts; it must be contained in a single part.
| Cont | The destination container type. |
| Iter | The iterator type of the container. |
| cont | The destination container. |
| start | The insertion position for cont. |
| len | The number of bytes to insert into cont. |
| ConversationReadPastEnd | Fewer than len bytes remain in the current part. The read position is left unchanged. |
Definition at line 425 of file ConversationExtractor.hpp.
|
inline |
Reads an integer in big-endian form.
The integer may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| i | The integer that will receive the value. |
| ConversationReadPastEnd | The integer type is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 208 of file ConversationExtractor.hpp.
|
inline |
Reads an array of integers in big-endian form.
The integer array may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| a | The start of the destination integer array. |
| count | The number of elements in the array. |
| ConversationReadPastEnd | The array is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 293 of file ConversationExtractor.hpp.
|
inline |
Reads an array of integers in big-endian form.
The integer array may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| N | The number of elements in the array. |
| a | The start of the destination integer array. |
| ConversationReadPastEnd | The array is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 341 of file ConversationExtractor.hpp.
|
inline |
Reads an integer in little-endian form.
The integer may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| i | The integer that will receive the value. |
| ConversationReadPastEnd | The integer type is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 179 of file ConversationExtractor.hpp.
|
inline |
Reads an array of integers in little-endian form.
The integer array may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| a | The start of the destination integer array. |
| count | The number of elements in the array. |
| ConversationReadPastEnd | The array is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 260 of file ConversationExtractor.hpp.
|
inline |
Reads an array of integers in little-endian form.
The integer array may not span conversation parts; it must be contained in a single part.
| Int | The integer type. |
| N | The number of elements in the array. |
| a | The start of the destination integer array. |
| ConversationReadPastEnd | The array is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 323 of file ConversationExtractor.hpp.
|
inline |
Returns the number of bytes remaining in the current conversation part.
A conversation may have multiple extractible parts, so this value can be different from the total extractible bytes across all parts.
Definition at line 139 of file ConversationExtractor.hpp.
|
inline |
Prepares the object to extract another time from the same Conversation object used previously.
This may be called before extracting all data from the conversation. It allows the same data to be re-extracted, or to extract new data if the Conversation was reused since the last extraction.
| ConversationNotSet | A Conversation was never set. This can happen if the default constructor was used. |
Definition at line 101 of file ConversationExtractor.hpp.
Referenced by duds::hardware::devices::instruments::LSM9DS1AccelGyro::sample(), duds::hardware::devices::instruments::LSM9DS1Mag::sample(), and duds::hardware::devices::instruments::FXOS8700CQ::suspend().
|
inline |
Prepares the object to extract from the given Conversation.
This may be called before extracting all data from a previous conversation, or after the previous conversation no longer exists. It allows a single ConversationExtractor object to be used multiple times, and it can make use of an extractor made using the default constructor.
| con | The conversation to extract. |
Definition at line 114 of file ConversationExtractor.hpp.
|
inline |
Must use functions that specify either big or little endian.
Definition at line 121 of file ConversationExtractor.hpp.
|
private |
Sets internal data to read from the begining of extractible data stored in Conversation c.
Definition at line 15 of file ConversationExtractor.cpp.
|
related |
Extraction operator to read an integer from a Conversation through a ConversationExtractor object.
The endianess is specified by the part's MpfBigendian flag.
| Int | The integer type. |
| ce | The source ConversationExtractor object. |
| i | The integer to that will receive the extracted value. |
| ConversationReadPastEnd | The integer type is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 450 of file ConversationExtractor.hpp.
|
related |
Extraction operator to read an array of integers from a Conversation through a ConversationExtractor object.
The endianess is specified by the part's MpfBigendian flag.
| Int | The integer type. |
| N | The number of elements in the array. |
| ce | The source ConversationExtractor object. |
| a | The start of the destination integer array. |
| ConversationReadPastEnd | The integer type is too large to fit in the remaining bytes of the current part. The read position is left unchanged. |
Definition at line 472 of file ConversationExtractor.hpp.
|
private |
The Conversation object with the parts to read.
Definition at line 57 of file ConversationExtractor.hpp.
Referenced by advance(), nextPart(), and set().
|
private |
Iterator to the current part being read.
Definition at line 53 of file ConversationExtractor.hpp.
Referenced by advance(), nextPart(), and set().
|
private |
Pointer to the next byte to read.
Definition at line 61 of file ConversationExtractor.hpp.
Referenced by advance(), nextPart(), read(), and set().
|
private |
The remaining number of bytes to read in the part referenced by piter.
Definition at line 65 of file ConversationExtractor.hpp.
Referenced by advance(), nextPart(), read(), and set().