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

<agrum/BN/io/BIFXML/BIFXMLBNReader.h> More...

#include <BIFXMLBNReader.h>

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

Public Member Functions

 BIFXMLBNReader (BayesNet< GUM_SCALAR > *bn, std::string_view filePath)
 Constructor A reader is created to reading a defined file.
 BIFXMLBNReader (BayesNet< GUM_SCALAR > *bn, std::istream &stream)
 Constructor from an input stream.
 ~BIFXMLBNReader () override
 Default destructor.
Size proceed () final
 Reads the bayes net from the file referenced by filePath given at the creation of class.

Public Attributes

gum::Signaler< int, std::string > onProceed
 Signaler used to indicates how many percent of the Xml files have been parsed yet.

Private Member Functions

void _parsingVariables_ (ticpp::Element *parentNetwork)
 Parsing xml element containing data on variables.
void _fillingBN_ (ticpp::Element *parentNetwork)
 fill the diagram

Private Attributes

BayesNet< GUM_SCALAR > * _bn_
 An handle to the bayes net in which will be load the content of the xml filePath.
std::string _filePath_
 the path to the xml filePath
std::string _xmlContent_
 XML content when constructed from a stream (empty otherwise).
bool _isFromStream_ {false}
 True when the XML was provided via a stream rather than a file path.

Detailed Description

template<GUM_Numeric GUM_SCALAR>
class gum::BIFXMLBNReader< GUM_SCALAR >

<agrum/BN/io/BIFXML/BIFXMLBNReader.h>

Read a Bayesian network from an XML file with BIF format.

This class import a Bayesian network from an XML files using BIF format See http://www-2.cs.cmu.edu/afs/cs/user/fgcozman/www/Research/InterchangeFormat/ for information about this format.

Definition at line 123 of file BIFXMLBNReader.h.

Constructor & Destructor Documentation

◆ BIFXMLBNReader() [1/2]

template<GUM_Numeric GUM_SCALAR>
gum::BIFXMLBNReader< GUM_SCALAR >::BIFXMLBNReader ( BayesNet< GUM_SCALAR > * bn,
std::string_view filePath )

Constructor A reader is created to reading a defined file.

Note that an BN as to be created before and given in parameter.

◆ BIFXMLBNReader() [2/2]

template<GUM_Numeric GUM_SCALAR>
gum::BIFXMLBNReader< GUM_SCALAR >::BIFXMLBNReader ( BayesNet< GUM_SCALAR > * bn,
std::istream & stream )

Constructor from an input stream.

The entire stream content is consumed at construction time.

Parameters
bnBayesian network to fill.
streamInput stream containing valid BIFXML data.

◆ ~BIFXMLBNReader()

template<GUM_Numeric GUM_SCALAR>
gum::BIFXMLBNReader< GUM_SCALAR >::~BIFXMLBNReader ( )
override

Default destructor.

Member Function Documentation

◆ _fillingBN_()

template<GUM_Numeric GUM_SCALAR>
void gum::BIFXMLBNReader< GUM_SCALAR >::_fillingBN_ ( ticpp::Element * parentNetwork)
private

fill the diagram

References _fillingBN_().

Referenced by _fillingBN_().

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

◆ _parsingVariables_()

template<GUM_Numeric GUM_SCALAR>
void gum::BIFXMLBNReader< GUM_SCALAR >::_parsingVariables_ ( ticpp::Element * parentNetwork)
private

Parsing xml element containing data on variables.

References _parsingVariables_().

Referenced by _parsingVariables_().

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

◆ proceed()

template<GUM_Numeric GUM_SCALAR>
Size gum::BIFXMLBNReader< GUM_SCALAR >::proceed ( )
final

Reads the bayes net from the file referenced by filePath given at the creation of class.

Returns
Returns 0 if no error, 1 if any
Warning
XMLBNReader can not give the number of errors.

Member Data Documentation

◆ _bn_

template<GUM_Numeric GUM_SCALAR>
BayesNet< GUM_SCALAR >* gum::BIFXMLBNReader< GUM_SCALAR >::_bn_
private

An handle to the bayes net in which will be load the content of the xml filePath.

Definition at line 175 of file BIFXMLBNReader.h.

◆ _filePath_

template<GUM_Numeric GUM_SCALAR>
std::string gum::BIFXMLBNReader< GUM_SCALAR >::_filePath_
private

the path to the xml filePath

Definition at line 180 of file BIFXMLBNReader.h.

◆ _isFromStream_

template<GUM_Numeric GUM_SCALAR>
bool gum::BIFXMLBNReader< GUM_SCALAR >::_isFromStream_ {false}
private

True when the XML was provided via a stream rather than a file path.

Definition at line 190 of file BIFXMLBNReader.h.

190{false};

◆ _xmlContent_

template<GUM_Numeric GUM_SCALAR>
std::string gum::BIFXMLBNReader< GUM_SCALAR >::_xmlContent_
private

XML content when constructed from a stream (empty otherwise).

Definition at line 185 of file BIFXMLBNReader.h.

◆ onProceed

template<GUM_Numeric GUM_SCALAR>
gum::Signaler< int, std::string > gum::BIFXMLBNReader< GUM_SCALAR >::onProceed

Signaler used to indicates how many percent of the Xml files have been parsed yet.

Definition at line 158 of file BIFXMLBNReader.h.


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