UniRec 3.3.2
|
A class that provides an interface for receiving data in the Unirec format using the TRAP library. More...
#include <inputInterface.hpp>
Public Member Functions | |
std::optional< UnirecRecordView > | receive () |
Receives data from the interface and returns an optional UnirecRecordView object. | |
void | changeTemplate () |
Changes the Unirec template used by the input interface. | |
void | setRequieredFormat (const std::string &templateSpecification) |
Sets the required Unirec format specification. | |
void | setTimeout (int timeout) |
Sets the receive timeout for the interface. This method sets the timeout for receiving UniRec records on the interface. If no record is received within the specified timeout, the receive method returns an empty optional. | |
~UnirecInputInterface () | |
Destructor for UnirecInputInterface class. This method frees the memory used by the Unirec template. | |
ur_template_t * | getTemplate () const noexcept |
Gets the Unirec template used by the input interface. | |
InputInteraceStats | getInputInterfaceStats () const |
Gets the statistics for the input interface. | |
Private Member Functions | |
UnirecInputInterface (uint8_t interfaceID) | |
void | handleReceiveErrorCodes (int errorCode) const |
void | changeInternalTemplate (const std::string &templateSpecification) |
Private Attributes | |
ur_template_t * | m_template = nullptr |
uint8_t | m_interfaceID |
uint64_t | m_sequenceNumber |
const void * | m_prioritizedDataPointer |
Friends | |
class | Unirec |
A class that provides an interface for receiving data in the Unirec format using the TRAP library.
Definition at line 25 of file inputInterface.hpp.
Nemea::UnirecInputInterface::~UnirecInputInterface | ( | ) |
Destructor for UnirecInputInterface class. This method frees the memory used by the Unirec template.
Definition at line 15 of file inputInterface.cpp.
|
private |
Definition at line 20 of file inputInterface.cpp.
|
private |
Definition at line 105 of file inputInterface.cpp.
void Nemea::UnirecInputInterface::changeTemplate | ( | ) |
Changes the Unirec template used by the input interface.
This method should be called every time when the FormatChangeException is thrown.
This method changes the UniRec record template used for decoding records received on the interface.
std::runtime_error | if the data format was not loaded or the template could not be edited. |
Definition at line 90 of file inputInterface.cpp.
InputInteraceStats Nemea::UnirecInputInterface::getInputInterfaceStats | ( | ) | const |
Gets the statistics for the input interface.
This method returns the actual statistics for the input interface.
Definition at line 125 of file inputInterface.cpp.
|
inlinenoexcept |
Gets the Unirec template used by the input interface.
This method returns a pointer to the Unirec template used by the input interface.
Definition at line 90 of file inputInterface.hpp.
Definition at line 56 of file inputInterface.cpp.
std::optional< UnirecRecordView > Nemea::UnirecInputInterface::receive | ( | ) |
Receives data from the interface and returns an optional UnirecRecordView object.
If data is received successfully, an UnirecRecordView object is returned that provides a view into the received data. If no data is available or a timeout occurs, std::nullopt is returned.
EoFException | if the end of the input stream is reached. |
FormatChangeException | if the record format changes. |
Definition at line 28 of file inputInterface.cpp.
Sets the required Unirec format specification.
This method sets the required Unirec format specification for the input interface. Format: "uint64 BYTES, string SNI" (unirecDataType NAME)
templateSpecification | The required Unirec format specification. |
std::runtime_error | if the required format could not be set. |
Definition at line 78 of file inputInterface.cpp.
Sets the receive timeout for the interface. This method sets the timeout for receiving UniRec records on the interface. If no record is received within the specified timeout, the receive method returns an empty optional.
timeout | The timeout value in microseconds.
|
Definition at line 120 of file inputInterface.cpp.
Definition at line 111 of file inputInterface.hpp.
|
private |
Definition at line 107 of file inputInterface.hpp.
Definition at line 109 of file inputInterface.hpp.
|
private |
Definition at line 108 of file inputInterface.hpp.
|
private |
Definition at line 106 of file inputInterface.hpp.