aGrUM  0.14.2
link.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 #ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H
28 #define GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H
29 
30 // ============================================================================
31 #include <agrum/agrum.h>
32 // ============================================================================
34 // ============================================================================
35 
36 namespace gum {
37 
47  template < typename T >
48  class Link {
49  public:
50  // ============================================================================
52  // ============================================================================
54 
58  explicit Link(const T& elem);
59 
63  Link(const T& elem, Link< T >* nextLink);
64 
68  ~Link();
69 
73  void* operator new(size_t s);
74 
78  void operator delete(void* p);
79 
81  // ============================================================================
83  // ============================================================================
85 
89  const T& element() const;
90 
94  T& element();
95 
99  const Link< T >* nextLink() const;
100 
104  Link< T >* nextLink();
105 
109  void setNextLink(Link< T >* newLink);
110 
112 
113  private:
116 
119  };
120 
130  template < typename T >
131  class LinkedList {
132  public:
133  // ============================================================================
135  // ============================================================================
137 
138  // ============================================================================
140  // ============================================================================
141  LinkedList();
142 
143  // ============================================================================
145  // ============================================================================
146  ~LinkedList();
147 
148  // ============================================================================
150  // ============================================================================
151  void* operator new(size_t s);
152 
153  // ============================================================================
155  // ============================================================================
156  void operator delete(void* p);
157 
159  // ============================================================================
161  // ============================================================================
163 
167  const Link< T >* list() const;
168 
172  Link< T >* list();
173 
177  void clear();
178 
182  void addLink(const T& elem);
183 
187  void searchAndRemoveLink(const T& elem);
188 
190 
191  private:
194  };
195 
196 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
197  extern template class Link< Idx >;
198 #endif
199 
200 } // End of namespace gum
201 
203 
204 #endif /* GUM_MULTI_DIM_FUNCTION_GRAPH_LINK_H */
Headers of gum::SmallObjectAllocator.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Link< T > * __firstLink
The first link of our list.
Definition: link.h:193
Chain list allocated using the SmallObjectAllocator.
Definition: link.h:131