106 lines
2.8 KiB
C++
106 lines
2.8 KiB
C++
/**
|
|
* @file include/ActivOneApi/Messages/QueryStatusMessage.h
|
|
*
|
|
* @brief Header for the QueryStatusMessage class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_ONE_API_MESSAGES_QUERY_STATUS_MESSAGE_H)
|
|
#define ACTIV_ONE_API_MESSAGES_QUERY_STATUS_MESSAGE_H
|
|
|
|
#include "ActivOneApi/External.h"
|
|
|
|
#include "ActivOneApi/TypeDefinitions.h"
|
|
#include "ActivOneApi/Constants/QueryStates.h"
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! OneApi namespace.
|
|
namespace OneApi
|
|
{
|
|
|
|
//! QueryStatusMessage class.
|
|
class QueryStatusMessage
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Constructor.
|
|
*
|
|
* @param dataSourceId
|
|
* @param query
|
|
* @param state
|
|
* @param statusCode
|
|
*/
|
|
QueryStatusMessage(const DataSourceId dataSourceId, const String &query, const QueryState 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 query in the PENDING state?
|
|
bool IsPending() const;
|
|
|
|
//! Is the query in the COMPLETE state?
|
|
bool IsComplete() const;
|
|
|
|
//! Is the query in the recoverable ERROR state?
|
|
bool IsError() const;
|
|
|
|
//! Is the query in the unrecoverable FAILURE state?
|
|
bool IsFailure() const;
|
|
|
|
const DataSourceId m_dataSourceId; ///< The DataSourceId of this message.
|
|
const String & m_query; ///< The query string.
|
|
const QueryState m_state; ///< The state of the query.
|
|
const StatusCode m_statusCode; ///< The status code for the ERROR and FAILURE states.
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline QueryStatusMessage::QueryStatusMessage(const DataSourceId dataSourceId, const String &query, const QueryState state,
|
|
const StatusCode statusCode) :
|
|
m_dataSourceId(dataSourceId),
|
|
m_query(query),
|
|
m_state(state),
|
|
m_statusCode(statusCode)
|
|
{
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool QueryStatusMessage::IsPending() const
|
|
{
|
|
return QUERY_STATE_PENDING == m_state;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool QueryStatusMessage::IsComplete() const
|
|
{
|
|
return QUERY_STATE_COMPLETE == m_state;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool QueryStatusMessage::IsError() const
|
|
{
|
|
return QUERY_STATE_ERROR == m_state;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline bool QueryStatusMessage::IsFailure() const
|
|
{
|
|
return QUERY_STATE_FAILURE == m_state;
|
|
}
|
|
|
|
} // namespace OneApi
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_ONE_API_MESSAGES_QUERY_STATUS_MESSAGE_H)
|