Files
externals/linux/include/ActivOneApi/Deprecated/Topic.h
T
2023-12-15 13:15:08 -05:00

129 lines
2.8 KiB
C++

/**
* @file include/ActivOneApi/Deprecated/Topic.h
*
* @brief Header for the deprecated Topic class.
*/
#if (!defined ACTIV_ONE_API_DEPRECATED_TOPIC_H)
#define ACTIV_ONE_API_DEPRECATED_TOPIC_H
#include "ActivOneApi/External.h"
#include "ActivOneApi/TopicId.h"
#include "ActivOneApi/Messages/QueryAddMessage.h"
#include "ActivMiddleware/Misc/StringView.h"
//! Activ namespace.
namespace Activ
{
//! OneApi namespace.
namespace OneApi
{
//! Deprecated namespace.
namespace Deprecated
{
/**
* @brief Deprecated topic class.
*
* Stores information about a topic.
*/
class Topic
{
public:
/**
* @brief Construct from a QueryAddMessage.
*
* @param message
*/
Topic(const QueryAddMessage &message);
/**
* @brief Get the TopicType.
*
* @return The TopicType of this Topic.
*/
TopicType GetType() const;
/**
* @brief Get the TopicId.
*
* @return The TopicId of this Topic.
*/
const TopicId &GetTopicId() const;
/**
* @brief Get the data source.
*
* @return The data source of the TopicId stored in this Topic. Equivalent to GetTopicId().m_dataSourceId.
*/
DataSourceId GetDataSource() const;
/**
* @brief Get the symbol.
*
* @return The symbol of the TopicId stored in this Topic. Equivalent to GetTopicId().m_symbol.
*/
const String &GetSymbol() const;
private:
const TopicType m_type; ///< The type of this topic.
const TopicId m_id; ///< The topic id.
};
// ---------------------------------------------------------------------------------------------------------------------------------
inline Topic::Topic(const QueryAddMessage &message) :
m_type(message.m_type),
m_id(message.m_dataSourceId, message.m_tableNumber, ToStringType<String>(message.m_symbol))
{
assert (m_id.IsValid());
}
// ---------------------------------------------------------------------------------------------------------------------------------
inline TopicType Topic::GetType() const
{
assert (m_id.IsValid());
return m_type;
}
// ---------------------------------------------------------------------------------------------------------------------------------
inline const TopicId &Topic::GetTopicId() const
{
assert (m_id.IsValid());
return m_id;
}
// ---------------------------------------------------------------------------------------------------------------------------------
inline DataSourceId Topic::GetDataSource() const
{
assert (m_id.IsValid());
return m_id.m_dataSourceId;
}
// ---------------------------------------------------------------------------------------------------------------------------------
inline const String &Topic::GetSymbol() const
{
assert (m_id.IsValid());
return m_id.m_symbol;
}
} // namespace Deprecated
} // namespace OneApi
} // namespace Activ
#endif // (!defined ACTIV_ONE_API_DEPRECATED_TOPIC_H)