1 /* C_Polyhedron 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_C_Polyhedron_inlines_hh
25 #define PPL_C_Polyhedron_inlines_hh 1
26
27 #include <algorithm>
28 #include <stdexcept>
29
30 namespace Parma_Polyhedra_Library {
31
32 inline
~C_Polyhedron()33 C_Polyhedron::~C_Polyhedron() {
34 }
35
36 inline
C_Polyhedron(dimension_type num_dimensions,Degenerate_Element kind)37 C_Polyhedron::C_Polyhedron(dimension_type num_dimensions,
38 Degenerate_Element kind)
39 : Polyhedron(NECESSARILY_CLOSED,
40 check_space_dimension_overflow(num_dimensions,
41 NECESSARILY_CLOSED,
42 "C_Polyhedron(n, k)",
43 "n exceeds the maximum "
44 "allowed space dimension"),
45 kind) {
46 }
47
48 inline
C_Polyhedron(const Constraint_System & cs)49 C_Polyhedron::C_Polyhedron(const Constraint_System& cs)
50 : Polyhedron(NECESSARILY_CLOSED,
51 check_obj_space_dimension_overflow(cs, NECESSARILY_CLOSED,
52 "C_Polyhedron(cs)",
53 "the space dimension of cs "
54 "exceeds the maximum allowed "
55 "space dimension")) {
56 }
57
58 inline
C_Polyhedron(Constraint_System & cs,Recycle_Input)59 C_Polyhedron::C_Polyhedron(Constraint_System& cs, Recycle_Input)
60 : Polyhedron(NECESSARILY_CLOSED,
61 check_obj_space_dimension_overflow(cs, NECESSARILY_CLOSED,
62 "C_Polyhedron(cs, recycle)",
63 "the space dimension of cs "
64 "exceeds the maximum allowed "
65 "space dimension"),
66 Recycle_Input()) {
67 }
68
69 inline
C_Polyhedron(const Generator_System & gs)70 C_Polyhedron::C_Polyhedron(const Generator_System& gs)
71 : Polyhedron(NECESSARILY_CLOSED,
72 check_obj_space_dimension_overflow(gs, NECESSARILY_CLOSED,
73 "C_Polyhedron(gs)",
74 "the space dimension of gs "
75 "exceeds the maximum allowed "
76 "space dimension")) {
77 }
78
79 inline
C_Polyhedron(Generator_System & gs,Recycle_Input)80 C_Polyhedron::C_Polyhedron(Generator_System& gs, Recycle_Input)
81 : Polyhedron(NECESSARILY_CLOSED,
82 check_obj_space_dimension_overflow(gs, NECESSARILY_CLOSED,
83 "C_Polyhedron(gs, recycle)",
84 "the space dimension of gs "
85 "exceeds the maximum allowed "
86 "space dimension"),
87 Recycle_Input()) {
88 }
89
90 template <typename Interval>
91 inline
C_Polyhedron(const Box<Interval> & box,Complexity_Class)92 C_Polyhedron::C_Polyhedron(const Box<Interval>& box, Complexity_Class)
93 : Polyhedron(NECESSARILY_CLOSED,
94 check_obj_space_dimension_overflow(box, NECESSARILY_CLOSED,
95 "C_Polyhedron(box)",
96 "the space dimension of box "
97 "exceeds the maximum allowed "
98 "space dimension")) {
99 }
100
101 template <typename U>
102 inline
C_Polyhedron(const BD_Shape<U> & bd,Complexity_Class)103 C_Polyhedron::C_Polyhedron(const BD_Shape<U>& bd, Complexity_Class)
104 : Polyhedron(NECESSARILY_CLOSED,
105 check_space_dimension_overflow(bd.space_dimension(),
106 NECESSARILY_CLOSED,
107 "C_Polyhedron(bd)",
108 "the space dimension of bd "
109 "exceeds the maximum allowed "
110 "space dimension"),
111 UNIVERSE) {
112 add_constraints(bd.constraints());
113 }
114
115 template <typename U>
116 inline
C_Polyhedron(const Octagonal_Shape<U> & os,Complexity_Class)117 C_Polyhedron::C_Polyhedron(const Octagonal_Shape<U>& os, Complexity_Class)
118 : Polyhedron(NECESSARILY_CLOSED,
119 check_space_dimension_overflow(os.space_dimension(),
120 NECESSARILY_CLOSED,
121 "C_Polyhedron(os)",
122 "the space dimension of os "
123 "exceeds the maximum allowed "
124 "space dimension"),
125 UNIVERSE) {
126 add_constraints(os.constraints());
127 }
128
129 inline
C_Polyhedron(const C_Polyhedron & y,Complexity_Class)130 C_Polyhedron::C_Polyhedron(const C_Polyhedron& y, Complexity_Class)
131 : Polyhedron(y) {
132 }
133
134 inline C_Polyhedron&
operator =(const C_Polyhedron & y)135 C_Polyhedron::operator=(const C_Polyhedron& y) {
136 Polyhedron::operator=(y);
137 return *this;
138 }
139
140 inline C_Polyhedron&
operator =(const NNC_Polyhedron & y)141 C_Polyhedron::operator=(const NNC_Polyhedron& y) {
142 C_Polyhedron c_y(y);
143 m_swap(c_y);
144 return *this;
145 }
146
147 inline bool
upper_bound_assign_if_exact(const C_Polyhedron & y)148 C_Polyhedron::upper_bound_assign_if_exact(const C_Polyhedron& y) {
149 return poly_hull_assign_if_exact(y);
150 }
151
152 } // namespace Parma_Polyhedra_Library
153
154 #endif // !defined(PPL_C_Polyhedron_inlines_hh)
155