SObjectizer  5.5
Namespaces | Classes | Enumerations | Functions
so_5::enveloped_msg Namespace Reference

Namespaces

 anonymous_namespace{enveloped_msg.cpp}
 
 impl
 

Classes

class  envelope_t
 An interface of envelope with some message/signal inside. More...
 
class  handler_invoker_t
 An extended version of handling_context which can be used for calling event handler. More...
 
class  payload_info_t
 An information about payload inside envelope. More...
 

Enumerations

enum  access_context_t { access_context_t::handler_found, access_context_t::transformation, access_context_t::inspection }
 Information about context on that enveloped message is handled. More...
 

Functions

SO_5_NODISCARD SO_5_FUNC optional< payload_info_textract_payload_for_message_transformation ( const message_ref_t &envelope)
 Helper function for extraction of a payload from enveloped message. More...
 
SO_5_NODISCARD SO_5_FUNC optional< message_ref_tmessage_to_be_inspected (const message_ref_t &msg_or_envelope)
 Helper function for extraction of a payload from enveloped message. More...
 

Enumeration Type Documentation

◆ access_context_t

Information about context on that enveloped message is handled.

Since
v.5.5.23
Enumerator
handler_found 

Enveloped message is delivered to a receiver and the payload is necessary for calling event handler.

transformation 

The content of enveloped message should be transformed to another representation. For example it can be necessary for limit_then_transform overload reaction.

inspection 

The content of enveloped message should be analyzed for the further delivery. For example it can be necessary for delivery filters.

Function Documentation

◆ extract_payload_for_message_transformation()

SO_5_NODISCARD SO_5_FUNC optional< payload_info_t > so_5::enveloped_msg::extract_payload_for_message_transformation ( const message_ref_t envelope)

Helper function for extraction of a payload from enveloped message.

Extraction of a payload from an envelope is not an easy task. It is necessary to create an implementation of handler_invoker_t interface and pass it to envelope_t::transformation_hook() method. This implementation should check type of the payload: if it is another envelope then next call to transformation_hook() should be done and so on.

Because of that extraction of the payload from an envelope is a boring task. This helper function preforms all described actions an returns optional with payload inside (if the payload available).

Attention
Argument envelope should not be nullptr.
Since
v.5.5.23
Parameters
envelopeEnvelope with message inside.

◆ message_to_be_inspected()

SO_5_NODISCARD SO_5_FUNC optional< message_ref_t > so_5::enveloped_msg::message_to_be_inspected ( const message_ref_t msg_or_envelope)

Helper function for extraction of a payload from enveloped message.

This function checks the kind of msg_or_envelope. If this is an enveloped message message_to_be_inspected() will try to extract the payload and return it. In that case an empty optional object can be returned.

If msg_or_envelope is not an envelope then msg_or_envelope is returned as a result.

Since
v.5.5.23