15 #ifndef DETECTORGRAPH_INCLUDE_TOPIC_HPP_ 16 #define DETECTORGRAPH_INCLUDE_TOPIC_HPP_ 23 #if defined(BUILD_FEATURE_DETECTORGRAPH_CONFIG_LITE) 25 #include "detectorgraphliteconfig.hpp" 49 #if !defined(BUILD_FEATURE_DETECTORGRAPH_CONFIG_LITE) 59 for (VertexPtrContainer::iterator vIt =
GetOutEdges().begin();
63 (*vIt)->SetState(aNewState);
87 #if defined(BUILD_FEATURE_DETECTORGRAPH_CONFIG_STATIC_ASSERTS) 88 static_assert(std::is_base_of<TopicState, T>::value,
"T must inherit from TopicState");
93 #if defined(BUILD_FEATURE_DETECTORGRAPH_CONFIG_LITE) 102 #if __cplusplus < 201103L 103 (void)static_cast<TopicState*>((T*)0);
114 mCurrentValues.clear();
118 mCurrentValues.push_back(arPayload);
128 mCurrentValues.clear();
147 for (
typename ValuesContainer::const_iterator valueIt = mCurrentValues.begin();
148 valueIt != mCurrentValues.end();
182 return mCurrentValues.back();
187 return mCurrentValues;
193 #if !defined(BUILD_FEATURE_DETECTORGRAPH_CONFIG_LITE) 197 return TopicState::GetId<T>();
202 std::list<ptr::shared_ptr<const TopicState> > tCurrentTopicStates;
204 for (
typename std::vector<T>::const_iterator valueIt = mCurrentValues.begin();
205 valueIt != mCurrentValues.end();
208 tCurrentTopicStates.push_back(ptr::shared_ptr<TopicState>(
new T(*valueIt)));
211 return tCurrentTopicStates;
220 ValuesContainer mCurrentValues;
225 #endif // DETECTORGRAPH_INCLUDE_TOPIC_HPP_
void MarkChildrenState(VertexSearchState aNewState)
virtual TopicStateIdType GetId() const
const ValuesContainer & GetCurrentValues() const
void DispatchIntoSubscriber(SubscriberInterface< T > *aSubscriber)
Pass pending data to its handler.
VertexSearchState
Enum used for topological sort & traverse context keeping.
void Publish(const T &arPayload)
Append data to its vector.
virtual void Evaluate(const T &)=0
Pure-virtual method that should Evaluate a piece of input data.
bool HasNewValue() const
Returns true if the new Data is available.
Manage data and its handler.
virtual TopicStateIdType GetId() const =0
VertexPtrContainer & GetOutEdges()
VertexSearchState GetState() const
Provide interface for a topic.
virtual VertexType GetVertexType() const
std::vector< T > ValuesContainer
const T & GetNewValue() const
Returns reference to the new/latest value in the topic.
void SetState(VertexSearchState aNewState)
A Pure interface that declares the Subscriber behavior.
virtual void ProcessVertex()
virtual std::list< ptr::shared_ptr< const TopicState > > GetCurrentTopicStates() const
#define DG_ASSERT(condition)
virtual std::list< ptr::shared_ptr< const TopicState > > GetCurrentTopicStates() const =0
Define behaviors of a vertex in a graph.