ONE - On-device Neural Engine
Loading...
Searching...
No Matches
hermes::MessageBuffer Class Referencefinal

A buffer for a message under construction. More...

#include <MessageBuffer.h>

Public Member Functions

 MessageBuffer (MessageBus *)
 
 MessageBuffer (MessageBus *bus, SeverityCategory severity)
 
 ~MessageBuffer ()
 
std::ostream & os (void)
 

Detailed Description

A buffer for a message under construction.

MessageBuffer will post the buffered message on destruction.

Definition at line 34 of file MessageBuffer.h.

Constructor & Destructor Documentation

◆ MessageBuffer() [1/2]

hermes::MessageBuffer::MessageBuffer ( MessageBus bus)

Definition at line 24 of file MessageBuffer.cpp.

24 : _bus{bus}
25{
26 // DO NOTHING
27}

◆ MessageBuffer() [2/2]

hermes::MessageBuffer::MessageBuffer ( MessageBus bus,
SeverityCategory  severity 
)

Definition at line 29 of file MessageBuffer.cpp.

30 : _bus{bus}, _severity{severity}
31{
32 // DO NOTHING
33}

◆ ~MessageBuffer()

hermes::MessageBuffer::~MessageBuffer ( )

Definition at line 35 of file MessageBuffer.cpp.

36{
37 // NOTE The current implementation is unsafe as it may throw an excpetion.
38 // TODO Find a better safe implementation.
39 auto msg = std::make_unique<Message>();
40
41 msg->text(std::make_unique<MessageText>(_ss), _severity);
42
43 _bus->post(std::move(msg));
44}
virtual void post(std::unique_ptr< Message > &&msg)=0

References hermes::MessageBus::post().

Member Function Documentation

◆ os()

std::ostream & hermes::MessageBuffer::os ( void  )
inline

Definition at line 42 of file MessageBuffer.h.

42{ return _ss; }

The documentation for this class was generated from the following files: