1 /* Doubly_Linked_Object 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_Doubly_Linked_Object_inlines_hh
25 #define PPL_Doubly_Linked_Object_inlines_hh 1
26
27 namespace Parma_Polyhedra_Library {
28
29 namespace Implementation {
30
31 inline
Doubly_Linked_Object()32 Doubly_Linked_Object::Doubly_Linked_Object() {
33 }
34
35 inline
Doubly_Linked_Object(Doubly_Linked_Object * f,Doubly_Linked_Object * b)36 Doubly_Linked_Object::Doubly_Linked_Object(Doubly_Linked_Object* f,
37 Doubly_Linked_Object* b)
38 : next(f),
39 prev(b) {
40 }
41
42 inline void
insert_before(Doubly_Linked_Object & y)43 Doubly_Linked_Object::insert_before(Doubly_Linked_Object& y) {
44 y.next = this;
45 y.prev = prev;
46 prev->next = &y;
47 prev = &y;
48 }
49
50 inline void
insert_after(Doubly_Linked_Object & y)51 Doubly_Linked_Object::insert_after(Doubly_Linked_Object& y) {
52 y.next = next;
53 y.prev = this;
54 next->prev = &y;
55 next = &y;
56 }
57
58 inline Doubly_Linked_Object*
erase()59 Doubly_Linked_Object::erase() {
60 next->prev = prev;
61 prev->next = next;
62 return next;
63 }
64
65 inline
~Doubly_Linked_Object()66 Doubly_Linked_Object::~Doubly_Linked_Object() {
67 erase();
68 }
69
70 } // namespace Implementation
71
72 } // namespace Parma_Polyhedra_Library
73
74 #endif // !defined(PPL_Doubly_Linked_Object_inlines_hh)
75