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