aGrUM  0.14.2
o4DGContext.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
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  ****************************************************************************/
28 #ifndef O4DGCONTEXT_H
29 #define O4DGCONTEXT_H
30 
31 #include <agrum/agrum.h>
32 #include <agrum/core/math/math.h>
34 
35 namespace gum {
36 
37  // clang-format off
45  // clang-format on
46  class O4DGContext {
47  public:
48  // ============================================================================
50  // ============================================================================
52 
56  O4DGContext(Idx*, Idx);
57 
61  ~O4DGContext();
62 
66  void* operator new(size_t s);
67 
71  void operator delete(void* p);
73 
74  // ============================================================================
76  // ============================================================================
77 
80  void setDG1Node(const NodeId&);
81 
83  const NodeId& DG1Node() const { return __DG1ExploredNode; }
84 
86  void setDG2Node(const NodeId&);
87 
89  const NodeId& DG2Node() const { return __DG2ExploredNode; }
91 
92  // ============================================================================
94  // ============================================================================
96 
98  void chgVarModality(Idx, Idx);
99 
102 
104  // ============================================================================
106  // ============================================================================
108 
110  const double& key(short int* instNeeded);
111 
113 
114  private:
117 
120 
125 
127  double __key;
128 
130  static const double __logPrime[];
132  };
133 } // namespace gum
134 
135 #ifndef GUM_NO_INLINE
137 #endif /* GUM_NO_INLINE */
138 
139 #endif // O4DGCONTEXT_H
Useful macros for maths.
static const Idx __offset1
Definition: o4DGContext.h:131
NodeId __DG2ExploredNode
DG2 Diagram current explored node.
Definition: o4DGContext.h:119
const NodeId & DG2Node() const
Get DG2 diagram current explored Node.
Definition: o4DGContext.h:89
static const double __logPrime[]
Table containing the log2 of prime numbers.
Definition: o4DGContext.h:130
double __key
The key use to store the context as a key in the hashtable.
Definition: o4DGContext.h:127
const double & key(short int *instNeeded)
Returns o4DGContext key.
void chgVarModality(Idx, Idx)
Changes given variable modality.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
const NodeId & DG1Node() const
Get DG1 diagram current explored Node.
Definition: o4DGContext.h:83
void setDG1Node(const NodeId &)
Set DG1 diagram current explored Node.
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:68
Headers of MultiDimFunctionGraph.
void setDG2Node(const NodeId &)
Set DG2 diagram current explored Node.
~O4DGContext()
Default destructor.
Definition: o4DGContext.cpp:76
Size Idx
Type for indexes.
Definition: types.h:50
static const Idx __nbLogPrime
Definition: o4DGContext.h:131
Idx * __varInstantiation
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:123
Class used to manipulate context during Function Graph Operations.
Definition: o4DGContext.h:46
static const Idx __offset2
Definition: o4DGContext.h:131
Size NodeId
Type for node ids.
Definition: graphElements.h:97
Class used to manipulate o4DGContext in Function Graph Operations.
Idx varModality(Idx)
Changes given variable modality.
NodeId __DG1ExploredNode
DG1 Diagram current explored node.
Definition: o4DGContext.h:116
static const Idx __offsetv
Definition: o4DGContext.h:131