UniRec  3.3.2
inputInterface.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "interfaceStats.hpp"
12 #include "unirecException.hpp"
13 #include "unirecRecordView.hpp"
14 
15 #include <optional>
16 #include <string>
17 #include <unirec/unirec.h>
18 
19 namespace Nemea {
20 
26 public:
38  std::optional<UnirecRecordView> receive();
39 
51  void changeTemplate();
52 
62  void setRequieredFormat(const std::string& templateSpecification);
63 
75  void setTimeout(int timeout);
76 
82 
90  ur_template_t* getTemplate() const noexcept { return m_template; }
91 
100 
101 private:
102  UnirecInputInterface(uint8_t interfaceID);
103  void handleReceiveErrorCodes(int errorCode) const;
104  void changeInternalTemplate(const std::string& templateSpecification);
105 
107  uint8_t m_interfaceID;
110 
111  friend class Unirec;
112 };
113 
114 } // namespace Nemea
Defines custom exception classes.
UnirecInputInterface(uint8_t interfaceID)
std::optional< UnirecRecordView > receive()
Receives data from the interface and returns an optional UnirecRecordView object. ...
InputInteraceStats getInputInterfaceStats() const
Gets the statistics for the input interface.
A class that provides an interface for receiving data in the Unirec format using the TRAP library...
void handleReceiveErrorCodes(int errorCode) const
ur_template_t * getTemplate() const noexcept
Gets the Unirec template used by the input interface.
void changeTemplate()
Changes the Unirec template used by the input interface.
This file contains the declarations of the interface stats structure.
Structure to store statistics related to an input interface.
void setTimeout(int timeout)
Sets the receive timeout for the interface. This method sets the timeout for receiving UniRec records...
void changeInternalTemplate(const std::string &templateSpecification)
Provides a view into a UniRec record.
void setRequieredFormat(const std::string &templateSpecification)
Sets the required Unirec format specification.
Definition of UniRec structures and functions.
~UnirecInputInterface()
Destructor for UnirecInputInterface class. This method frees the memory used by the Unirec template...
UniRec template. It contains a table mapping a field to its position in an UniRec record...
Definition: unirec.h:191