aGrUM  0.16.0
gum::UAIReader< GUM_SCALAR > Class Template Reference

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

#include <agrum/BN/io/UAI/UAIReader.h>

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

Public Member Functions

 UAIReader (BayesNet< GUM_SCALAR > *bn, const std::string &filename)
 Constructor A reader is defined for reading a defined file. More...
 
 ~UAIReader () final
 Default destructor. More...
 
UAI::Scanner & scanner ()
 Direct access to DSL scanner (mandatory for listener connection) More...
 
const std::string & streamName () const
 name of readen 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

BayesNet< GUM_SCALAR > * __bn
 
BayesNetFactory< GUM_SCALAR > * __factory
 
UAI::Scanner * __scanner
 
UAI::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::UAIReader< GUM_SCALAR >

Pure virtual class for reading a BN from a file.

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

Definition at line 54 of file UAIReader.h.

Constructor & Destructor Documentation

◆ UAIReader()

template<typename GUM_SCALAR >
gum::UAIReader< GUM_SCALAR >::UAIReader ( BayesNet< GUM_SCALAR > *  bn,
const std::string &  filename 
)

Constructor A reader is defined for reading a defined file.

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

◆ ~UAIReader()

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

Default destructor.

Member Function Documentation

◆ __addError()

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

◆ __addFatalError()

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

◆ __addWarning()

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

◆ buildFromQuartets()

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

◆ errCol()

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

col of ith error or warning

◆ errIsError()

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

type of ith error or warning

◆ errLine()

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

line of ith error or warning

◆ errMsg()

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

message of ith error or warning

◆ errors()

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

publishing Errors API

of errors

◆ proceed()

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

parse.

Returns
the number of detected errors
Exceptions
IOErrorif file not exists

Implements gum::BNReader< GUM_SCALAR >.

◆ scanner()

template<typename GUM_SCALAR >
UAI::Scanner& gum::UAIReader< GUM_SCALAR >::scanner ( )

Direct access to DSL scanner (mandatory for listener connection)

Exceptions
IOErrorif file not exists

◆ showElegantErrors()

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

send on std::cerr the list of errorswith contents

◆ showElegantErrorsAndWarnings()

template<typename GUM_SCALAR >
void gum::UAIReader< 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::UAIReader< 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::UAIReader< 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::UAIReader< GUM_SCALAR >::streamName ( ) const

name of readen file

◆ trace() [1/2]

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

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

◆ trace() [2/2]

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

◆ warnings()

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

of errors

Member Data Documentation

◆ __bn

template<typename GUM_SCALAR >
BayesNet< GUM_SCALAR >* gum::UAIReader< GUM_SCALAR >::__bn
protected

Definition at line 122 of file UAIReader.h.

◆ __factory

template<typename GUM_SCALAR >
BayesNetFactory< GUM_SCALAR >* gum::UAIReader< GUM_SCALAR >::__factory
protected

Definition at line 123 of file UAIReader.h.

◆ __ioerror

template<typename GUM_SCALAR >
bool gum::UAIReader< GUM_SCALAR >::__ioerror
protected

Definition at line 133 of file UAIReader.h.

◆ __parseDone

template<typename GUM_SCALAR >
bool gum::UAIReader< GUM_SCALAR >::__parseDone
protected

Definition at line 129 of file UAIReader.h.

◆ __parser

template<typename GUM_SCALAR >
UAI::Parser* gum::UAIReader< GUM_SCALAR >::__parser
protected

Definition at line 125 of file UAIReader.h.

◆ __scanner

template<typename GUM_SCALAR >
UAI::Scanner* gum::UAIReader< GUM_SCALAR >::__scanner
protected

Definition at line 124 of file UAIReader.h.

◆ __streamName

template<typename GUM_SCALAR >
std::string gum::UAIReader< GUM_SCALAR >::__streamName
protected

Definition at line 127 of file UAIReader.h.

◆ __traceScanning

template<typename GUM_SCALAR >
bool gum::UAIReader< GUM_SCALAR >::__traceScanning
protected

Definition at line 128 of file UAIReader.h.


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