~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_list.h

Merge trunk changes and resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <algorithm>
28
28
#include "drizzled/memory/sql_alloc.h"
29
29
 
 
30
namespace drizzled
 
31
{
 
32
 
30
33
/** Struct to handle simple linked lists. */
31
34
typedef struct st_sql_list {
32
35
  uint32_t elements;
85
88
  @note We never call a destructor for instances of this class.
86
89
*/
87
90
 
88
 
struct list_node :public drizzled::memory::SqlAlloc
 
91
struct list_node : public memory::SqlAlloc
89
92
{
90
93
  list_node *next;
91
94
  void *info;
102
105
 
103
106
extern list_node end_of_list;
104
107
 
105
 
class base_list :public drizzled::memory::SqlAlloc
 
108
class base_list :public memory::SqlAlloc
106
109
{
107
110
protected:
108
111
  list_node *first,**last;
121
124
    relies on this behaviour. This logic is quite tricky: please do not use
122
125
    it in any new code.
123
126
  */
124
 
  inline base_list(const base_list &tmp) :drizzled::memory::SqlAlloc()
 
127
  inline base_list(const base_list &tmp) :memory::SqlAlloc()
125
128
  {
126
129
    elements= tmp.elements;
127
130
    first= tmp.first;
138
141
    }
139
142
    return 1;
140
143
  }
141
 
  inline bool push_back(void *info, drizzled::memory::Root *mem_root)
 
144
  inline bool push_back(void *info, memory::Root *mem_root)
142
145
  {
143
146
    if (((*last)=new (mem_root) list_node(info, &end_of_list)))
144
147
    {
381
384
public:
382
385
  inline List() :base_list() {}
383
386
  inline List(const List<T> &tmp) :base_list(tmp) {}
384
 
  inline List(const List<T> &tmp, drizzled::memory::Root *mem_root) :
 
387
  inline List(const List<T> &tmp, memory::Root *mem_root) :
385
388
    base_list(tmp, mem_root) {}
386
389
  inline bool push_back(T *a) { return base_list::push_back(a); }
387
 
  inline bool push_back(T *a, drizzled::memory::Root *mem_root)
 
390
  inline bool push_back(T *a, memory::Root *mem_root)
388
391
  { return base_list::push_back(a, mem_root); }
389
392
  inline bool push_front(T *a) { return base_list::push_front(a); }
390
393
  inline T* head() {return (T*) base_list::head(); }
462
465
template <typename T>
463
466
inline
464
467
void
465
 
list_copy_and_replace_each_value(List<T> &list, drizzled::memory::Root *mem_root)
 
468
list_copy_and_replace_each_value(List<T> &list, memory::Root *mem_root)
466
469
{
467
470
  /* Make a deep copy of each element */
468
471
  List_iterator<T> it(list);
471
474
    it.replace(el->clone(mem_root));
472
475
}
473
476
 
 
477
} /* namespace drizzled */
474
478
 
475
479
#endif /* DRIZZLED_SQL_LIST_H */