Warning: this documentation for the development version is under construction.
00001 // Copyright (C) 2001-2009 Vivien Mallet, Marc Fragu 00002 // 00003 // This file is part of the linear-algebra library Seldon, 00004 // http://seldon.sourceforge.net/. 00005 // 00006 // Seldon is free software; you can redistribute it and/or modify it under the 00007 // terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 2.1 of the License, or (at your option) 00009 // any later version. 00010 // 00011 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY 00012 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00013 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00014 // more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public License 00017 // along with Seldon. If not, see http://www.gnu.org/licenses/. 00018 00019 00020 #ifndef SELDON_FILE_ALLOCATOR_HXX 00021 00022 namespace Seldon 00023 { 00024 00025 00027 // MALLOCALLOC // 00029 00030 00031 template <class T> 00032 class MallocAlloc 00033 { 00034 public: 00035 typedef T value_type; 00036 typedef T* pointer; 00037 typedef const T* const_pointer; 00038 typedef T& reference; 00039 typedef const T& const_reference; 00040 00041 public: 00042 00043 pointer allocate(int num, void* h = 0); 00044 void deallocate(pointer data, int num, void* h = 0); 00045 void* reallocate(pointer data, int num, void* h = 0); 00046 void memoryset(pointer data, char c, size_t num); 00047 void memorycpy(pointer datat, pointer datas, size_t num); 00048 }; 00049 00050 00052 // CALLOCALLOC // 00054 00055 00056 template <class T> 00057 class CallocAlloc 00058 { 00059 public: 00060 typedef T value_type; 00061 typedef T* pointer; 00062 typedef const T* const_pointer; 00063 typedef T& reference; 00064 typedef const T& const_reference; 00065 00066 public: 00067 00068 pointer allocate(int num, void* h = 0); 00069 void deallocate(pointer data, int num, void* h = 0); 00070 void* reallocate(pointer data, int num, void* h = 0); 00071 void memoryset(pointer data, char c, size_t num); 00072 void memorycpy(pointer datat, pointer datas, size_t num); 00073 }; 00074 00075 00077 // NEWALLOC // 00079 00080 00081 template <class T> 00082 class NewAlloc 00083 { 00084 public: 00085 typedef T value_type; 00086 typedef T* pointer; 00087 typedef const T* const_pointer; 00088 typedef T& reference; 00089 typedef const T& const_reference; 00090 00091 public: 00092 00093 pointer allocate(int num, void* h = 0); 00094 void deallocate(pointer data, int num, void* h = 0); 00095 void* reallocate(pointer data, int num, void* h = 0); 00096 void memoryset(pointer data, char c, size_t num); 00097 void memorycpy(pointer datat, pointer datas, size_t num); 00098 }; 00099 00100 00102 // MallocObject // 00104 00105 00106 template <class T> 00107 class MallocObject 00108 { 00109 public: 00110 typedef T value_type; 00111 typedef T* pointer; 00112 typedef const T* const_pointer; 00113 typedef T& reference; 00114 typedef const T& const_reference; 00115 00116 public: 00117 00118 pointer allocate(int num, void* h = 0); 00119 void deallocate(pointer data, int num, void* h = 0); 00120 void* reallocate(pointer data, int num, void* h = 0); 00121 void memoryset(pointer data, char c, size_t num); 00122 void memorycpy(pointer datat, pointer datas, size_t num); 00123 }; 00124 00125 00127 // NANALLOC // 00129 00130 00131 template <class T> 00132 class NaNAlloc 00133 { 00134 public: 00135 typedef T value_type; 00136 typedef T* pointer; 00137 typedef const T* const_pointer; 00138 typedef T& reference; 00139 typedef const T& const_reference; 00140 00141 public: 00142 00143 pointer allocate(int num, void* h = 0); 00144 void deallocate(pointer data, int num, void* h = 0); 00145 void* reallocate(pointer data, int num, void* h = 0); 00146 void memoryset(pointer data, char c, size_t num); 00147 void memorycpy(pointer datat, pointer datas, size_t num); 00148 }; 00149 00150 00151 } // namespace Seldon. 00152 00153 #define SELDON_FILE_ALLOCATOR_HXX 00154 #endif