aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
fmdpReader.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 Definition of abstract classes for file input manipulation
25  * of Factored Markov Decision Process.
26  *
27  * Every classe used to read a FMDP from a file, must inherit from
28  * FMDPReader.
29  *
30  * @author Pierre-Henri WUILLEMIN(@LIP6) and Jean-Christophe MAGNAN and Christophe
31  * GONZALES(@AMU)
32  */
33 #ifndef GUM_FMDP_READER_H
34 #define GUM_FMDP_READER_H
35 //======================================================================
36 #include <iostream>
37 #include <string>
38 //======================================================================
39 #include <agrum/agrum.h>
40 //======================================================================
41 #include <agrum/FMDP/fmdp.h>
42 //======================================================================
43 
44 
45 namespace gum {
46  /* ============================================================================
47  */
48  /* === READERS === */
49  /* ============================================================================
50  */
51  /**
52  * @class FMDPReader
53  * @brief Pure virtual class for reading a FMDP from a file.
54  * @ingroup fmdp_group
55  * Every class used to read the content of a Factored Markov Decision Process
56  * from a stream,
57  * or a file must be a subclass of FMDPReader.
58  */
59  template < typename GUM_SCALAR >
60  class FMDPReader {
61  public:
62  /**
63  * Constructor
64  * A reader is defined for reading a defined file. Hence the 2 args of the
65  * constructor.
66  * Note that the FMDP has to be built outside the reader. There is no
67  * delegation to create/destroy
68  * the FMDP from inside the reader.
69  */
70  FMDPReader(FMDP< GUM_SCALAR >* fmdp, const std::string& filename);
71 
72  /**
73  * Default destructor.
74  */
75  virtual ~FMDPReader();
76 
77  /**
78  * Reads a Factored Markov Decision Process from the file referenced by
79  * filePath into`
80  * parameter fmdp.
81  * @return Returns the number of error during the parsing (0 if none).
82  */
83  virtual Size proceed() = 0;
84  };
85 
86 
87 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
88  extern template class FMDPReader< double >;
89 #endif
90 
91 
92 } /* namespace gum */
93 
94 
95 #include <agrum/FMDP/io/fmdpReader_tpl.h>
96 
97 #endif // GUM_FMDP_READER_H