3#ifndef ICE_OBSERVER_HELPER_H
4#define ICE_OBSERVER_HELPER_H
7#include "Instrumentation.h"
13# pragma warning(disable : 4251)
23 std::string getExceptionId(std::exception_ptr);
25 template<
typename T = Ice::Instrumentation::Observer>
class ObserverHelperT
28 using TPtr = std::shared_ptr<T>;
30 ObserverHelperT() =
default;
40 operator bool()
const {
return _observer !=
nullptr; }
42 T* operator->()
const {
return _observer.get(); }
44 void attach(
const TPtr& o)
60 [[nodiscard]] TPtr get()
const {
return _observer; }
62 void adopt(ObserverHelperT& other)
64 _observer = other._observer;
77 void failed(
const std::string& reason)
81 _observer->failed(reason);
89 class ICE_API DispatchObserver :
public ObserverHelperT<Ice::Instrumentation::DispatchObserver>
96 _observer->userException();
100 void reply(std::int32_t size)
104 _observer->reply(size);
109 class ICE_API InvocationObserver :
public ObserverHelperT<Ice::Instrumentation::InvocationObserver>
112 InvocationObserver(
const Ice::ObjectPrx& proxy, std::string_view operation,
const Ice::Context& context);
113 InvocationObserver(Instance* instance, std::string_view operation);
114 InvocationObserver() =
default;
116 void attach(
const Ice::ObjectPrx&, std::string_view operation,
const Ice::Context&);
117 void attach(Instance*, std::string_view operation);
123 _observer->retried();
132 return _observer->getRemoteObserver(con, endpt, requestId, size);
142 return _observer->getCollocatedObserver(adapter, requestId, size);
151 _observer->userException();
156 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.