UniRec 3.3.2
Loading...
Searching...
No Matches
outputInterface.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include "unirecRecord.hpp"
15#include "unirecRecordView.hpp"
16
17#include <string>
18#include <unirec/unirec.h>
19
20namespace Nemea {
25public:
33 bool send(UnirecRecord& unirecRecord) const;
34
42 bool send(UnirecRecordView& unirecRecordView) const;
43
47 void sendFlush() const;
48
59 void setTimeout(int timeout);
60
67 void setAutoflushTimeout(int timeout);
68
77 void changeTemplate(const std::string& templateFields = "");
78
82 void doNotsendEoFOnExit();
83
91 ur_template_t* getTemplate() const noexcept { return m_template; }
92
100
117
130 UnirecRecord createUnirecRecord(size_t maxVariableFieldsSize = UR_MAX_SIZE);
131
132private:
133 UnirecOutputInterface(uint8_t interfaceID);
134 bool handleSendErrorCodes(int errorCode) const;
135 void sendEoF() const;
136
142
143 friend class Unirec;
144};
145
146} // namespace Nemea
A class for sending UniRec records through a Trap interface.
bool handleSendErrorCodes(int errorCode) const
~UnirecOutputInterface()
Destructor for the UnirecOutputInterface class.
void sendFlush() const
Flushes any pending UniRec records in the Trap interface.
void setTimeout(int timeout)
Sets the send timeout for the Trap interface.
void doNotsendEoFOnExit()
Disables sending an end-of-file marker on exit.
UnirecRecord createUnirecRecord(size_t maxVariableFieldsSize=UR_MAX_SIZE)
Creates a new UniRec record with the specified maximum variable fields size.
bool send(UnirecRecord &unirecRecord) const
Sends a UniRec record through the Trap interface.
UnirecRecord & getUnirecRecord() noexcept
Gets a reference to the pre-allocated UniRec record for efficient use.
void changeTemplate(const std::string &templateFields="")
Changes the UniRec template for the Trap interface.
void setAutoflushTimeout(int timeout)
Sets the autoflush timeout for the Trap interface.
ur_template_t * getTemplate() const noexcept
Gets the Unirec template used by the output interface.
Provides a view into a UniRec record.
A class for working with UniRec records and their fields.
#define UR_MAX_SIZE
Definition unirec.h:1013
Provides a view into a UniRec record.
Defines the UnirecRecord class.
Definition of UniRec structures and functions.
UniRec template. It contains a table mapping a field to its position in an UniRec record.
Definition unirec.h:191