aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
O3SystemFactory.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 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 >& operator=(const O3SystemFactory< GUM_SCALAR >& src);
67  O3SystemFactory< GUM_SCALAR >& operator=(O3SystemFactory< GUM_SCALAR >&& src);
68 
69  void build();
70 
71  private:
76 
78 
79  void _addInstances_(PRMFactory< GUM_SCALAR >& factory, O3System& sys);
80 
81  void _addAssignments_(PRMFactory< GUM_SCALAR >& factory, O3System& sys);
82 
83  void _addIncrements_(PRMFactory< GUM_SCALAR >& factory, O3System& sys);
84 
85  bool _checkSystem_(O3System& sys);
86 
87  bool _checkIncrements_(O3System& sys);
88 
89  bool _checkParameters_(const PRMClass< GUM_SCALAR >& type, const O3Instance& inst);
90 
91  bool _checkInstance_(O3System& sys);
92 
93  bool _checkAssignments_(O3System& sys);
94  };
95 
96  } // namespace o3prm
97  } // namespace prm
98 } // namespace gum
99 
100 // always include the implementation of the templates
101 # include <agrum/PRM/o3prm/O3SystemFactory_tpl.h>
102 
103 
104 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
105 extern template class gum::prm::o3prm::O3SystemFactory< double >;
106 # endif
107 
108 
109 #endif // GUM_PRM_O3PRM_O3SYSTEM_FACTORY_H
O3SystemFactory(O3SystemFactory< GUM_SCALAR > &&src)
O3SystemFactory< GUM_SCALAR > & operator=(O3SystemFactory< GUM_SCALAR > &&src)
bool _checkParameters_(const PRMClass< GUM_SCALAR > &type, const O3Instance &inst)
void _addInstances_(PRMFactory< GUM_SCALAR > &factory, O3System &sys)
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
HashTable< std::string, O3Instance *> _nameMap_
Builds gum::prm::PRMSystem from gum::prm::o3prm::O3System.
O3SystemFactory(const O3SystemFactory< GUM_SCALAR > &src)
void _addIncrements_(PRMFactory< GUM_SCALAR > &factory, O3System &sys)
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
O3NameSolver< GUM_SCALAR > * _solver_
void _addAssignments_(PRMFactory< GUM_SCALAR > &factory, O3System &sys)
O3SystemFactory< GUM_SCALAR > & operator=(const O3SystemFactory< GUM_SCALAR > &src)
O3SystemFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)