aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
O3InterfaceFactory.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 for the O3InterfaceFactory class.
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  * @author Lionel TORTI
28  */
29 
30 #include <memory>
31 #include <string>
32 
33 #include <agrum/PRM/PRM.h>
34 #include <agrum/PRM/PRMFactory.h>
35 #include <agrum/PRM/o3prm/O3NameSolver.h>
36 #include <agrum/PRM/o3prm/O3prm.h>
37 #include <agrum/PRM/o3prm/errors.h>
38 #include <agrum/tools/core/hashTable.h>
39 #include <agrum/tools/core/set.h>
40 
41 #ifndef GUM_PRM_O3PRM_O3INTERFACE_FACTORY_H
42 # define GUM_PRM_O3PRM_O3INTERFACE_FACTORY_H
43 
44 namespace gum {
45  namespace prm {
46  namespace o3prm {
47 
48  /**
49  * @class O3InterfaceFactory
50  * @headerfile O3InterfaceFactory.h <agrum/PRM/o3prm/O3InterfaceFactory.h>
51  * @ingroup o3prm_group
52  *
53  * @brief Bulds gum::prm:PRMInterface from gum::prm::o3prm::O3Interface.
54  *
55  * @tparam GUM_SCALAR The scalar type used by the gum::prm::PRM.
56  */
57  template < typename GUM_SCALAR >
59  public:
60  O3InterfaceFactory(PRM< GUM_SCALAR >& prm,
61  O3PRM& o3_prm,
62  O3NameSolver< GUM_SCALAR >& solver,
63  ErrorsContainer& errors);
64  O3InterfaceFactory(const O3InterfaceFactory< GUM_SCALAR >& src);
65  O3InterfaceFactory(O3InterfaceFactory< GUM_SCALAR >&& src);
67  O3InterfaceFactory< GUM_SCALAR >&
68  operator=(const O3InterfaceFactory< GUM_SCALAR >& src);
69  O3InterfaceFactory< GUM_SCALAR >&
70  operator=(O3InterfaceFactory< GUM_SCALAR >&& src);
71 
72  void buildInterfaces();
73 
74  void buildElements();
75 
76  private:
81 
88 
89  bool addInterface2Dag__();
90 
91  bool addArcs2Dag__();
92 
94 
95  bool checkO3Interfaces__();
96 
97  bool checkInterfaceElement__(O3Interface& i, O3InterfaceElement& elt);
98 
99  bool checkOverloadLegality__(O3Interface& i, O3InterfaceElement& elt);
100 
101  bool checkAttributeOverloadLegality__(O3Interface& i,
102  O3InterfaceElement& elt);
103 
104  bool checkReferenceOverloadLegality__(O3Interface& i,
105  O3InterfaceElement& elt);
106 
107  bool checkCyclicReference__(O3Interface& i, O3InterfaceElement& elt);
108  };
109 
110  } // namespace o3prm
111  } // namespace prm
112 } // namespace gum
113 
114 // always include the implementation of the templates
115 # include <agrum/PRM/o3prm/O3InterfaceFactory_tpl.h>
116 
117 
118 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
119 extern template class gum::prm::o3prm::O3InterfaceFactory< double >;
120 # endif
121 
122 
123 #endif // GUM_PRM_O3PRM_O3INTERFACE_FACTORY_H
O3InterfaceFactory< GUM_SCALAR > & operator=(O3InterfaceFactory< GUM_SCALAR > &&src)
bool checkOverloadLegality__(O3Interface &i, O3InterfaceElement &elt)
HashTable< std::string, std::string > eltName__
HashTable< std::string, gum::NodeId > nameMap__
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
bool checkReferenceOverloadLegality__(O3Interface &i, O3InterfaceElement &elt)
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3InterfaceFactory< GUM_SCALAR > & operator=(const O3InterfaceFactory< GUM_SCALAR > &src)
O3NameSolver< GUM_SCALAR > * solver__
O3InterfaceFactory(O3InterfaceFactory< GUM_SCALAR > &&src)
Bulds gum::prm:PRMInterface from gum::prm::o3prm::O3Interface.
O3InterfaceFactory(const O3InterfaceFactory< GUM_SCALAR > &src)
bool checkInterfaceElement__(O3Interface &i, O3InterfaceElement &elt)
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
bool checkCyclicReference__(O3Interface &i, O3InterfaceElement &elt)
HashTable< std::string, O3Interface *> interfaceMap__
bool checkAttributeOverloadLegality__(O3Interface &i, O3InterfaceElement &elt)
std::vector< O3Interface *> o3Interface__
HashTable< NodeId, O3Interface *> nodeMap__