3#ifndef ICE_OBSERVER_HELPER_H
4#define ICE_OBSERVER_HELPER_H
7#include "Instrumentation.h"
18 std::string getExceptionId(std::exception_ptr);
20 template<
typename T = Ice::Instrumentation::Observer>
class ObserverHelperT
23 using TPtr = std::shared_ptr<T>;
25 ObserverHelperT() =
default;
35 operator bool()
const {
return _observer !=
nullptr; }
37 T* operator->()
const {
return _observer.get(); }
39 void attach(
const TPtr& o)
55 [[nodiscard]] TPtr get()
const {
return _observer; }
57 void adopt(ObserverHelperT& other)
59 _observer = other._observer;
72 void failed(
const std::string& reason)
76 _observer->failed(reason);
84 class ICE_API DispatchObserver :
public ObserverHelperT<Ice::Instrumentation::DispatchObserver>
91 _observer->userException();
95 void reply(std::int32_t size)
99 _observer->reply(size);
104 class ICE_API InvocationObserver :
public ObserverHelperT<Ice::Instrumentation::InvocationObserver>
107 InvocationObserver(
const Ice::ObjectPrx& proxy, std::string_view operation,
const Ice::Context& context);
108 InvocationObserver(Instance* instance, std::string_view operation);
109 InvocationObserver() =
default;
111 void attach(
const Ice::ObjectPrx&, std::string_view operation,
const Ice::Context&);
112 void attach(Instance*, std::string_view operation);
118 _observer->retried();
127 return _observer->getRemoteObserver(con, endpt, requestId, size);
137 return _observer->getCollocatedObserver(adapter, requestId, size);
146 _observer->userException();
151 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.