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

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

#include <agrum/BN/io/net/netReader.h>

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

Public Member Functions

 NetReader (BayesNet< GUM_SCALAR > *bn, const std::string &filename)
 Constructor A reader is defined for reading a defined file. More...
 
 ~NetReader () final
 Default destructor. More...
 
net::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...
 
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_
 
net::Scanner * _scanner_
 
net::Parser * _parser_
 
std::string _streamName_
 
bool _traceScanning_
 
bool _parseDone_
 
bool _ioerror_
 

Detailed Description

template<typename GUM_SCALAR>
class gum::NetReader< 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 NetReader.

Definition at line 52 of file netReader.h.

Constructor & Destructor Documentation

◆ NetReader()

template<typename GUM_SCALAR >
gum::NetReader< GUM_SCALAR >::NetReader ( 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.

◆ ~NetReader()

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

Default destructor.

Member Function Documentation

◆ errCol()

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

col of ith error or warning

◆ errIsError()

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

type of ith error or warning

◆ errLine()

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

line of ith error or warning

◆ errMsg()

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

message of ith error or warning

◆ errors()

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

publishing Errors API

of errors

◆ proceed()

template<typename GUM_SCALAR >
Size gum::NetReader< 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 >
net::Scanner& gum::NetReader< GUM_SCALAR >::scanner ( )

Direct access to DSL scanner (mandatory for listener connection)

Exceptions
IOErrorif file not exists

◆ showElegantErrors()

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

send on std::cerr the list of errorswith contents

◆ showElegantErrorsAndWarnings()

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

name of readen file

◆ trace() [1/2]

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

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

◆ trace() [2/2]

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

◆ warnings()

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

of errors

Member Data Documentation

◆ _bn_

template<typename GUM_SCALAR >
BayesNet< GUM_SCALAR >* gum::NetReader< GUM_SCALAR >::_bn_
protected

Definition at line 117 of file netReader.h.

◆ _factory_

template<typename GUM_SCALAR >
BayesNetFactory< GUM_SCALAR >* gum::NetReader< GUM_SCALAR >::_factory_
protected

Definition at line 118 of file netReader.h.

◆ _ioerror_

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

Definition at line 128 of file netReader.h.

◆ _parseDone_

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

Definition at line 124 of file netReader.h.

◆ _parser_

template<typename GUM_SCALAR >
net::Parser* gum::NetReader< GUM_SCALAR >::_parser_
protected

Definition at line 120 of file netReader.h.

◆ _scanner_

template<typename GUM_SCALAR >
net::Scanner* gum::NetReader< GUM_SCALAR >::_scanner_
protected

Definition at line 119 of file netReader.h.

◆ _streamName_

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

Definition at line 122 of file netReader.h.

◆ _traceScanning_

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

Definition at line 123 of file netReader.h.


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