9#include <libtrap/trap.h>
19 , m_sendEoFonExit(
true)
20 , m_isInitialized(
false)
54 throw std::runtime_error(
55 "UnirecOutputInterface::send() has failed. Trap interface is not initialized.");
58 throw std::runtime_error(
59 "UnirecOutputInterface::send() has failed. Trap interface is terminated.");
62 throw std::runtime_error(
63 "UnirecOutputInterface::send() has failed. Interface ID out of range.");
65 throw std::runtime_error(
66 "UnirecOutputInterface::send() has failed. Return code: " + std::to_string(
errorCode)
92 char dummy[1] = { 0 };
99 throw std::runtime_error(
100 "UnirecOutputInterface::changeTemplate() has failed. Template fields could not be "
108 throw std::runtime_error(
109 "UnirecOutputInterface::changeTemplate() has failed. Field specs could not be "
115 throw std::runtime_error(
116 "UnirecOutputInterface::changeTemplate() has failed. Output template could not be "
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.
UnirecOutputInterface(uint8_t interfaceID)
UnirecRecord m_unirecRecord
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.
ur_template_t * m_template
bool send(UnirecRecord &unirecRecord) const
Sends a UniRec record through the Trap interface.
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.
Provides a view into a UniRec record.
A class for working with UniRec records and their fields.
#define ur_create_output_template(ifc, fields, errstr)
Create UniRec template and set it to output interface Creates UniRec template (same like ur_create_te...
void ur_free_template(ur_template_t *tmplt)
Destroy UniRec template Free all memory allocated for a template created previously by ur_create_temp...
char * ur_ifc_data_fmt_to_field_names(const char *ifc_data_fmt)
Parses field names from data format Function parses field names from data format and returns pointer ...
int ur_define_set_of_fields(const char *ifc_data_fmt)
Define set of new UniRec fields Define new UniRec fields at run-time. It adds new fields into existin...
constexpr ur_field_type_t getExpectedUnirecType()
Determines the expected UniRec field type for a given C++ type T.
Defines the UnirecOutputInterface class.