aGrUM  0.16.0
internalNode.h
Go to the documentation of this file.
1 
30 #ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_INTERNAL_NODE_H
31 #define GUM_MULTI_DIM_FUNCTION_GRAPH_INTERNAL_NODE_H
32 
33 #include <agrum/agrum.h>
38 
39 namespace gum {
40 
41  // clang-format off
49  // clang-format on
50  struct Parent {
53 
57  Parent(NodeId pi, Idx m);
58 
62  Parent(const Parent& src);
63 
64  // ============================================================================
66  // ============================================================================
68 
72  void* operator new(size_t s);
73 
77  void operator delete(void* p);
78 
80  // ============================================================================
82  // ============================================================================
84 
85  bool operator==(const Parent& comp) const;
86 
87  bool operator!=(const Parent& comp) const;
88 
89  Parent& operator=(const Parent& src);
91  };
92 
93  // clang-format off
101  // clang-format on
102  class InternalNode {
103  private:
106 
123 
126 
128  void __setNodeVar(const DiscreteVariable* v);
129 
130  public:
131  // ============================================================================
133  // ============================================================================
135 
140  InternalNode();
141 
148  explicit InternalNode(const DiscreteVariable* v);
149 
160  InternalNode(const DiscreteVariable* v, NodeId* sons);
161 
165  ~InternalNode();
167  // ============================================================================
169  // ============================================================================
171 
175  void* operator new(size_t s);
176 
180  void operator delete(void* p);
181 
183  // ============================================================================
185  // ============================================================================
187 
195  void setNode(const DiscreteVariable* v, NodeId* sons);
196 
198  // ============================================================================
200  // ============================================================================
202 
206  void setNodeVar(const DiscreteVariable* v);
207 
211  const DiscreteVariable* nodeVar() const;
212 
214  // ============================================================================
216  // ============================================================================
218 
222  void setSon(Idx modality, NodeId son);
223 
227  NodeId son(Idx modality) const;
228 
232  Idx nbSons() const;
233 
235  // ============================================================================
237  // ============================================================================
239 
243  void addParent(NodeId parent, Idx modality);
244 
248  void removeParent(NodeId parent, Idx modality);
249 
253  Link< Parent >* parents();
254 
258  const Link< Parent >* parents() const;
259 
261  // ============================================================================
263  // ============================================================================
265 
269  static NodeId* allocateNodeSons(const DiscreteVariable* v);
270 
274  static void deallocateNodeSons(const DiscreteVariable* v, NodeId* s);
275 
277  };
278 
279 } // End of namespace gum
280 
281 #ifndef GUM_NO_INLINE
283 #endif /* GUM_NO_INLINE */
284 
285 #endif /* GUM_MULTI_DIM_FUNCTION_GRAPH_INTERNAL_NODE_H */
bool operator==(const Parent &comp) const
NodeId parentId
Definition: internalNode.h:51
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
LinkedList< Parent > __nodeParents
The list of the node&#39;s parent.
Definition: internalNode.h:125
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
bool operator!=(const Parent &comp) const
Parent & operator=(const Parent &src)
NodeId * __nodeSons
Table of sons of the node.
Definition: internalNode.h:122
Structure used to represent a node internal structure.
Definition: internalNode.h:102
const DiscreteVariable * __nodeVar
Variable associated to such node.
Definition: internalNode.h:105
Parent(NodeId pi, Idx m)
Class constructor.
Chain list allocated using the SmallObjectAllocator.
Definition: link.h:134
Represent a node&#39;s parent.
Definition: internalNode.h:50
Size Idx
Type for indexes.
Definition: types.h:53
Size NodeId
Type for node ids.
Definition: graphElements.h:98
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.