69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
/**
|
|
* @file include/ActivOneApi/Deprecated/ISubscriptionHandler.h
|
|
*
|
|
* @brief Header for the deprecated ISubscriptionHandler class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_ONE_API_DEPRECATED_ISUBSCRIPTION_HANDLER_H)
|
|
#define ACTIV_ONE_API_DEPRECATED_ISUBSCRIPTION_HANDLER_H
|
|
|
|
#include "ActivOneApi/External.h"
|
|
|
|
#include "ActivOneApi/ISubscriptionHandler.h"
|
|
#include "ActivOneApi/Messages/SubscriptionStatusMessage.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! OneApi namespace.
|
|
namespace OneApi
|
|
{
|
|
|
|
//! Deprecated namespace.
|
|
namespace Deprecated
|
|
{
|
|
|
|
//! Deprecated subscription handler interface (see Session::Subscribe()).
|
|
class ISubscriptionHandler : public OneApi::ISubscriptionHandler
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Callback on error.
|
|
*
|
|
* The subscription has failed, probably due to a service disconnect. The subscription will resume on reconnect.
|
|
*
|
|
* @param statusCode
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionError(const StatusCode statusCode, const Context &context) { }
|
|
|
|
/**
|
|
* @brief Callback on failure to create the subscription.
|
|
*
|
|
* The subscription has failed and will not recover.
|
|
*
|
|
* @param statusCode
|
|
* @param context the context for this event.
|
|
*/
|
|
virtual void OnSubscriptionFailure(const StatusCode statusCode, const Context &context) { }
|
|
|
|
private:
|
|
// Override the new OnSubscriptionStatus() to provide the old behaviour.
|
|
virtual void OnSubscriptionStatus(const SubscriptionStatusMessage &message, const Context &context) ACTIV_OVERRIDE
|
|
{
|
|
if (message.IsError())
|
|
OnSubscriptionError(message.m_statusCode, context);
|
|
else if (message.IsFailure())
|
|
OnSubscriptionFailure(message.m_statusCode, context);
|
|
}
|
|
};
|
|
|
|
} // namespace Deprecated
|
|
|
|
} // namespace OneApi
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_ONE_API_DEPRECATED_ISUBSCRIPTION_HANDLER_H)
|