aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
multiDimPartialInstantiation.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of MultiDimPartialInstantiation.
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 #ifndef GUM_MULTI_DIM_PARTIAL_INSTANTIATION_H
29 #define GUM_MULTI_DIM_PARTIAL_INSTANTIATION_H
30 
31 #include <agrum/tools/core/set.h>
32 #include <agrum/tools/multidim/implementations/multiDimDecorator.h>
33 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
34 #include <agrum/tools/multidim/utils/partialInstantiationRegister4MultiDim.h>
35 #include <agrum/tools/variables/discreteVariable.h>
36 #include <utility>
37 
38 namespace gum {
39 
40  /**
41  * @class MultiDimPartialInstantiation
42  * @ingroup multidim_group
43  *
44  * @warning Doxygen does not like spanning command on multiple line, so we
45  * could not configure it with the correct include directive. Use the
46  * following code snippet to include this file.
47  * @code
48  * #include <agrum/tools/multidim/implementations/multiDimPartialInstantiation.h>
49  * @endcode
50  *
51  * @brief A generic class to instantiate a subset of variables of a
52  * multidimensional table.
53  *
54  * @tparam GUM_SCALAR The type of scalars stored in this multidimensional
55  * table.
56  * @tparam Table The class of multidimensional table to use.
57  */
58  template < typename GUM_SCALAR, template < typename > class TABLE >
60  public:
61  // =========================================================================
62  /// @name Constructors, Destructors and Copy
63  // =========================================================================
64  /// @{
65 
66  /**
67  * @brief Default constructor.
68  */
70 
71  /**
72  * @brief Copy constructor.
73  * @param src The MultiDimPartialInstantiation to copy.
74  */
76  const MultiDimPartialInstantiation< GUM_SCALAR, TABLE >& src);
77 
78  /**
79  * @brief Class destructor.
80  */
82 
83  /**
84  * @brief Copy operator.
85  * @param src The MultiDimPartialInstantiation to copy.
86  * @return Returns this MultiDimPartialInstantiation.
87  */
90 
91  /// @}
92  // =========================================================================
93  /// @name inherited methdods
94  // =========================================================================
95  /// @{
96 
98 
99  /// @}
100  // =========================================================================
101  /// @name Accessors/Modifiers
102  // =========================================================================
103  /// @{
104 
105  /**
106  * @brief Creates and returns the partial instantiation of the table over a
107  * subset of its variables.
108  *
109  * @warning If inst_vars is precisely equal to the variables of table, the
110  * result is an empty table.
111  *
112  * @param table The table to parially instantiate.
113  * @param inst_vars A mapping between variables and their instantiation.
114  *
115  * @return A new freshly created TABLE which is the result of the
116  * instantiation of a subset of the variables of the TABLE passed in
117  * argument.
118  */
119  TABLE< GUM_SCALAR >*
120  instantiate(const TABLE< GUM_SCALAR >& table,
121  const HashTable< const DiscreteVariable*, Idx >& inst_vars);
122 
123  /**
124  * @brief Creates and returns the partial instantiation of the table over a
125  * subset of its variables.
126  *
127  * @warning If inst_vars is precisely equal to the variables of table, the
128  * result is an empty table.
129  *
130  * @param container Placeholder of the instantiation of table given
131  * inst_vars.
132  * @param table The table to parially instantiate.
133  * @param inst_vars A mapping between variables and their instantiation.
134  */
135  void instantiate(TABLE< GUM_SCALAR >& container,
136  const TABLE< GUM_SCALAR >& table,
137  const HashTable< const DiscreteVariable*, Idx >& inst_vars);
138 
139  /// @}
140  };
141 
142 } /* namespace gum */
143 
144 // always include the template implementation
145 #include <agrum/tools/multidim/implementations/multiDimPartialInstantiation_tpl.h>
146 
147 #endif /* GUM_MULTI_DIM_PARTIAL_INSTANTIATION_H */
virtual ~MultiDimPartialInstantiation()
Class destructor.
MultiDimPartialInstantiation(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE > &src)
Copy constructor.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
MultiDimPartialInstantiation()
Default constructor.
MultiDimPartialInstantiation< GUM_SCALAR, TABLE > & operator=(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE > &src)
Copy operator.
TABLE< GUM_SCALAR > * instantiate(const TABLE< GUM_SCALAR > &table, const HashTable< const DiscreteVariable *, Idx > &inst_vars)
Creates and returns the partial instantiation of the table over a subset of its variables.
void instantiate(TABLE< GUM_SCALAR > &container, const TABLE< GUM_SCALAR > &table, const HashTable< const DiscreteVariable *, Idx > &inst_vars)
Creates and returns the partial instantiation of the table over a subset of its variables.
A generic class to instantiate a subset of variables of a multidimensional table. ...
virtual MultiDimPartialInstantiation< GUM_SCALAR, TABLE > * newFactory() const