aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
O3SystemFactory.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 O3SystemFactory 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/tools/core/hashTable.h>
38 #include <agrum/tools/core/set.h>
39 
40 #ifndef GUM_PRM_O3PRM_O3SYSTEM_FACTORY_H
41 # define GUM_PRM_O3PRM_O3SYSTEM_FACTORY_H
42 
43 namespace gum {
44  namespace prm {
45  namespace o3prm {
46 
47  /**
48  * @class O3SystemFactory
49  * @headerfile O3SystemFactory.h <agrum/PRM/o3prm/O3SystemFactory.h>
50  * @ingroup o3prm_group
51  *
52  * @brief Builds gum::prm::PRMSystem from gum::prm::o3prm::O3System.
53  *
54  * @tparam GUM_SCALAR The scalar type used by the gum::prm::PRM.
55  */
56  template < typename GUM_SCALAR >
58  public:
59  O3SystemFactory(PRM< GUM_SCALAR >& prm,
60  O3PRM& o3_prm,
61  O3NameSolver< GUM_SCALAR >& solver,
62  ErrorsContainer& errors);
63  O3SystemFactory(const O3SystemFactory< GUM_SCALAR >& src);
64  O3SystemFactory(O3SystemFactory< GUM_SCALAR >&& src);
65  ~O3SystemFactory();
66  O3SystemFactory< GUM_SCALAR >&
67  operator=(const O3SystemFactory< GUM_SCALAR >& src);
68  O3SystemFactory< GUM_SCALAR >&
69  operator=(O3SystemFactory< GUM_SCALAR >&& src);
70 
71  void build();
72 
73  private:
78 
80 
81  void addInstances__(PRMFactory< GUM_SCALAR >& factory, O3System& sys);
82 
83  void addAssignments__(PRMFactory< GUM_SCALAR >& factory, O3System& sys);
84 
85  void addIncrements__(PRMFactory< GUM_SCALAR >& factory, O3System& sys);
86 
87  bool checkSystem__(O3System& sys);
88 
89  bool checkIncrements__(O3System& sys);
90 
91  bool checkParameters__(const PRMClass< GUM_SCALAR >& type,
92  const O3Instance& inst);
93 
94  bool checkInstance__(O3System& sys);
95 
96  bool checkAssignments__(O3System& sys);
97  };
98 
99  } // namespace o3prm
100  } // namespace prm
101 } // namespace gum
102 
103 // always include the implementation of the templates
104 # include <agrum/PRM/o3prm/O3SystemFactory_tpl.h>
105 
106 
107 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
108 extern template class gum::prm::o3prm::O3SystemFactory< double >;
109 # endif
110 
111 
112 #endif // GUM_PRM_O3PRM_O3SYSTEM_FACTORY_H
O3SystemFactory(O3SystemFactory< GUM_SCALAR > &&src)
O3SystemFactory< GUM_SCALAR > & operator=(O3SystemFactory< GUM_SCALAR > &&src)
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
Builds gum::prm::PRMSystem from gum::prm::o3prm::O3System.
void addAssignments__(PRMFactory< GUM_SCALAR > &factory, O3System &sys)
void addIncrements__(PRMFactory< GUM_SCALAR > &factory, O3System &sys)
O3SystemFactory(const O3SystemFactory< GUM_SCALAR > &src)
bool checkParameters__(const PRMClass< GUM_SCALAR > &type, const O3Instance &inst)
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
void addInstances__(PRMFactory< GUM_SCALAR > &factory, O3System &sys)
O3SystemFactory< GUM_SCALAR > & operator=(const O3SystemFactory< GUM_SCALAR > &src)
O3NameSolver< GUM_SCALAR > * solver__
O3SystemFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
HashTable< std::string, O3Instance *> nameMap__