3#ifndef ICE_OBSERVER_HELPER_H
4#define ICE_OBSERVER_HELPER_H
7#include "Instrumentation.h"
14# pragma warning(disable : 4251)
24 std::string getExceptionId(std::exception_ptr);
26 template<
typename T = Ice::Instrumentation::Observer>
class ObserverHelperT
29 using TPtr = std::shared_ptr<T>;
31 ObserverHelperT() =
default;
41 operator bool()
const {
return _observer !=
nullptr; }
43 T* operator->()
const {
return _observer.get(); }
45 void attach(
const TPtr& o)
61 [[nodiscard]] TPtr get()
const {
return _observer; }
63 void adopt(ObserverHelperT& other)
65 _observer = other._observer;
78 void failed(
const std::string& reason)
82 _observer->failed(reason);
90 class ICE_API DispatchObserver :
public ObserverHelperT<Ice::Instrumentation::DispatchObserver>
97 _observer->userException();
101 void reply(std::int32_t size)
105 _observer->reply(size);
110 class ICE_API InvocationObserver :
public ObserverHelperT<Ice::Instrumentation::InvocationObserver>
113 InvocationObserver(
const Ice::ObjectPrx& proxy, std::string_view operation,
const Ice::Context& context);
114 InvocationObserver(Instance* instance, std::string_view operation);
115 InvocationObserver() =
default;
117 void attach(
const Ice::ObjectPrx&, std::string_view operation,
const Ice::Context&);
118 void attach(Instance*, std::string_view operation);
124 _observer->retried();
133 return _observer->getRemoteObserver(con, endpt, requestId, size);
143 return _observer->getCollocatedObserver(adapter, requestId, size);
152 _observer->userException();
157 using ObserverHelperT<Ice::Instrumentation::InvocationObserver>::attach;
The base class for all Ice proxies.
std::shared_ptr< ChildInvocationObserver > ChildInvocationObserverPtr
A shared pointer to a ChildInvocationObserver.
std::shared_ptr< ConnectionInfo > ConnectionInfoPtr
A shared pointer to a ConnectionInfo.
std::shared_ptr< ObjectAdapter > ObjectAdapterPtr
A shared pointer to an ObjectAdapter.
std::shared_ptr< Endpoint > EndpointPtr
A shared pointer to an Endpoint.
std::map< std::string, std::string, std::less<> > Context
Represents additional information carried by an Ice request.