aGrUM  0.14.2
internalNode_inl.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
30 
31 namespace gum {
32 
33  INLINE
34  Parent::Parent(NodeId pi, Idx m) : parentId(pi), modality(m) {}
35 
36 
37  INLINE
38  Parent::Parent(const Parent& src) :
39  parentId(src.parentId), modality(src.modality) {}
40 
41  INLINE
42  void* Parent::operator new(size_t s) {
44  }
45 
46  INLINE
47  void Parent::operator delete(void* p) {
49  }
50 
51  INLINE
52  bool Parent::operator==(const Parent& comp) const {
53  if ((comp.parentId == this->parentId) && (comp.modality == this->modality))
54  return true;
55  return false;
56  }
57 
58  INLINE
59  bool Parent::operator!=(const Parent& comp) const { return !(comp == *this); }
60 
61  INLINE
63  this->parentId = src.parentId;
64  this->modality = src.modality;
65  return *this;
66  }
67 
68  INLINE
69  void* InternalNode::operator new(size_t s) {
71  }
72 
73  INLINE
74  void InternalNode::operator delete(void* p) {
76  }
77 
78  INLINE
79  const DiscreteVariable* InternalNode::nodeVar() const { return __nodeVar; }
80 
81  INLINE
83  __nodeSons[modality] = son;
84  }
85 
86  INLINE
87  NodeId InternalNode::son(Idx modality) const { return __nodeSons[modality]; }
88 
89  INLINE
90  Idx InternalNode::nbSons() const { return __nodeVar->domainSize(); }
91 
92  INLINE
93  Link< Parent >* InternalNode::parents() { return __nodeParents.list(); }
94 
95  INLINE
97  return __nodeParents.list();
98  }
99 } // namespace gum
bool operator==(const Parent &comp) const
NodeId parentId
Definition: internalNode.h:49
const DiscreteVariable * nodeVar() const
Returns the node variable.
Idx nbSons() const
Returns the number of sons.
void setSon(Idx modality, NodeId son)
Sets the node&#39;s son.
NodeId son(Idx modality) const
Returns the son at a given index.
Headers of the InternalNode class.
Link< Parent > * parents()
Returns the list of parents.
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
bool operator!=(const Parent &comp) const
Parent & operator=(const Parent &src)
Structure used to represent a node internal structure.
Definition: internalNode.h:100
Parent(NodeId pi, Idx m)
Class constructor.
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
Represent a node&#39;s parent.
Definition: internalNode.h:48
Size Idx
Type for indexes.
Definition: types.h:50
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
Size NodeId
Type for node ids.
Definition: graphElements.h:97