aGrUM  0.16.0
structuralConstraintPatternInline.h
Go to the documentation of this file.
1 
23 // this file should be included at the end of the StructuralConstraints inline
24 // files (see StructuralConstraintDAG to see how it should be included).
25 // This concerns only StructuralConstraints that derive from other
26 // StructuralConstraints. If your class does not derive from anoter constraint,
27 // include file StructuralConstraintPatternRootInline.h instead.
28 
29 #ifdef GUM_CONSTRAINT_CLASS_NAME
30 
32 INLINE void GUM_CONSTRAINT_CLASS_NAME::setGraph(const DiGraph& graph) {
33  constraints::setGraph(graph);
34  setGraphAlone(graph);
35 }
36 
38 INLINE bool GUM_CONSTRAINT_CLASS_NAME::checkArcAddition(NodeId x, NodeId y) const {
39  return constraints::checkArcAddition(x, y) && checkArcAdditionAlone(x, y);
40 }
41 
43 INLINE bool GUM_CONSTRAINT_CLASS_NAME::checkArcDeletion(NodeId x, NodeId y) const {
44  return constraints::checkArcDeletion(x, y) && checkArcDeletionAlone(x, y);
45 }
46 
48 INLINE bool GUM_CONSTRAINT_CLASS_NAME::checkArcReversal(NodeId x, NodeId y) const {
49  return constraints::checkArcReversal(x, y) && checkArcReversalAlone(x, y);
50 }
51 
53 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const ArcAddition& change) {
54  constraints::modifyGraph(change);
55  modifyGraphAlone(change);
56 }
57 
59 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const ArcDeletion& change) {
60  constraints::modifyGraph(change);
61  modifyGraphAlone(change);
62 }
63 
65 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const ArcReversal& change) {
66  constraints::modifyGraph(change);
67  modifyGraphAlone(change);
68 }
69 
71 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const GraphChange& change) {
72  constraints::modifyGraph(change);
73  modifyGraphAlone(change);
74 }
75 
77 INLINE bool
78  GUM_CONSTRAINT_CLASS_NAME::isAlwaysInvalid(const GraphChange& change) const {
79  return constraints::isAlwaysInvalid(change) || isAlwaysInvalidAlone(change);
80 }
81 
83 INLINE bool
84  GUM_CONSTRAINT_CLASS_NAME::checkModification(const ArcAddition& change) const {
85  return checkArcAddition(change.node1(), change.node2());
86 }
87 
89 INLINE bool
90  GUM_CONSTRAINT_CLASS_NAME::checkModification(const ArcDeletion& change) const {
91  return checkArcDeletion(change.node1(), change.node2());
92 }
93 
95 INLINE bool
96  GUM_CONSTRAINT_CLASS_NAME::checkModification(const ArcReversal& change) const {
97  return checkArcReversal(change.node1(), change.node2());
98 }
99 
101 INLINE bool
102  GUM_CONSTRAINT_CLASS_NAME::checkModification(const GraphChange& change) const {
103  switch (change.type()) {
105  return checkArcAddition(change.node1(), change.node2());
106 
108  return checkArcDeletion(change.node1(), change.node2());
109 
111  return checkArcReversal(change.node1(), change.node2());
112 
113  default:
114  GUM_ERROR(OperationNotAllowed,
115  "edge modifications are not supported by the constraint");
116  }
117 }
118 
119 #endif /* GUM_CONSTRAINT_CLASS_NAME */
Size NodeId
Type for node ids.
Definition: graphElements.h:98
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55