Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvlink.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * WvLink is one element of a linked list.
00006  * Used by wvlinklist.h.
00007  */
00008 #ifndef __WVLINK_H
00009 #define __WVLINK_H
00010 
00011 #include <stdlib.h>  // for 'NULL'
00012 
00013 /**
00014  * WvLink is one element of a WvList<T>.
00015  * 
00016  * Note that WvLink itself is untyped to minimize the amount of
00017  * generated code.  This means that WvLink cannot handle the
00018  * auto_free behaviour itself which would require static type
00019  * information.  Instead, it defers this behaviour to the
00020  * template instantiation of WvList<T> that uses it.
00021  * 
00022  */
00023 class WvLink
00024 {
00025 public:
00026     void *data;
00027     WvLink *next;
00028     char *id;
00029     unsigned auto_free : 1;
00030 
00031     WvLink(void *_data, bool _auto_free, char *_id = NULL)
00032         { data = _data; next = NULL; auto_free = (unsigned)_auto_free;
00033             id = _id; }
00034 
00035     WvLink(void *_data, WvLink *prev, WvLink *&tail, bool _auto_free,
00036            char *_id = NULL);
00037 
00038     void unlink(WvLink *prev)
00039     {
00040         prev->next = next;
00041         delete this;
00042     }
00043 };
00044 
00045 #define WvIterStuff(_type_) \
00046     /*! @brief Returns a reference to the current element. */ \
00047     _type_ &operator () () const \
00048         { return *ptr(); } \
00049     /*! @brief Returns a pointer to the current element. */ \
00050     _type_ *operator -> () const \
00051         { return ptr(); } \
00052     /*! @brief Returns a reference to the current element. */ \
00053     _type_ &operator* () const \
00054         { return *ptr(); }
00055 
00056 #endif // __WVLINK_H

Generated on Sat Feb 21 21:05:29 2004 for WvStreams by doxygen 1.3.5