]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/dlist.h
First cut of bat rerun a Job from Jobs Run
[bacula/bacula] / bacula / src / lib / dlist.h
index 189f02231d79b27ad32401789cfafd74671887f5..dcb11f980aedf6b61fdc448b23869e5ee25c8e94 100644 (file)
@@ -1,26 +1,26 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2004-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2004-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   modify it under the terms of version three of the GNU Affero General Public
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -28,7 +28,6 @@
 /*
  *  Written by Kern Sibbald MMIV
  *
- *   Version $Id$
  */
 
 
@@ -77,10 +76,14 @@ public:
    dlist(void);
    ~dlist() { destroy(); }
    void init(void *item, dlink *link);
+   void init();
    void prepend(void *item);
    void append(void *item);
    void set_prev(void *item, void *prev);
    void set_next(void *item, void *next);
+   void *get_prev(void *item);
+   void *get_next(void *item);
+   dlink *get_link(void *item);
    void insert_before(void *item, void *where);
    void insert_after(void *item, void *where);
    void *binary_insert(void *item, int compare(void *item1, void *item2));
@@ -89,8 +92,8 @@ public:
    void remove(void *item);
    bool empty() const;
    int  size() const;
-   void *next(const void *item) const;
-   void *prev(const void *item) const;
+   void *next(void *item);      
+   void *prev(void *item);
    void destroy();
    void *first() const;
    void *last() const;
@@ -112,6 +115,14 @@ inline void dlist::init(void *item, dlink *link)
    num_items = 0;
 }
 
+inline void dlist::init()
+{
+   head = tail = NULL;
+   loffset = 0;
+   num_items = 0;
+}
+
+
 /*
  * Constructor called with the address of a
  *   member of the list (not the list head), and
@@ -140,6 +151,22 @@ inline void dlist::set_next(void *item, void *next)
    ((dlink *)(((char *)item)+loffset))->next = next;
 }
 
+inline void *dlist::get_prev(void *item)
+{
+   return ((dlink *)(((char *)item)+loffset))->prev;
+}
+
+inline void *dlist::get_next(void *item)
+{
+   return ((dlink *)(((char *)item)+loffset))->next;
+}
+
+
+inline dlink *dlist::get_link(void *item)
+{
+   return (dlink *)(((char *)item)+loffset);
+}
+
 
 
 inline bool dlist::empty() const
@@ -171,12 +198,13 @@ inline void * dlist::last() const
  *   Kern Sibbald, February 2007
  *
  */
-class dlistString : public dlink
+class dlistString
 {
 public:   
    char *c_str() { return m_str; };
 
 private:
+   dlink m_link;
    char m_str[1];                                
    /* !!! Don't put anything after this as this space is used
     *     to hold the string in inline