140 lines
3.2 KiB
C++
140 lines
3.2 KiB
C++
/**
|
|
* @file include/ActivOneApi/Topic.h
|
|
*
|
|
* @brief Header for the Topic class.
|
|
*/
|
|
|
|
#if (!defined ACTIV_ONE_API_TOPIC_H)
|
|
#define ACTIV_ONE_API_TOPIC_H
|
|
|
|
#include "ActivOneApi/External.h"
|
|
|
|
#include "ActivOneApi/TopicId.h"
|
|
|
|
#include "ActivMiddleware/CxxYZ/memory.h"
|
|
|
|
#include ACTIV_BOOST_INCLUDE(move/move.hpp)
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! OneApi namespace.
|
|
namespace OneApi
|
|
{
|
|
|
|
/**
|
|
* @brief Topic class.
|
|
*
|
|
* Stores information about a topic.
|
|
*/
|
|
class Topic
|
|
{
|
|
public:
|
|
/**
|
|
* @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;
|
|
|
|
/**
|
|
* @brief Get the relationship if this was a navigation request.
|
|
*
|
|
* @return The relationship id.
|
|
*/
|
|
RelationshipId GetRelationshipId() const;
|
|
|
|
private:
|
|
//! Default constructor.
|
|
Topic(const TopicType topicType, const RelationshipId relationshipId, const TopicId &topicId);
|
|
|
|
const TopicType m_type; ///< The type of this topic.
|
|
const RelationshipId m_relationshipId; ///< The id of the relationship that caused this topic to be found using navigation.
|
|
const TopicId m_id; ///< The topic id.
|
|
|
|
friend class TopicDetail;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
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;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline RelationshipId Topic::GetRelationshipId() const
|
|
{
|
|
assert (m_id.IsValid());
|
|
|
|
return m_relationshipId;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
inline Topic::Topic(const TopicType topicType, const RelationshipId relationshipId, const TopicId &topicId) :
|
|
m_type(topicType),
|
|
m_relationshipId(relationshipId),
|
|
m_id(topicId)
|
|
{
|
|
assert (m_id.IsValid());
|
|
}
|
|
|
|
} // namespace OneApi
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_ONE_API_TOPIC_H)
|