[PPL-devel] [GIT] ppl/ppl(pip): Fixed ASCII dump/load methods, solving compilation issues.

Francois GALEA fgalea at verlaine.prism.uvsq.fr
Fri Sep 18 11:33:29 CEST 2009


Module: ppl/ppl
Branch: pip
Commit: 1271e1583604aec39697a3998ad8de90b3df5bf5
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=1271e1583604aec39697a3998ad8de90b3df5bf5

Author: Francois GALEA <fgalea at verlaine.prism.uvsq.fr>
Date:   Fri Sep 18 11:32:12 2009 +0200

Fixed ASCII dump/load methods, solving compilation issues.

---

 src/PIP_Tree.cc      |   25 +++++++++++++++++++++++--
 src/PIP_Tree.defs.hh |    3 +++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index abdb0d5..8ed994e 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -340,6 +340,23 @@ PIP_Solution_Node::Rational_Matrix::scale(const Coefficient &ratio) {
 }
 
 void
+PIP_Tree_Node::ascii_dump(std::ostream& s) const {
+  s << "\nconstraints_\n";
+  constraints_.ascii_dump(s);
+}
+
+bool
+PIP_Tree_Node::ascii_load(std::istream& s) {
+  std::string str;
+  if (!(s >> str) || str != "constraints_")
+    return false;
+  constraints_.ascii_load(s);
+
+  PPL_ASSERT(OK());
+  return true;
+}
+
+void
 PIP_Solution_Node::Rational_Matrix::ascii_dump(std::ostream& s) const {
   s << "denominator " << denominator << "\n";
   Matrix::ascii_dump(s);
@@ -360,6 +377,8 @@ PIP_Solution_Node::Rational_Matrix::ascii_load(std::istream& s) {
 
 void
 PIP_Solution_Node::ascii_dump(std::ostream& s) const {
+  PIP_Tree_Node::ascii_dump(s);
+
   s << "\nvariable_tableau\n";
   tableau.s.ascii_dump(s);
 
@@ -367,11 +386,13 @@ PIP_Solution_Node::ascii_dump(std::ostream& s) const {
   tableau.t.ascii_dump(s);
 }
 
-
 bool
 PIP_Solution_Node::ascii_load(std::istream& s) {
+  if (!PIP_Tree_Node::ascii_load(s))
+    return false;
+
   std::string str;
-  if (!(s >> str) || str != "simplex_tableau")
+  if (!(s >> str) || str != "variable_tableau")
     return false;
   if (!tableau.s.ascii_load(s))
     return false;
diff --git a/src/PIP_Tree.defs.hh b/src/PIP_Tree.defs.hh
index f23bf31..7ac9ec2 100644
--- a/src/PIP_Tree.defs.hh
+++ b/src/PIP_Tree.defs.hh
@@ -70,6 +70,9 @@ public:
   */
   const Constraint_System& constraints() const;
 
+  void ascii_dump(std::ostream& s) const;
+  bool ascii_load(std::istream& s);
+
 protected:
   //! Default constructor.
   PIP_Tree_Node();




More information about the PPL-devel mailing list