3 #include <Radiant/Flags.hpp>
4 #include <unordered_map>
5 #include <folly/Executor.h>
22 class SHOWCASE_API
GraphConsumer :
public std::enable_shared_from_this<GraphConsumer>
25 GraphConsumer(Radiant::FlagsT<GraphEventSource> monitorFlags);
28 void setMonitorFlags(Radiant::FlagsT<GraphEventSource> monitorFlags);
29 Radiant::FlagsT<GraphEventSource> monitorFlags()
const;
39 void initStreams(GraphPtr graph,
const GraphNode& node,
int consume=0);
42 GraphPtr sourceGraph()
const;
45 PropertyEventStreamPtr propertyStream();
53 virtual std::shared_ptr<folly::Executor>
getExecutor() {
return nullptr; }
55 void initPropertyListener();
56 void initChildListener();
57 void initEdgePropertyListener(
const EdgeId&
id);
59 virtual void onChildEvent(
const NodeEvent& ev) = 0;
65 void onChildEventInternal(
const NodeEvent& ev,
bool consume=
false);
67 NodeEventStreamPtr m_childrenStream;
68 PropertyEventStreamPtr m_propertyStream;
69 std::unordered_map<EdgeId, PropertyEventStreamPtr> m_edgePropertyStreams;
71 std::mutex m_edgeStreamMutex;
73 std::weak_ptr<Graph> m_graph;
75 Radiant::FlagsT<GraphEventSource> m_eventsToMonitor;