aGrUM  0.14.2
BIFXMLBNReader.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
68 #ifndef GUM_BIF_XML_BN_READER_H
69 #define GUM_BIF_XML_BN_READER_H
70 
71 #define TIXML_USE_TICPP
72 
73 #include <list>
74 #include <sstream>
75 #include <string>
76 
77 #include <agrum/BN/io/BNReader.h>
78 #include <agrum/agrum.h>
83 
84 namespace gum {
85 
98  template < typename GUM_SCALAR >
99  class BIFXMLBNReader : BNReader< GUM_SCALAR > {
100  public:
106  BIFXMLBNReader(BayesNet< GUM_SCALAR >* bn, const std::string& filePath);
107 
111  ~BIFXMLBNReader() final;
112 
119  Size proceed() final;
120 
126  typename gum::Signaler2< int, std::string > onProceed;
127 
128  private:
132  void __parsingVariables(ticpp::Element* parentNetwork);
133 
137  void __fillingBN(ticpp::Element* parentNetwork);
138 
144 
148  std::string __filePath;
149  };
150 
151 
152 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
153  extern template class BIFXMLBNReader< double >;
154 #endif
155 
156 } /* namespace gum */
157 
159 
160 #endif // GUM_BIF_XML_BN_READER_H
Class representing a Bayesian Network.
Definition: BayesNet.h:76
void __parsingVariables(ticpp::Element *parentNetwork)
Parsing xml element containing data on variables.
Wrapper around TiXmlElement.
Definition: ticpp.h:1493
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
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Pure virtual class for reading a BN from a file.
Definition: BNReader.h:52
Classes of signaler.
void __fillingBN(ticpp::Element *parentNetwork)
fill the diagram
Class of gum::Signaler2.
Definition of abstract classes for file input manipulation of Bayesian Networks.
<agrum/BN/io/BIFXML/BIFXMLBNReader.h>
gum::Signaler2< int, std::string > onProceed
Signaler used to indicates how many percent of the Xml files have been parsed yet.
Size proceed() final
Reads the bayes net from the file referenced by filePath given at the creation of class...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
BIFXMLBNReader(BayesNet< GUM_SCALAR > *bn, const std::string &filePath)
Constructor A reader is created to reading a defined file.
Base class for labelized discrete random variables.
~BIFXMLBNReader() final
Default destructor.