110 lines
3.3 KiB
C++
110 lines
3.3 KiB
C++
/**
|
|
* @file include/ActivOneApi/Messages/SubscriptionStatusMessage.h
|
|
*
|
|
* @brief Header for the SubscriptionStatusMessage class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_ONE_API_MESSAGES_SUBSCRIPTION_STATUS_MESSAGE_H)
|
|
#define ACTIV_ONE_API_MESSAGES_SUBSCRIPTION_STATUS_MESSAGE_H
|
|
|
|
#include "ActivOneApi/External.h"
|
|
|
|
#include "ActivOneApi/TypeDefinitions.h"
|
|
#include "ActivOneApi/Constants/SubscriptionStates.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! OneApi namespace.
|
|
namespace OneApi
|
|
{
|
|
|
|
//! SubscriptionStatusMessage class.
|
|
class SubscriptionStatusMessage : Boost::noncopyable
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Constructor.
|
|
*
|
|
* @param dataSourceId
|
|
* @param symbologyId
|
|
* @param request
|
|
* @param state
|
|
* @param statusCode
|
|
*/
|
|
SubscriptionStatusMessage(const DataSourceId dataSourceId, const SymbologyId symbologyId, const String &request,
|
|
const SubscriptionState state, const StatusCode statusCode);
|
|
|
|
/**
|
|
* @brief Convert to a string.
|
|
*
|
|
* @return A long form string representation of the message contents.
|
|
*/
|
|
ACTIV_ONE_API String ToString() const;
|
|
|
|
//! Is the subscription in the PENDING state?
|
|
bool IsPending() const;
|
|
|
|
//! Is the subscription in the COMPLETE state?
|
|
bool IsComplete() const;
|
|
|
|
//! Is the subscription in the recoverable ERROR state?
|
|
bool IsError() const;
|
|
|
|
//! Is the subscription in the unrecoverable FAILURE state?
|
|
bool IsFailure() const;
|
|
|
|
const DataSourceId m_dataSourceId; ///< The DataSourceId of this message.
|
|
const SymbologyId m_symbologyId; ///< The SymbologyId of @a m_request if applicable.
|
|
const String & m_request; ///< The requested symbol or query.
|
|
const SubscriptionState m_state; ///< The state of the subscription.
|
|
const StatusCode m_statusCode; ///< The status code for the ERROR and FAILURE states.
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline SubscriptionStatusMessage::SubscriptionStatusMessage(const DataSourceId dataSourceId, const SymbologyId symbologyId,
|
|
const String &request, const SubscriptionState state, const StatusCode statusCode) :
|
|
m_dataSourceId(dataSourceId),
|
|
m_symbologyId(symbologyId),
|
|
m_request(request),
|
|
m_state(state),
|
|
m_statusCode(statusCode)
|
|
{
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool SubscriptionStatusMessage::IsPending() const
|
|
{
|
|
return SUBSCRIPTION_STATE_PENDING == m_state;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool SubscriptionStatusMessage::IsComplete() const
|
|
{
|
|
return SUBSCRIPTION_STATE_COMPLETE == m_state;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool SubscriptionStatusMessage::IsError() const
|
|
{
|
|
return SUBSCRIPTION_STATE_ERROR == m_state;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool SubscriptionStatusMessage::IsFailure() const
|
|
{
|
|
return SUBSCRIPTION_STATE_FAILURE == m_state;
|
|
}
|
|
|
|
} // namespace OneApi
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_ONE_API_MESSAGES_SUBSCRIPTION_STATUS_MESSAGE_H)
|