aGrUM  0.16.0
O3prmBNWriter.h
Go to the documentation of this file.
1 
32 #ifndef GUM_O3PRMBNWRITER_H
33 #define GUM_O3PRMBNWRITER_H
34 
35 
36 #include <fstream>
37 #include <iostream>
38 #include <sstream>
39 #include <string>
40 
41 #include <agrum/BN/io/BNWriter.h>
42 #include <agrum/agrum.h>
46 
47 namespace gum {
57  template < typename GUM_SCALAR >
58  class O3prmBNWriter : public BNWriter< GUM_SCALAR > {
59  public:
60  // ==========================================================================
62  // ==========================================================================
64 
68  O3prmBNWriter();
69 
73  virtual ~O3prmBNWriter();
74 
76 
84  virtual void write(std::ostream& output,
85  const IBayesNet< GUM_SCALAR >& bn) final;
86 
96  virtual void write(const std::string& filePath,
97  const IBayesNet< GUM_SCALAR >& bn) final;
98 
99  private:
100  std::string __extractAttribute(const IBayesNet< GUM_SCALAR >& bn, NodeId node);
101 
102  std::string __extractType(const IBayesNet< GUM_SCALAR >& bn, NodeId node);
103 
104  template < typename VARTYPE >
105  std::string __extractDiscretizedType(const VARTYPE* var);
106 
107  std::string __extractName(const IBayesNet< GUM_SCALAR >& bn, NodeId node);
108 
109  std::string __extractParents(const IBayesNet< GUM_SCALAR >& bn, NodeId node);
110 
111  std::string __extractCPT(const IBayesNet< GUM_SCALAR >& bn, NodeId node);
112 
113  std::string __extractRangeType(const IBayesNet< GUM_SCALAR >& bn, NodeId node);
114 
115  std::string __extractLabelizedType(const IBayesNet< GUM_SCALAR >& bn,
116  NodeId node);
117  };
118 
119 
120 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
121  extern template class O3prmBNWriter< double >;
122 #endif
123 
124 } /* namespace gum */
125 
127 
128 #endif // GUM_O3PRMBNWRITER_H
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::string __extractType(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
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 __extractCPT(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
O3prmBNWriter()
Default constructor.
std::string __extractRangeType(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
<agrum/PRM/o3prm/O3prmBNWriter.h>
Definition: O3prmBNWriter.h:58
std::string __extractLabelizedType(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
std::string __extractName(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
std::string __extractAttribute(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::string __extractDiscretizedType(const VARTYPE *var)
virtual ~O3prmBNWriter()
Destructor.
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
std::string __extractParents(const IBayesNet< GUM_SCALAR > &bn, NodeId node)
virtual void write(std::ostream &output, const IBayesNet< GUM_SCALAR > &bn) final
Writes an bayes net in the given ouput stream.