aGrUM  0.16.0
BIFXMLBNWriter.h
Go to the documentation of this file.
1 
32 #ifndef GUM_BIF_XML_BN_WRITER_H
33 #define GUM_BIF_XML_BN_WRITER_H
34 
35 #define TIXML_USE_TICPP
36 
37 #include <fstream>
38 #include <iostream>
39 #include <sstream>
40 #include <string>
41 
42 #include <agrum/BN/io/BNWriter.h>
43 #include <agrum/agrum.h>
44 
45 namespace gum {
46 
59  template < typename GUM_SCALAR >
60  class BIFXMLBNWriter : public BNWriter< GUM_SCALAR > {
61  public:
62  // ==========================================================================
64  // ==========================================================================
66 
71 
75  ~BIFXMLBNWriter() final;
76 
78 
86  void write(std::ostream& output, const IBayesNet< GUM_SCALAR >& bn) final;
87 
97  void write(const std::string& filePath,
98  const IBayesNet< GUM_SCALAR >& bn) final;
99 
100  private:
104  std::string __heading(const IBayesNet< GUM_SCALAR >& bn);
105 
109  std::string __documentend();
110 
114  std::string __variableBloc(const DiscreteVariable& var);
115 
120  std::string __variableDefinition(const NodeId& varNodeId,
121  const IBayesNet< GUM_SCALAR >& bn);
122  };
123 
124 
125 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
126  extern template class BIFXMLBNWriter< double >;
127 #endif
128 
129 } /* namespace gum */
130 
132 #endif // GUM_BIF_XML_BN_WRITER_H
BIFXMLBNWriter()
Default constructor.
std::string __heading(const IBayesNet< GUM_SCALAR > &bn)
Returns the header of the BIF file.
Base class for discrete random variable.
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:62
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
std::string __variableBloc(const DiscreteVariable &var)
Returns a bloc defining a variable in the BIF format.
std::string __documentend()
Returns the end of the BIF file.
std::string __variableDefinition(const NodeId &varNodeId, const IBayesNet< GUM_SCALAR > &bn)
Returns a bloc defining a variable&#39;s table (if she has) in the BIF format.
void write(std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final
Writes an bayes net in the given ouput stream.
~BIFXMLBNWriter() final
Destructor.
<agrum/BN/io/BIFXML/BIFXMLBNWriter.h>
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Pure virtual class for writting a BN to a file.
Definition: BNWriter.h:57
Size NodeId
Type for node ids.
Definition: graphElements.h:98