using ThomsonReuters.RFA.Common;
// ReSharper disable once CheckNamespace
namespace Ariel.RecordServerLibrary.RFAFanoutEngine
{
///
/// Our, local, version of the ThompsonReuters.RFA.Common.RespStatus, which doesn't appear to be safe to store for a while.
/// I think the problem is to do with cached status values losing their unmanaged storeage when the client connection goes away,
/// but we keep the status because more than one client was watching the RIC.
///
public class ETXRespStatus
{
private readonly byte _statusCode;
private readonly RespStatus.DataStateEnum _dataState;
private readonly RespStatus.StreamStateEnum _streamState;
private readonly string _statusText;
///
/// Creates a local (completely managed) clone of a ThompsonReuters.RFA.Common.RespStatus
///
///
public ETXRespStatus(RespStatus status)
{
_statusCode = status.StatusCode;
_dataState = status.DataState;
_streamState = status.StreamState;
_statusText = status.ToString();
}
///
/// Returns a ThompsonReuters.RFA.Common.RespStatus made from the stored fields in this ETXRespStatus.
///
///
public RespStatus MakeRespStatus()
{
#pragma warning disable S125
// This snippet from the RFA C++ documentation on how to create your own RespStatus to use in a RespMsg, which is what we do.
//rfa::common::RespStatus respStatus;
//respStatus.setStreamState(rfa::common::RespStatus::OpenEnum );
//respStatus.setDataState(rfa::common::RespStatus::OkEnum );
//respStatus.setStatusCode(rfa::common::RespStatus::NoneEnum );
//rfa::common::RFA_String tmpStr( "RequestCompleted" );
//respStatus.setStatusText(tmpStr.c_str() );
//respMsg.setRespStatus(respStatus );
var respStatus = new RespStatus
{
DataState = _dataState,
StatusCode = _statusCode,
StreamState = _streamState,
StatusText = new RFA_String(_statusText)
};
return respStatus;
}
}
}