aGrUM  0.16.0
DSLWriter.h
Go to the documentation of this file.
1 
23 #ifndef DSLWRITER_H
24 #define DSLWRITER_H
25 
26 #include <fstream>
27 #include <iostream>
28 #include <sstream>
29 #include <string>
30 
31 #include <agrum/BN/io/BNWriter.h>
32 #include <agrum/agrum.h>
33 
34 namespace gum {
35 
48  template < typename GUM_SCALAR >
49  class DSLWriter : public BNWriter< GUM_SCALAR > {
50  public:
51  // ==========================================================================
53  // ==========================================================================
55 
59  DSLWriter();
60 
64  ~DSLWriter() final;
65 
67 
75  void write(std::ostream& output, const IBayesNet< GUM_SCALAR >& bn) final;
76 
85  void write(const std::string& filePath,
86  const IBayesNet< GUM_SCALAR >& bn) final;
87 
88  private:
89  // Returns a bloc defining a variable in the DSL format.
90  std::string __variableBloc(const IBayesNet< GUM_SCALAR >& bn,
91  const DiscreteVariable& var);
92  };
93 
94 
95 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
96  extern template class gum::DSLWriter< double >;
97 #endif
98 
99 } /* namespace gum */
100 
101 #include "DSLWriter_tpl.h"
102 
103 #endif // DSLWRITER_H
~DSLWriter() final
Destructor.
Writes a IBayesNet in the DSL format.
Definition: DSLWriter.h:49
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
void write(std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final
Writes a Bayesian Network in the output stream using the DSL format.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::string __variableBloc(const IBayesNet< GUM_SCALAR > &bn, const DiscreteVariable &var)
DSLWriter()
Default constructor.
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