Drizzled Public API Documentation

sql_alloc.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 
00021 
00022 #pragma once
00023 
00024 #include <unistd.h>
00025 #include <drizzled/memory/root.h>
00026 
00027 #include <drizzled/visibility.h>
00028 
00029 namespace drizzled
00030 {
00031 class Session;
00032 
00033 namespace memory
00034 {
00035 
00036 void init_sql_alloc(Root *root, size_t block_size, size_t pre_alloc_size);
00037 void *sql_alloc(size_t);
00038 void *sql_calloc(size_t);
00039 char *sql_strdup(const char *str);
00040 char *sql_strmake(const char *str, size_t len);
00041 void *sql_memdup(const void * ptr, size_t size);
00042 
00043 class DRIZZLED_API SqlAlloc
00044 {
00045 public:
00046   static void *operator new(size_t size);
00047   static void *operator new[](size_t size);
00048   static void *operator new[](size_t size, Root *mem_root);
00049   static void *operator new(size_t size, Root *mem_root);
00050   static void operator delete(void *, size_t)
00051   {  }
00052   static void operator delete(void *, Root *)
00053   {  }
00054   static void operator delete[](void *, Root *)
00055   {  }
00056   static void operator delete[](void *, size_t)
00057   {  }
00058   SqlAlloc() {}
00062   ~SqlAlloc() {}
00063 
00064 };
00065 
00066 }
00067 }
00068