1 /* PIP_Tree related class implementation: inline functions.
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_PIP_Tree_inlines_hh
25 #define PPL_PIP_Tree_inlines_hh 1
26 
27 namespace Parma_Polyhedra_Library {
28 
29 inline
Tableau()30 PIP_Solution_Node::Tableau::Tableau()
31   : s(), t(), denom(1) {
32   PPL_ASSERT(OK());
33 }
34 
35 inline
Tableau(const Tableau & y)36 PIP_Solution_Node::Tableau::Tableau(const Tableau& y)
37   : s(y.s), t(y.t), denom(y.denom) {
38   PPL_ASSERT(OK());
39 }
40 
41 inline
~Tableau()42 PIP_Solution_Node::Tableau::~Tableau() {
43 }
44 
45 inline bool
is_integer() const46 PIP_Solution_Node::Tableau::is_integer() const {
47   return denom == 1;
48 }
49 
50 inline Coefficient_traits::const_reference
denominator() const51 PIP_Solution_Node::Tableau::denominator() const {
52   return denom;
53 }
54 
55 inline void
set_parent(const PIP_Decision_Node * p)56 PIP_Tree_Node::set_parent(const PIP_Decision_Node* p) {
57   parent_ = p;
58 }
59 
60 inline const PIP_Decision_Node*
parent() const61 PIP_Tree_Node::parent() const {
62   return parent_;
63 }
64 
65 inline const PIP_Problem*
get_owner() const66 PIP_Tree_Node::get_owner() const {
67   return owner_;
68 }
69 
70 inline const Constraint_System&
constraints() const71 PIP_Tree_Node::constraints() const {
72   return constraints_;
73 }
74 
75 inline PIP_Tree_Node::Artificial_Parameter_Sequence::const_iterator
art_parameter_begin() const76 PIP_Tree_Node::art_parameter_begin() const {
77   return artificial_parameters.begin();
78 }
79 
80 inline PIP_Tree_Node::Artificial_Parameter_Sequence::const_iterator
art_parameter_end() const81 PIP_Tree_Node::art_parameter_end() const {
82   return artificial_parameters.end();
83 }
84 
85 inline dimension_type
art_parameter_count() const86 PIP_Tree_Node::art_parameter_count() const {
87   return artificial_parameters.size();
88 }
89 
90 inline
91 const PIP_Tree_Node*
child_node(bool b) const92 PIP_Decision_Node::child_node(bool b) const {
93   return b ? true_child : false_child;
94 }
95 
96 inline
97 PIP_Tree_Node*
child_node(bool b)98 PIP_Decision_Node::child_node(bool b) {
99   return b ? true_child : false_child;
100 }
101 
102 inline
Artificial_Parameter()103 PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter()
104   : Linear_Expression(), denom(1) {
105   PPL_ASSERT(OK());
106 }
107 
108 inline
109 PIP_Tree_Node::Artificial_Parameter
Artificial_Parameter(const Artificial_Parameter & y)110 ::Artificial_Parameter(const Artificial_Parameter& y)
111   : Linear_Expression(y), denom(y.denom) {
112   PPL_ASSERT(OK());
113 }
114 
115 inline Coefficient_traits::const_reference
denominator() const116 PIP_Tree_Node::Artificial_Parameter::denominator() const {
117   return denom;
118 }
119 
120 inline void
m_swap(Artificial_Parameter & y)121 PIP_Tree_Node::Artificial_Parameter::m_swap(Artificial_Parameter& y) {
122   Linear_Expression::m_swap(y);
123   using std::swap;
124   swap(denom, y.denom);
125 }
126 
127 /*! \relates PIP_Tree_Node::Artificial_Parameter */
128 inline void
swap(PIP_Tree_Node::Artificial_Parameter & x,PIP_Tree_Node::Artificial_Parameter & y)129 swap(PIP_Tree_Node::Artificial_Parameter& x,
130      PIP_Tree_Node::Artificial_Parameter& y) {
131   x.m_swap(y);
132 }
133 
134 } // namespace Parma_Polyhedra_Library
135 
136 #endif // !defined(PPL_PIP_Tree_inlines_hh)
137