aGrUM  0.16.0
structuralConstraintPattern4UndiGraphInline.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 StructuralConstraintDegree 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 StructuralConstraintPattern4UndiGraphRootInline.h instead.
28 
29 #ifdef GUM_CONSTRAINT_CLASS_NAME
30 
32 INLINE void GUM_CONSTRAINT_CLASS_NAME::setGraph(const UndiGraph& graph) {
33  constraints::setGraph(graph);
34  setGraphAlone(graph);
35 }
36 
38 INLINE bool GUM_CONSTRAINT_CLASS_NAME::checkEdgeAddition(NodeId x,
39  NodeId y) const {
40  return constraints::checkEdgeAddition(x, y) && checkEdgeAdditionAlone(x, y);
41 }
42 
44 INLINE bool GUM_CONSTRAINT_CLASS_NAME::checkEdgeDeletion(NodeId x,
45  NodeId y) const {
46  return constraints::checkEdgeDeletion(x, y) && checkEdgeDeletionAlone(x, y);
47 }
48 
50 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const EdgeAddition& change) {
51  constraints::modifyGraph(change);
52  modifyGraphAlone(change);
53 }
54 
56 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const EdgeDeletion& change) {
57  constraints::modifyGraph(change);
58  modifyGraphAlone(change);
59 }
60 
62 INLINE void GUM_CONSTRAINT_CLASS_NAME::modifyGraph(const GraphChange& change) {
63  constraints::modifyGraph(change);
64  modifyGraphAlone(change);
65 }
66 
68 INLINE bool GUM_CONSTRAINT_CLASS_NAME::isAlwaysInvalid(const GraphChange&) const {
69  return constraints::isAlwaysInvalid(change) || isAlwaysInvalidAlone(change);
70 }
71 
73 INLINE bool
74  GUM_CONSTRAINT_CLASS_NAME::checkModification(const EdgeAddition& change) const {
75  return checkEdgeAddition(change.node1(), change.node2());
76 }
77 
79 INLINE bool
80  GUM_CONSTRAINT_CLASS_NAME::checkModification(const EdgeDeletion& change) const {
81  return checkEdgeDeletion(change.node1(), change.node2());
82 }
83 
85 INLINE bool
86  GUM_CONSTRAINT_CLASS_NAME::checkModification(const GraphChange& change) const {
87  switch (change.type()) {
89  return checkEdgeAddition(change.node1(), change.node2());
90 
92  return checkEdgeDeletion(change.node1(), change.node2());
93 
94  default:
95  GUM_ERROR(OperationNotAllowed,
96  "arc modifications are not supported by the constraint");
97  }
98 }
99 
100 #endif /* GUM_CONSTRAINT_CLASS_NAME */
Size NodeId
Type for node ids.
Definition: graphElements.h:98
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55