RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rtctk::componentFramework::detail::MeasureContext Class Reference

Holds context necessary for processing a measure request to completion. More...

#include <rtctk/componentFramework/measurable.hpp>

Public Member Functions

 MeasureContext (const rad::cii::Request< std::string, std::string > &request)
 Construct context with provided request.
 
 MeasureContext (MeasureContext &&) noexcept=default
 
const JsonPayloadGetArg () const noexcept
 
void SetResult (const JsonPayload &result)
 Sets serialized reply from JSON payload, but does not send it.
 
void SendReply () noexcept
 Send reply using result set with SetResult().
 
void SendErrorReply (std::exception_ptr eptr) noexcept
 If reply is pending, set exception to the provided value.
 

Detailed Description

Holds context necessary for processing a measure request to completion.

It is meant to encapsulate the life time of a request and provides methods to set result with deferred sending (mainly to trigger any serialization error in the activity thread) as well as sending exceptional replies.

See also
rtctk::componentFramework::Measurable

Constructor & Destructor Documentation

◆ MeasureContext() [1/2]

rtctk::componentFramework::detail::MeasureContext::MeasureContext ( const rad::cii::Request< std::string, std::string > & request)
inlineexplicit

Construct context with provided request.

Parameters
requestcontaining JSON encoded string with arguments.
Exceptions
JsonPayload::parse_errorif parsing fails.

◆ MeasureContext() [2/2]

rtctk::componentFramework::detail::MeasureContext::MeasureContext ( MeasureContext && )
defaultnoexcept

Member Function Documentation

◆ GetArg()

const JsonPayload & rtctk::componentFramework::detail::MeasureContext::GetArg ( ) const
inlinenoexcept

◆ SendErrorReply()

void rtctk::componentFramework::detail::MeasureContext::SendErrorReply ( std::exception_ptr eptr)
inlinenoexcept

If reply is pending, set exception to the provided value.

◆ SendReply()

void rtctk::componentFramework::detail::MeasureContext::SendReply ( )
inlinenoexcept

Send reply using result set with SetResult().

Exceptions
boost::promise_already_satisfiedif reply has already been set.

◆ SetResult()

void rtctk::componentFramework::detail::MeasureContext::SetResult ( const JsonPayload & result)
inline

Sets serialized reply from JSON payload, but does not send it.

Parameters
resultJSON result that will be serialized and stored as a string.
Exceptions
JsonPayload::exceptionif reply cannot be serialized to JSON.

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