aGrUM  0.14.2
BIFXMLIDWriter.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  ***************************************************************************/
29 #ifndef GUM_BIF_XML_ID_WRITER_H
30 #define GUM_BIF_XML_ID_WRITER_H
31 
32 #define TIXML_USE_TICPP
33 
34 #include <fstream>
35 #include <iostream>
36 #include <sstream>
37 #include <string>
38 
39 #include <agrum/ID/io/IDWriter.h>
40 #include <agrum/agrum.h>
41 
42 namespace gum {
43 
55  template < typename GUM_SCALAR >
56 
57  class BIFXMLIDWriter : public IDWriter< GUM_SCALAR > {
58  public:
59  // ==========================================================================
61  // ==========================================================================
63 
68 
72  virtual ~BIFXMLIDWriter();
73 
75 
83  virtual void write(std::ostream& output,
84  const InfluenceDiagram< GUM_SCALAR >& infdiag);
85 
95  virtual void write(std::string filePath,
96  const InfluenceDiagram< GUM_SCALAR >& infdiag);
97 
98  private:
102  std::string __heading();
103 
107  std::string __documentend();
108 
112  std::string __variableBloc(const DiscreteVariable& var, int nodeType);
113 
118  std::string
119  __variableDefinition(const NodeId& varNodeId,
120  const InfluenceDiagram< GUM_SCALAR >& infdiag);
121  };
122 } /* namespace gum */
123 
125 #endif // GUM_BIF_XML_ID_WRITER_H
Writes an influence diagram in a XML files with BIF formatThis class export an influence diagram into...
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Pure virtual class for exporting an ID.
Definition: IDWriter.h:48
std::string __documentend()
Returns the end of the BIF file.
BIFXMLIDWriter()
Default constructor.
virtual void write(std::ostream &output, const InfluenceDiagram< GUM_SCALAR > &infdiag)
Writes an influence diagram in the given ouput stream.
Head of abstract classe for export of influence diagram.
virtual ~BIFXMLIDWriter()
Destructor.
Size NodeId
Type for node ids.
Definition: graphElements.h:97
std::string __variableBloc(const DiscreteVariable &var, int nodeType)
Returns a bloc defining a variable in the BIF format.
std::string __variableDefinition(const NodeId &varNodeId, const InfluenceDiagram< GUM_SCALAR > &infdiag)
Returns a bloc defining a variable&#39;s table (if she has) in the BIF format.
std::string __heading()
Returns the header of the BIF file.
Class representing an Influence Diagram.