aGrUM  0.16.0
fmdpDatReader.h
Go to the documentation of this file.
1 
66 // ======================================================================================================
67 #ifndef FMDP_DAT_READER_H
68 #define FMDP_DAT_READER_H
69 // ======================================================================================================
70 #include <fstream>
71 #include <iostream>
72 #include <string>
73 // ======================================================================================================
74 #include <agrum/FMDP/fmdp.h>
75 #include <agrum/FMDP/fmdpFactory.h>
77 // ======================================================================================================
79 // ======================================================================================================
80 
81 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82 // including coco-generated PARSER and SCANNER
83 # include <agrum/FMDP/io/dat/cocoR/Parser.h>
84 #endif // DOXYGEN_SHOULD_SKIP_THIS
85 
86 namespace gum {
93  template < typename GUM_SCALAR >
94  class FMDPDatReader : public FMDPReader< GUM_SCALAR > {
95  public:
96  FMDPDatReader(FMDP< GUM_SCALAR >* fmdp, const std::string& filename);
98 
101  MDPDAT::Scanner& scanner();
102 
104  const std::string& streamName() const;
105 
107  bool trace() const;
108  void trace(bool b);
109 
113  Size proceed();
114 
117 
119  Size errors();
121  Size warnings();
122 
124  Idx errLine(Idx i);
126  Idx errCol(Idx i);
128  bool errIsError(Idx i);
130  std::string errMsg(Idx i);
131 
133  void showElegantErrors(std::ostream& o = std::cerr);
134 
136  void showElegantErrorsAndWarnings(std::ostream& o = std::cerr);
137 
139  void showErrorCounts(std::ostream& o = std::cerr);
141 
142  protected:
145  MDPDAT::Scanner* __scanner;
146  MDPDAT::Parser* __parser;
147 
148  std::string __streamName;
151 
152  // a boolean to throw the ioerror not in the constructor but in the
153  // proceed()
154  bool __ioerror;
155  };
156 
157 
158 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
159  extern template class FMDPDatReader< double >;
160 #endif
161 
162 } // namespace gum
163 
165 
166 #endif // FMDP_DAT_READER_H
bool errIsError(Idx i)
type of ith error or warning
FMDPDatReader(FMDP< GUM_SCALAR > *fmdp, const std::string &filename)
A factory class to ease Factored Markov Decision Process construction.
Definition: fmdpFactory.h:71
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const std::string & streamName() const
name of readen file
Size errors()
publishing Errors API
Pure virtual class for reading a FMDP from a file.
Definition: fmdpReader.h:60
FMDPFactory< GUM_SCALAR > * __factory
FMDP< GUM_SCALAR > * __fmdp
MDPDAT::Parser * __parser
Idx errCol(Idx i)
col of ith error or warning
This class is used to implement factored decision process.
Definition: fmdp.h:57
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Definition of templatized reader of FMDPDat files for Factored Markov Decision Processes.
Definition: fmdpDatReader.h:94
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void showElegantErrorsAndWarnings(std::ostream &o=std::cerr)
send on std::cerr the list of errors or warnings
MDPDAT::Scanner & scanner()
Direct access to FMDPDat scanner (mandatory for listener connection)
Size warnings()
of errors
void showElegantErrors(std::ostream &o=std::cerr)
send on std::cerr the list of errors
MDPDAT::Scanner * __scanner
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void showErrorCounts(std::ostream &o=std::cerr)
send on std::cerr the number of errors and the number of warnings
Size Idx
Type for indexes.
Definition: types.h:53
std::string errMsg(Idx i)
message of ith error or warning
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool trace() const
accessor to trace function (just write the number of parser line)
Size proceed()
parse.
std::string __streamName
Idx errLine(Idx i)
line of ith error or warning