aGrUM  0.14.2
O3TypeFactory.h
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
29 #include <memory>
30 #include <string>
31 
32 #include <agrum/PRM/PRM.h>
33 #include <agrum/PRM/PRMFactory.h>
35 #include <agrum/PRM/o3prm/O3prm.h>
36 #include <agrum/PRM/o3prm/errors.h>
38 #include <agrum/core/hashTable.h>
39 #include <agrum/core/set.h>
40 
41 #ifndef GUM_PRM_O3PRM_O3TYPE_FACTORY_H
42 # define GUM_PRM_O3PRM_O3TYPE_FACTORY_H
43 
44 namespace gum {
45  namespace prm {
46  namespace o3prm {
47 
58  template < typename GUM_SCALAR >
59  class O3TypeFactory {
60  public:
62  O3PRM& o3_prm,
64  ErrorsContainer& errors);
70 
71  void build();
72 
73  private:
78 
79  bool __build;
80 
86  std::vector< O3Type* > __o3Types;
87  std::vector< O3IntType* > __o3IntTypes;
88  std::vector< O3RealType* > __o3RealTypes;
89 
90  void __buildTypes();
91  void __buildIntTypes();
92  void __buildRealTypes();
93 
94  bool __isPrimitiveType(O3Type& type);
95 
96  bool __checkO3Types();
98  bool __addTypes2Dag();
99  bool __addArcs2Dag();
100  bool __checkLabels(O3Type& type);
101 
103 
104  bool __checkO3IntTypes();
105  bool __checkO3RealTypes();
106  };
107 
108  } // namespace o3prm
109  } // namespace prm
110 } // namespace gum
111 
112 // always include the implementation of the templates
114 
115 
116 # ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
117 extern template class gum::prm::o3prm::O3TypeFactory< double >;
118 # endif
119 
120 
121 #endif // GUM_PRM_O3PRM_O3TYPE_FACTORY_H
HashTable< std::string, gum::NodeId > __nameMap
Definition: O3TypeFactory.h:82
Functions for error messages.
Builds gum::prm::PRMType from gum::prm::o3prm::O3Type, gum::prm::o3prm::O3IntType and gum::prm::o3prm...
Definition: O3TypeFactory.h:59
std::vector< O3RealType *> __o3RealTypes
Definition: O3TypeFactory.h:88
Errors container (at least) for parser.
Sets of elements (i.e.
PRM< GUM_SCALAR > * __prm
Definition: O3TypeFactory.h:74
Headers of PRM.
std::vector< O3Type *> __o3Types
Definition: O3TypeFactory.h:86
The O3Type is part of the AST of the O3PRM language.
Definition: O3prm.h:202
Headers for the O3NameSolver class.
This class is used contain and manipulate gum::ParseError.
HashTable< std::string, O3Type *> __typeMap
Definition: O3TypeFactory.h:83
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
HashTable< NodeId, O3Type *> __nodeMap
Definition: O3TypeFactory.h:84
The class for generic Hash Tables.
Definition: hashTable.h:676
Resolves names for the different O3PRM factories.
Definition: O3NameSolver.h:55
Implementation for the O3TypeFactory class.
bool __isPrimitiveType(O3Type &type)
O3TypeFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
std::vector< O3IntType *> __o3IntTypes
Definition: O3TypeFactory.h:87
Headers for the AST of the O3PRM language.
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
Definition: PRM.h:63
O3NameSolver< GUM_SCALAR > * __solver
Definition: O3TypeFactory.h:76
HashTable< std::string, O3Type *> __superMap
Definition: O3TypeFactory.h:81
The O3PRM is part of the AST of the O3PRM language.
Definition: O3prm.h:890
O3TypeFactory & operator=(const O3TypeFactory< GUM_SCALAR > &src)
Base class for dag.
Definition: DAG.h:99
Class hash tables iterators.
Headers of PRMFactory.