Files

123 lines
3.4 KiB
C++

/**
* @file include/ActivOneApi/ITopicQueryHandler.h
*
* @brief Header for the ITopicQueryHandler class.
*/
#if (!defined ACTIV_ONE_API_ITOPIC_QUERY_HANDLER_H)
#define ACTIV_ONE_API_ITOPIC_QUERY_HANDLER_H
#include "ActivOneApi/External.h"
#include "ActivOneApi/TypeDefinitions.h"
#include "ActivOneApi/Constants/DataSourceIds.h"
//! Activ namespace.
namespace Activ
{
//! OneApi namespace.
namespace OneApi
{
class Context;
class TopicId;
//! Topic query symbol pattern (see Session::Query()).
class TopicQuerySymbolPattern
{
public:
//! Default constructor.
TopicQuerySymbolPattern();
DataSourceId m_dataSourceId; ///< The data source.
TableNo m_tableNumber; ///< The table number.
String m_symbolPattern; ///< The symbol pattern.
};
// ---------------------------------------------------------------------------------------------------------------------------------
inline TopicQuerySymbolPattern::TopicQuerySymbolPattern() :
m_dataSourceId(DATA_SOURCE_UNDEFINED),
m_tableNumber(TABLE_NO_UNDEFINED)
{
}
// ---------------------------------------------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------------------------------------
//! Topic query handler interface class.
class ITopicQueryHandler
{
public:
//! Destructor.
virtual ~ITopicQueryHandler() { }
/**
* @brief Callback on topic query start.
*
* The initial topic query synchronization has started for a new query or due to reconnect/failover.
*
* @param context the context for this event.
*/
virtual void OnTopicQueryStart(const Context &context) { }
/**
* @brief Callback on topic added.
*
* Note that the user can move the topic.
*
* @param topic the topic found or added.
* @param context the context for this event.
*/
virtual void OnTopicQueryAdd(Topic &topic, const Context &context) { }
/**
* @brief Callback on topic removed.
*
* @param topicId id of the topic that has been deleted.
* @param context the context for this event.
*/
virtual void OnTopicQueryRemove(const TopicId &topicId, const Context &context) { }
/**
* @brief Callback on topic query completion.
*
* The initial topic query synchronization is complete. Updates will continue to be received for new, deleted and updated
* topics.
*
* @param context the context for this event.
*/
virtual void OnTopicQueryComplete(const Context &context) { }
/**
* @brief Callback on topic query error.
*
* The topic query synchronization has failed, probably due to a service disconnect. Synchronization will restart on reconnect.
*
* Status code values:
* STATUS_CODE_NOT_CONNECTED if no connected resolver available for query.
*
* @param statusCode
* @param context the context for this event.
*/
virtual void OnTopicQueryError(const StatusCode statusCode, const Context &context) { }
/**
* @brief Callback on failure to create the topic query.
*
* The topic query has failed and will not recover, the handle for this query will no longer be valid once this callback is
* complete.
*
* @param statusCode
* @param context the context for this event.
*/
virtual void OnTopicQueryFailure(const StatusCode statusCode, const Context &context) { }
};
} // namespace OneApi
} // namespace Activ
#endif // (!defined ACTIV_ONE_API_ITOPIC_QUERY_HANDLER_H)