summaryrefslogtreecommitdiff
path: root/src/list.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-10 21:04:17 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-10 21:04:17 +0000
commit2ba3f84ab559da02a11aa000b3cecb3b3668af61 (patch)
tree266f450b512f607ec54d54af4fa8c13fdbe7ef91 /src/list.h
parentea18007633b31901f2ae275cc0576c3f7ce99fc9 (diff)
parent3611f253f6fdfa4954d374ab85ddaa7f799c130c (diff)
downloadlibbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.gz
libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.bz2
libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.tar.xz
libbu++-2ba3f84ab559da02a11aa000b3cecb3b3668af61.zip
Merged in the core branch. This is a major update that fixes many things, and
changes many others, including source files that were deleted and renamed. Before doing this update, I reccomend a full clean, or even a fresh checkout. Things to note, most outstanding about this update: - Bu::Socket was changed to Bu::TcpSocket and the default mode is blocking. - All templatized container classes are SharedCore now, which is good, but SharedCore is inherently non-reentrant safe. However, all SharedCore classes have a "clone" function that return a non-shared copy of the object, safe for passing into a reentrant safe function accessing shared memory.
Diffstat (limited to '')
-rw-r--r--src/list.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/list.h b/src/list.h
index 9b95983..b1e0d0f 100644
--- a/src/list.h
+++ b/src/list.h
@@ -16,6 +16,7 @@
16 16
17namespace Bu 17namespace Bu
18{ 18{
19 /** @cond DEVEL */
19 template<typename value> 20 template<typename value>
20 struct ListLink 21 struct ListLink
21 { 22 {
@@ -24,10 +25,18 @@ namespace Bu
24 ListLink *pPrev; 25 ListLink *pPrev;
25 }; 26 };
26 27
27 template<typename value, typename valuealloc, 28 template<typename value, typename valuealloc, typename linkalloc>
28 typename linkalloc> 29 class List;
30
31 template<typename value, typename valuealloc, typename linkalloc>
29 struct ListCore 32 struct ListCore
30 { 33 {
34 friend class List<value, valuealloc, linkalloc>;
35 friend class SharedCore<
36 List<value, valuealloc, linkalloc>,
37 ListCore<value, valuealloc, linkalloc>
38 >;
39 private:
31 typedef struct ListLink<value> Link; 40 typedef struct ListLink<value> Link;
32 ListCore() : 41 ListCore() :
33 pFirst( NULL ), 42 pFirst( NULL ),
@@ -177,6 +186,7 @@ namespace Bu
177 } 186 }
178 } 187 }
179 }; 188 };
189 /** @endcond */
180 190
181 /** 191 /**
182 * Linked list template container. This class is similar to the stl list 192 * Linked list template container. This class is similar to the stl list
@@ -189,12 +199,15 @@ namespace Bu
189 *@param value (typename) The type of data to store in your list 199 *@param value (typename) The type of data to store in your list
190 *@param valuealloc (typename) Memory Allocator for your value type 200 *@param valuealloc (typename) Memory Allocator for your value type
191 *@param linkalloc (typename) Memory Allocator for the list links. 201 *@param linkalloc (typename) Memory Allocator for the list links.
202 *@extends SharedCore
192 *@ingroup Containers 203 *@ingroup Containers
193 */ 204 */
194 template<typename value, typename valuealloc=std::allocator<value>, 205 template<typename value, typename valuealloc=std::allocator<value>,
195 typename linkalloc=std::allocator<struct ListLink<value> > > 206 typename linkalloc=std::allocator<struct ListLink<value> > >
196 class List : public SharedCore< struct ListCore<value, valuealloc, 207 class List /** @cond */ : public SharedCore<
197 linkalloc> > 208 List<value, valuealloc, linkalloc>,
209 ListCore<value, valuealloc, linkalloc>
210 > /** @endcond */
198 { 211 {
199 private: 212 private:
200 typedef struct ListLink<value> Link; 213 typedef struct ListLink<value> Link;
@@ -202,9 +215,9 @@ namespace Bu
202 typedef struct ListCore<value, valuealloc, linkalloc> Core; 215 typedef struct ListCore<value, valuealloc, linkalloc> Core;
203 216
204 protected: 217 protected:
205 using SharedCore< Core >::core; 218 using SharedCore<MyType, Core>::core;
206 using SharedCore< Core >::_hardCopy; 219 using SharedCore<MyType, Core>::_hardCopy;
207 using SharedCore< Core >::_allocateCore; 220 using SharedCore<MyType, Core>::_allocateCore;
208 221
209 public: 222 public:
210 struct const_iterator; 223 struct const_iterator;
@@ -215,7 +228,7 @@ namespace Bu
215 } 228 }
216 229
217 List( const MyType &src ) : 230 List( const MyType &src ) :
218 SharedCore< Core >( src ) 231 SharedCore<MyType, Core >( src )
219 { 232 {
220 } 233 }
221 234