aGrUM  0.16.0
fusionContext.h
Go to the documentation of this file.
1 
30 // =========================================================================
31 #ifndef GUM_FUSION_CONTEXT_H
32 #define GUM_FUSION_CONTEXT_H
33 // =========================================================================
35 // =========================================================================
37 // =========================================================================
41 // =========================================================================
42 
43 namespace gum {
44 
53  typedef HashTableConstIteratorSafe< LeafPair*, std::vector< Size > >
55 
56 
57  template < bool isInitial = false >
58  class FusionContext {
59  public:
60  // ==========================================================================
62  // ==========================================================================
64 
65  // ###################################################################
67  // ###################################################################
69 
70  // ###################################################################
72  // ###################################################################
74 
75  // ============================================================================
77  // ============================================================================
78  void* operator new(size_t s) {
80  }
81  void operator delete(void* p) {
83  }
84 
86 
87  // ==========================================================================
89  // ==========================================================================
91 
92  // ###################################################################
94  // ###################################################################
95  public:
98  }
99 
100  private:
102  return __leaf2Pair.exists(l);
103  }
105  return false;
106  }
107 
108  // ###################################################################
110  // ###################################################################
111  public:
114  }
115 
116  private:
119 
120 
121  // ###################################################################
123  // ###################################################################
124  public:
127  }
128 
129  private:
132 
133  public:
136  }
137 
138  private:
141 
142 
143  // ###################################################################
147  // ###################################################################
148  public:
151  }
152 
153  private:
156 
158 
159  public:
160  // ==========================================================================
162  // ==========================================================================
164 
165  // ###################################################################
167  // ###################################################################
168  bool addPair(LeafPair* p);
169 
170  // ###################################################################
172  // ###################################################################
173  bool updatePair(LeafPair* p);
174 
175  // ###################################################################
177  // ###################################################################
178  bool removePair(LeafPair* p);
179 
180 
181  pair_iterator beginPairs() { return __pairsHeap.allValues().beginSafe(); }
182  pair_iterator endPairs() { return __pairsHeap.allValues().endSafe(); }
183 
185 
186  // ==========================================================================
188  // ==========================================================================
190 
191  // ###################################################################
193  // ###################################################################
194  LeafPair* top() { return !__pairsHeap.empty() ? __pairsHeap.top() : nullptr; }
195 
196  // ###################################################################
198  // ###################################################################
199  double topLikelyhood() {
200  return !__pairsHeap.empty() ? __pairsHeap.topPriority() : 1.0;
201  }
202 
204 
205  // ==========================================================================
207  // ==========================================================================
209 
210  // ###################################################################
212  // ###################################################################
213  AbstractLeaf* leaf() { return __leaf; }
214 
215  // ###################################################################
217  // ###################################################################
219  return __leaf2Pair.getWithDefault(l, nullptr);
220  }
221 
222  // ###################################################################
224  // ###################################################################
225  public:
228  }
229 
230  private:
233  return Set< LeafPair* >();
234  }
236 
237  public:
238  std::string toString();
239 
240  private:
242 
244 
246  };
247 
248 
249 } /* namespace gum */
250 
252 
253 #endif // GUM_FUSION_CONTEXT_H
Set< LeafPair *> __associatedPairs(Int2Type< false >)
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.
HashTableConstIteratorSafe< LeafPair *, std::vector< Size > > pair_iterator
Definition: fusionContext.h:54
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool __updateAssociatedLeaf(AbstractLeaf *, Int2Type< true >)
<agrum/FMDP/learning/datastructure/leaves/fusionContext.h>
Definition: fusionContext.h:58
bool __updateAllAssociatedLeaves(Int2Type< true >)
bool __updateAllAssociatedLeaves(Int2Type< false >)
bool removePair(LeafPair *p)
pair_iterator endPairs()
bool __containsAssociatedLeaf(AbstractLeaf *l, Int2Type< false >)
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
Definition: abstractLeaf.h:53
Safe Const Iterators for hashtables.
Definition: hashTable.h:1918
<agrum/FMDP/learning/datastructure/leaves/leafPair.h>
Definition: leafPair.h:51
Set< LeafPair *> __associatedPairs(Int2Type< true >)
AbstractLeaf * leaf()
LeafPair * leafAssociatedPair(AbstractLeaf *l)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
bool __deassociateLeaf(AbstractLeaf *, Int2Type< true >)
Set< LeafPair *> associatedPairs()
The class for generic Hash Tables.
Definition: hashTable.h:679
bool __associateLeaf(AbstractLeaf *, Int2Type< true >)
FusionContext(AbstractLeaf *)
Default constructor.
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:165
bool __deassociateLeaf(AbstractLeaf *, Int2Type< false >)
bool __associateLeaf(AbstractLeaf *, Int2Type< false >)
bool __containsAssociatedLeaf(AbstractLeaf *, Int2Type< true >)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool addPair(LeafPair *p)
bool deassociateLeaf(AbstractLeaf *l)
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
HashTable< AbstractLeaf *, LeafPair *> __leaf2Pair
bool containsAssociatedLeaf(AbstractLeaf *l)
Definition: fusionContext.h:96
MultiPriorityQueue< LeafPair *, double, std::less< double > > __pairsHeap
bool __updateAssociatedLeaf(AbstractLeaf *, Int2Type< false >)
LeafPair * top()
bool updateAllAssociatedLeaves()
void * allocate(const size_t &objectSize)
Allocates a block.
~FusionContext()
Default destructor.
static SmallObjectAllocator & instance()
bool associateLeaf(AbstractLeaf *l)
std::string toString()
AbstractLeaf * __leaf
bool updateAssociatedLeaf(AbstractLeaf *l)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool updatePair(LeafPair *p)
A MultiPriorityQueue is a heap in which each element has a mutable priority and duplicates are allowe...
pair_iterator beginPairs()
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.