aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
O3InterfaceFactory.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by 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 >& operator=(const O3InterfaceFactory< GUM_SCALAR >& src);
68  O3InterfaceFactory< GUM_SCALAR >& operator=(O3InterfaceFactory< GUM_SCALAR >&& src);
69 
70  void buildInterfaces();
71 
72  void buildElements();
73 
74  private:
79 
86 
87  bool _addInterface2Dag_();
88 
89  bool _addArcs2Dag_();
90 
92 
93  bool _checkO3Interfaces_();
94 
95  bool _checkInterfaceElement_(O3Interface& i, O3InterfaceElement& elt);
96 
97  bool _checkOverloadLegality_(O3Interface& i, O3InterfaceElement& elt);
98 
99  bool _checkAttributeOverloadLegality_(O3Interface& i, O3InterfaceElement& elt);
100 
101  bool _checkReferenceOverloadLegality_(O3Interface& i, O3InterfaceElement& elt);
102 
103  bool _checkCyclicReference_(O3Interface& i, O3InterfaceElement& elt);
104  };
105 
106  } // namespace o3prm
107  } // namespace prm
108 } // namespace gum
109 
110 // always include the implementation of the templates
111 # include <agrum/PRM/o3prm/O3InterfaceFactory_tpl.h>
112 
113 
114 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
115 extern template class gum::prm::o3prm::O3InterfaceFactory< double >;
116 # endif
117 
118 
119 #endif // GUM_PRM_O3PRM_O3INTERFACE_FACTORY_H
HashTable< std::string, O3Interface *> _interfaceMap_
std::vector< O3Interface *> _o3Interface_
O3InterfaceFactory< GUM_SCALAR > & operator=(O3InterfaceFactory< GUM_SCALAR > &&src)
bool _checkCyclicReference_(O3Interface &i, O3InterfaceElement &elt)
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
HashTable< std::string, gum::NodeId > _nameMap_
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3InterfaceFactory< GUM_SCALAR > & operator=(const O3InterfaceFactory< GUM_SCALAR > &src)
bool _checkInterfaceElement_(O3Interface &i, O3InterfaceElement &elt)
HashTable< std::string, std::string > _eltName_
O3InterfaceFactory(O3InterfaceFactory< GUM_SCALAR > &&src)
O3NameSolver< GUM_SCALAR > * _solver_
bool _checkOverloadLegality_(O3Interface &i, O3InterfaceElement &elt)
Bulds gum::prm:PRMInterface from gum::prm::o3prm::O3Interface.
HashTable< NodeId, O3Interface *> _nodeMap_
O3InterfaceFactory(const O3InterfaceFactory< GUM_SCALAR > &src)
bool _checkAttributeOverloadLegality_(O3Interface &i, O3InterfaceElement &elt)
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
bool _checkReferenceOverloadLegality_(O3Interface &i, O3InterfaceElement &elt)