MT Showcase SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Events.hpp
1 #pragma once
2 
3 #include "Export.hpp"
4 #include "GraphTypes.hpp"
5 
6 #include <QString>
7 #include <QVariant>
8 
9 namespace Showcase
10 {
12  enum class GraphEventSource : int {
14  NODE = 1,
16  NODE_PROPERTY = 2,
18  EDGE_PROPERTY = 4,
19 
22  };
23 
24 
26  enum class NodeEventType {
29  FOUND,
30 
33  LOST,
34 
43  PENDING
44  };
45 
47  enum class PropertyEventType {
50  FOUND,
51 
54  LOST,
55 
57  CHANGED,
58 
67  PENDING
68  };
69 
73  class SHOWCASE_API NodeEvent
74  {
75  public:
76 
77  NodeEvent(const GraphNode& n = GraphNode(GraphNode::emptyId()))
78  : node(n),
79  edge(GraphEdge::emptyId()),
80  type(NodeEventType::PENDING)
81  {}
82 
83  NodeEvent(const GraphNode& n, const EdgeId& e, NodeEventType t)
84  : node(n),
85  edge(e),
86  type(t)
87  {}
88 
89  ~NodeEvent() {}
90 
91  bool isPending() const { return type == NodeEventType::PENDING; }
92 
100  };
101 
102 
104 
108  class SHOWCASE_API PropertyEvent
109  {
110  public:
111  PropertyEvent()
112  : type(PropertyEventType::PENDING)
113  {}
114 
115  PropertyEvent(const Property& prop, PropertyEventType t, EdgeId edge = EdgeId())
116  : property(prop),
117  type(t),
118  edgeId(edge)
119  {}
120 
121  PropertyEvent(const PropertyKey& key, const PropertyValue& val,
122  PropertyEventType t, EdgeId edge = EdgeId())
123  : property(key, val),
124  type(t),
125  edgeId(edge)
126  {}
127 
128  ~PropertyEvent() {}
129 
130  bool isPending() const { return type == PropertyEventType::PENDING; }
131 
135  Property property;
138 
141  };
142 
143 }