[PPL-devel] [GIT] ppl/ppl(pip): Added constructors and comments.

Roberto Bagnara bagnara at cs.unipr.it
Sun Jun 14 21:59:36 CEST 2009


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sun Jun 14 21:57:44 2009 +0200

Added constructors and comments.

---

 src/Makefile.am            |    2 +
 src/PIP_Problem.defs.hh    |    2 +-
 src/PIP_Problem.inlines.hh |   43 +++++++++++++++++++++++++++++++++++++
 src/PIP_Tree.cc            |    6 +----
 src/PIP_Tree.defs.hh       |   51 ++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 96 insertions(+), 8 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 28ff582..8371865 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -272,7 +272,9 @@ MIP_Problem.defs.hh \
 MIP_Problem.inlines.hh \
 MIP_Problem.templates.hh \
 PIP_Tree.defs.hh \
+PIP_Tree.inlines.hh \
 PIP_Problem.defs.hh \
+PIP_Problem.inlines.hh \
 Poly_Con_Relation.defs.hh \
 Poly_Con_Relation.inlines.hh \
 Poly_Gen_Relation.defs.hh \
diff --git a/src/PIP_Problem.defs.hh b/src/PIP_Problem.defs.hh
index b7cfbbc..6dbb414 100644
--- a/src/PIP_Problem.defs.hh
+++ b/src/PIP_Problem.defs.hh
@@ -311,7 +311,7 @@ void swap(Parma_Polyhedra_Library::PIP_Problem& x,
 
 } // namespace std
 
-//#include "PIP_Problem.inlines.hh"
+#include "PIP_Problem.inlines.hh"
 //#include "PIP_Problem.templates.hh"
 
 #endif // !defined(PPL_PIP_Problem_defs_hh)
diff --git a/src/PIP_Problem.inlines.hh b/src/PIP_Problem.inlines.hh
new file mode 100644
index 0000000..97dc2a0
--- /dev/null
+++ b/src/PIP_Problem.inlines.hh
@@ -0,0 +1,43 @@
+/* PIP_Problem class implementation: inline functions.
+   Copyright (C) 2001-2009 Roberto Bagnara <bagnara at cs.unipr.it>
+
+This file is part of the Parma Polyhedra Library (PPL).
+
+The PPL is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The PPL is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
+
+For the most up-to-date information see the Parma Polyhedra Library
+site: http://www.cs.unipr.it/ppl/ . */
+
+#ifndef PPL_PIP_Problem_inlines_hh
+#define PPL_PIP_Problem_inlines_hh 1
+
+namespace Parma_Polyhedra_Library {
+
+} // namespace Parma_Polyhedra_Library
+
+namespace std {
+
+#if 0
+/*! \relates Parma_Polyhedra_Library::PIP_Problem */
+inline void
+swap(Parma_Polyhedra_Library::PIP_Problem& x,
+     Parma_Polyhedra_Library::PIP_Problem& y) {
+  x.swap(y);
+}
+#endif
+
+} // namespace std
+
+#endif // !defined(PPL_PIP_Problem_inlines_hh)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index ebd1042..dc87f7a 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -25,12 +25,9 @@ site: http://www.cs.unipr.it/ppl/ . */
 
 namespace Parma_Polyhedra_Library {
 
-PIP_Tree_Node::~PIP_Tree_Node() {
-}
-
 PIP_Decision_Node::~PIP_Decision_Node() {
-  delete false_child;
   delete true_child;
+  delete false_child;
 }
 
 const PIP_Solution_Node*
@@ -74,4 +71,3 @@ PIP_Decision_Node::as_decision() {
 }
 
 } // namespace Parma_Polyhedra_Library
-
diff --git a/src/PIP_Tree.defs.hh b/src/PIP_Tree.defs.hh
index c13fd80..0769831 100644
--- a/src/PIP_Tree.defs.hh
+++ b/src/PIP_Tree.defs.hh
@@ -24,6 +24,8 @@ site: http://www.cs.unipr.it/ppl/ . */
 #define PPL_PIP_Tree_defs_hh 1
 
 #include "PIP_Tree.types.hh"
+#include "Constraint_System.types.hh"
+#include "PIP_Problem.types.hh"
 
 namespace Parma_Polyhedra_Library {
 
@@ -82,15 +84,60 @@ public:
   //! Returns a pointer to the \v (true or false) branch of \p *this.
   PIP_Tree_Node* child_node(bool v);
 
-  // Constraint_System* get_constraints();
+  //! Returns the system of constraints controlling \p *this.
+  const Constraint_System& constraints();
 
 private:
-  PIP_Tree_Node* false_child;
+  //! Pointer to the "true" child of \p *this.
   PIP_Tree_Node* true_child;
+
+  //! Pointer to the "false" child of \p *this.
+  PIP_Tree_Node* false_child;
+
+  // Only PIP_Problem is allowed to use the constructor.
+  friend class PIP_Problem;
+
+  /*! \brief
+    Constructs if \p cs then \p tcp \p else \p fcp.
+
+    Constructs a decision node controlled by \p cs (which is copied),
+    with "true" child \p tcp and "false" child \p fcp.
+
+    \param cs
+    The system of constraints controlling the node.
+
+    \exception std::invalid_argument
+    Thrown if \p cs contains strict inequalities.
+  */
+  PIP_Decision_Node(const Constraint_System& cs,
+                    PIP_Tree_Node* fcp, PIP_Tree_Node* tcp);
+
+  /*! \brief
+    Constructs if \p cs then \p tcp \p else \p fcp.
+
+    Constructs a decision node controlled by \p cs (which is recycled),
+    with "true" child \p tcp and "false" child \p fcp.
+
+    \param cs
+    The system of constraints controlling the node.  It is not
+    declared <CODE>const</CODE> because its data-structures may be
+    recycled to build the polyhedron.
+
+    \param dummy
+    A dummy tag to syntactically differentiate this one
+    from the other constructors.
+
+    \exception std::invalid_argument
+    Thrown if \p cs contains strict inequalities.
+  */
+  PIP_Decision_Node(const Constraint_System& cs, Recycle_Input dummy,
+                    PIP_Tree_Node* fcp, PIP_Tree_Node* tcp);
 };
 
 typedef const PIP_Tree_Node* PIP_Tree;
 
 } // namespace Parma_Polyhedra_Library
 
+#include "PIP_Tree.inlines.hh"
+
 #endif // !defined(PPL_PIP_Tree_defs_hh)




More information about the PPL-devel mailing list