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

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

#include <agrum/MN/io/UAI/UAIMNReader.h>

+ Inheritance diagram for gum::UAIMNReader< GUM_SCALAR >:
+ Collaboration diagram for gum::UAIMNReader< GUM_SCALAR >:

Public Member Functions

 UAIMNReader (MarkovNet< GUM_SCALAR > *MN, const std::string &filename)
 Constructor A reader is defined for reading a defined file. More...
 
 ~UAIMNReader () final
 Default destructor. More...
 
UAIMN::Scanner & scanner ()
 Direct access to DSL scanner (mandatory for listener connection) More...
 
const std::string & streamName () const
 name of read file More...
 
bool trace () const
 accessor to trace function (just write the number of parser line) More...
 
void trace (bool b)
 
Size proceed () final
 parse. More...
 
void buildFromQuartets (std::vector< std::tuple< float, int, int, int > > quartets)
 
Size errors ()
 publishing Errors API More...
 
Size warnings ()
 

of errors

More...
 
Idx errLine (Idx i)
 line of ith error or warning More...
 
Idx errCol (Idx i)
 col of ith error or warning More...
 
bool errIsError (Idx i)
 type of ith error or warning More...
 
std::string errMsg (Idx i)
 message of ith error or warning More...
 
void showElegantErrors (std::ostream &o=std::cerr)
 send on std::cerr the list of errorswith contents More...
 
void showElegantErrorsAndWarnings (std::ostream &o=std::cerr)
 send on std::cerr the list of errors or warnings with contents More...
 
void showErrorsAndWarnings (std::ostream &o=std::cerr)
 send on std::cerr the list of errors or warnings More...
 
void showErrorCounts (std::ostream &o=std::cerr)
 send on std::cerr the number of errors and the number of warnings More...
 

Protected Attributes

MarkovNet< GUM_SCALAR > * mn__
 
UAIMN::Scanner * scanner__
 
UAIMN::Parser * parser__
 
std::string streamName__
 
bool traceScanning__
 
bool parseDone__
 
bool ioerror__
 

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)
 

Detailed Description

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

Pure virtual class for reading a MN from a file.

Every class used to read the content of a Markov Network from a stream, or a file must be a subclass of UAIMNReader.

Definition at line 60 of file UAIMNReader.h.

Constructor & Destructor Documentation

◆ UAIMNReader()

template<typename GUM_SCALAR >
gum::UAIMNReader< GUM_SCALAR >::UAIMNReader ( MarkovNet< 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 MN has to be built outside the reader. There is no delegation to create/destroy the MN from inside the reader.

◆ ~UAIMNReader()

template<typename GUM_SCALAR >
gum::UAIMNReader< GUM_SCALAR >::~UAIMNReader ( )
final

Default destructor.

Member Function Documentation

◆ addError__()

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

◆ addFatalError__()

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

◆ addWarning__()

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

◆ buildFromQuartets()

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

◆ errCol()

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

col of ith error or warning

◆ errIsError()

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

type of ith error or warning

◆ errLine()

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

line of ith error or warning

◆ errMsg()

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

message of ith error or warning

◆ errors()

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

publishing Errors API

of errors

◆ proceed()

template<typename GUM_SCALAR >
Size gum::UAIMNReader< GUM_SCALAR >::proceed ( )
finalvirtual

parse.

Returns
the number of detected errors
Exceptions
IOErrorif file not exists

Implements gum::MNReader< GUM_SCALAR >.

◆ scanner()

template<typename GUM_SCALAR >
UAIMN::Scanner& gum::UAIMNReader< GUM_SCALAR >::scanner ( )

Direct access to DSL scanner (mandatory for listener connection)

Exceptions
IOErrorif file not exists

◆ showElegantErrors()

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

send on std::cerr the list of errorswith contents

◆ showElegantErrorsAndWarnings()

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

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

◆ showErrorCounts()

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

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

◆ showErrorsAndWarnings()

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

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

◆ streamName()

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

name of read file

◆ trace() [1/2]

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

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

◆ trace() [2/2]

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

◆ warnings()

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

of errors

Member Data Documentation

◆ ioerror__

template<typename GUM_SCALAR >
bool gum::UAIMNReader< GUM_SCALAR >::ioerror__
protected

Definition at line 138 of file UAIMNReader.h.

◆ mn__

template<typename GUM_SCALAR >
MarkovNet< GUM_SCALAR >* gum::UAIMNReader< GUM_SCALAR >::mn__
protected

Definition at line 128 of file UAIMNReader.h.

◆ parseDone__

template<typename GUM_SCALAR >
bool gum::UAIMNReader< GUM_SCALAR >::parseDone__
protected

Definition at line 134 of file UAIMNReader.h.

◆ parser__

template<typename GUM_SCALAR >
UAIMN::Parser* gum::UAIMNReader< GUM_SCALAR >::parser__
protected

Definition at line 130 of file UAIMNReader.h.

◆ scanner__

template<typename GUM_SCALAR >
UAIMN::Scanner* gum::UAIMNReader< GUM_SCALAR >::scanner__
protected

Definition at line 129 of file UAIMNReader.h.

◆ streamName__

template<typename GUM_SCALAR >
std::string gum::UAIMNReader< GUM_SCALAR >::streamName__
protected

Definition at line 132 of file UAIMNReader.h.

◆ traceScanning__

template<typename GUM_SCALAR >
bool gum::UAIMNReader< GUM_SCALAR >::traceScanning__
protected

Definition at line 133 of file UAIMNReader.h.


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