MT Showcase SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CachingGenerators.hpp
1 #pragma once
2 
3 #include "GraphGenerators.hpp"
4 
5 namespace Showcase
6 {
7 
12 
13  class SHOWCASE_API CachingGraphGenerator : public CachingGenerator<GraphGenerator>
14  {
15  protected:
16  virtual void readCurrentItems(std::vector<NodeId>& to) = 0;
17  virtual bool hasEventsInCache() const override;
18  virtual NodeEvent nextEvent() override;
19  virtual void updateCache() override;
20 
21  private:
22  NodeEvent createEvent(const NodeId& target, NodeEventType type) const;
23 
24  std::vector<NodeId> m_prevItemsFound; // paths to children
25  std::vector<NodeId> m_itemsFound;
26  std::vector<NodeId> m_itemsRemoved;
27  bool m_sentPending = true; // Start with no events in cache
28  };
29 
30  // ----------------------------------------------------------
31 
33  class SHOWCASE_API CachingPropertyGenerator : public CachingGenerator<PropertyGenerator>
34  {
35  protected:
36  virtual bool hasEventsInCache() const override;
37  virtual PropertyEvent nextEvent() override;
38  virtual void updateCache() override;
39  virtual void readCurrentItems(PropertyMap& to) = 0;
40 
41  private:
42  EdgeId m_queryIdentifier;
43 
44  PropertyMap m_prevItems;
45 
46  PropertyMap m_itemsFound;
47  PropertyMap m_itemsRemoved;
48  PropertyMap m_itemsChanged;
49  bool m_sentPending = true; // Start with no events in cache
50  };
51 
52 
53 }