aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::UAIMRFReader< GUM_SCALAR > Class Template Reference

Pure virtual class for reading a MRF from a file. More...

#include <agrum/MRF/io/UAI/UAIMRFReader.h>

Inheritance diagram for gum::UAIMRFReader< GUM_SCALAR >:
Collaboration diagram for gum::UAIMRFReader< GUM_SCALAR >:

Public Member Functions

 UAIMRFReader (MarkovRandomField< GUM_SCALAR > *MN, const std::string &filename)
 Constructor A reader is defined for reading a defined file.
 ~UAIMRFReader ()
 Default destructor.
UAIMRF::Scanner & scanner ()
 Direct access to DSL scanner (mandatory for listener connection).
const std::string & streamName () const
 name of read file
bool trace () const
 accessor to trace function (just write the number of parser line)
void trace (bool b)
Size proceed () final
 parse.
void buildFromQuartets (std::vector< std::tuple< float, int, int, int > > quartets)
Size errors ()
 publishing Errors API
Size warnings ()
Idx errLine (Idx i)
 line of ith error or warning
Idx errCol (Idx i)
 col of ith error or warning
bool errIsError (Idx i)
 type of ith error or warning
std::string errMsg (Idx i)
 message of ith error or warning
void showElegantErrors (std::ostream &o=std::cerr)
 send on std::cerr the list of errorswith contents
void showElegantErrorsAndWarnings (std::ostream &o=std::cerr)
 send on std::cerr the list of errors or warnings with contents
void showErrorsAndWarnings (std::ostream &o=std::cerr)
 send on std::cerr the list of errors or warnings
void showErrorCounts (std::ostream &o=std::cerr)
 send on std::cerr the number of errors and the number of warnings

Protected Member Functions

void _addFatalError_ (Idx lig, Idx col, const std::string &s)
void _addError_ (Idx lig, Idx col, const std::string &s)
void _addWarning_ (Idx lig, Idx col, const std::string &s)

Protected Attributes

MarkovRandomField< GUM_SCALAR > * _mn_
UAIMRF::Scanner * _scanner_
UAIMRF::Parser * _parser_
std::string _streamName_
bool _traceScanning_
bool _parseDone_
bool _ioerror_

Detailed Description

template<typename GUM_SCALAR>
class gum::UAIMRFReader< GUM_SCALAR >

Pure virtual class for reading a MRF from a file.

Every class used to read the content of a Markov random field from a stream, or a file must be a subclass of UAIMRFReader.

Definition at line 82 of file UAIMRFReader.h.

Constructor & Destructor Documentation

◆ UAIMRFReader()

template<typename GUM_SCALAR>
gum::UAIMRFReader< GUM_SCALAR >::UAIMRFReader ( MarkovRandomField< GUM_SCALAR > * MN,
const std::string & filename )

Constructor A reader is defined for reading a defined file.

Hence the 2 args of the constructor. Note that the MRF has to be built outside the reader. There is no delegation to create/destroy the MRF from inside the reader.

Referenced by _addWarning_().

Here is the caller graph for this function:

◆ ~UAIMRFReader()

template<typename GUM_SCALAR>
gum::UAIMRFReader< GUM_SCALAR >::~UAIMRFReader ( )

Default destructor.

Member Function Documentation

◆ _addError_()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::_addError_ ( Idx lig,
Idx col,
const std::string & s )
protected

References _addError_().

Referenced by _addError_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addFatalError_()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::_addFatalError_ ( Idx lig,
Idx col,
const std::string & s )
protected

References _addFatalError_().

Referenced by _addFatalError_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _addWarning_()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::_addWarning_ ( Idx lig,
Idx col,
const std::string & s )
protected

References UAIMRFReader(), and _addWarning_().

Referenced by _addWarning_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildFromQuartets()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::buildFromQuartets ( std::vector< std::tuple< float, int, int, int > > quartets)

References buildFromQuartets().

Referenced by buildFromQuartets().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ errCol()

template<typename GUM_SCALAR>
Idx gum::UAIMRFReader< GUM_SCALAR >::errCol ( Idx i)

col of ith error or warning

References errCol().

Referenced by errCol().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ errIsError()

template<typename GUM_SCALAR>
bool gum::UAIMRFReader< GUM_SCALAR >::errIsError ( Idx i)

type of ith error or warning

References errIsError().

Referenced by errIsError().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ errLine()

template<typename GUM_SCALAR>
Idx gum::UAIMRFReader< GUM_SCALAR >::errLine ( Idx i)

line of ith error or warning

References errLine().

Referenced by errLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ errMsg()

template<typename GUM_SCALAR>
std::string gum::UAIMRFReader< GUM_SCALAR >::errMsg ( Idx i)

message of ith error or warning

References errMsg().

Referenced by errMsg().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ errors()

template<typename GUM_SCALAR>
Size gum::UAIMRFReader< GUM_SCALAR >::errors ( )

publishing Errors API

of errors

References errors().

Referenced by errors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proceed()

template<typename GUM_SCALAR>
Size gum::UAIMRFReader< GUM_SCALAR >::proceed ( )
final

parse.

Returns
the number of detected errors
Exceptions
IOErrorif file not exists

◆ scanner()

template<typename GUM_SCALAR>
UAIMRF::Scanner & gum::UAIMRFReader< GUM_SCALAR >::scanner ( )

Direct access to DSL scanner (mandatory for listener connection).

Exceptions
IOErrorif file not exists

◆ showElegantErrors()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::showElegantErrors ( std::ostream & o = std::cerr)

send on std::cerr the list of errorswith contents

References showElegantErrors().

Referenced by showElegantErrors().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showElegantErrorsAndWarnings()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::showElegantErrorsAndWarnings ( std::ostream & o = std::cerr)

send on std::cerr the list of errors or warnings with contents

References showElegantErrorsAndWarnings().

Referenced by showElegantErrorsAndWarnings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showErrorCounts()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::showErrorCounts ( std::ostream & o = std::cerr)

send on std::cerr the number of errors and the number of warnings

References showErrorCounts().

Referenced by showErrorCounts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showErrorsAndWarnings()

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::showErrorsAndWarnings ( std::ostream & o = std::cerr)

send on std::cerr the list of errors or warnings

References showErrorsAndWarnings().

Referenced by showErrorsAndWarnings().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ streamName()

template<typename GUM_SCALAR>
const std::string & gum::UAIMRFReader< GUM_SCALAR >::streamName ( ) const

name of read file

◆ trace() [1/2]

template<typename GUM_SCALAR>
bool gum::UAIMRFReader< GUM_SCALAR >::trace ( ) const

accessor to trace function (just write the number of parser line)

◆ trace() [2/2]

template<typename GUM_SCALAR>
void gum::UAIMRFReader< GUM_SCALAR >::trace ( bool b)

◆ warnings()

template<typename GUM_SCALAR>
Size gum::UAIMRFReader< GUM_SCALAR >::warnings ( )

of errors

References warnings().

Referenced by warnings().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _ioerror_

template<typename GUM_SCALAR>
bool gum::UAIMRFReader< GUM_SCALAR >::_ioerror_
protected

Definition at line 159 of file UAIMRFReader.h.

◆ _mn_

template<typename GUM_SCALAR>
MarkovRandomField< GUM_SCALAR >* gum::UAIMRFReader< GUM_SCALAR >::_mn_
protected

Definition at line 149 of file UAIMRFReader.h.

◆ _parseDone_

template<typename GUM_SCALAR>
bool gum::UAIMRFReader< GUM_SCALAR >::_parseDone_
protected

Definition at line 155 of file UAIMRFReader.h.

◆ _parser_

template<typename GUM_SCALAR>
UAIMRF::Parser* gum::UAIMRFReader< GUM_SCALAR >::_parser_
protected

Definition at line 151 of file UAIMRFReader.h.

◆ _scanner_

template<typename GUM_SCALAR>
UAIMRF::Scanner* gum::UAIMRFReader< GUM_SCALAR >::_scanner_
protected

Definition at line 150 of file UAIMRFReader.h.

◆ _streamName_

template<typename GUM_SCALAR>
std::string gum::UAIMRFReader< GUM_SCALAR >::_streamName_
protected

Definition at line 153 of file UAIMRFReader.h.

◆ _traceScanning_

template<typename GUM_SCALAR>
bool gum::UAIMRFReader< GUM_SCALAR >::_traceScanning_
protected

Definition at line 154 of file UAIMRFReader.h.


The documentation for this class was generated from the following file: