Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
DefaultAllocator.h
1 /*
2  * $Id$
3  * DefaultAllocator class interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2009, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef ELM_ALLOC_DEFAULTALLOCATOR_H_
23 #define ELM_ALLOC_DEFAULTALLOCATOR_H_
24 
25 //#include <new>
26 #include <elm/types.h>
27 #include <elm/util/Exception.h>
28 
29 namespace elm {
30 
31 // BadAlloc exception
32 class BadAlloc: public Exception {
33 public:
34  virtual ~BadAlloc(void);
35  virtual String message(void);
36 };
37 
38 // DefaultAllocator class
40 public:
42  void *allocate(t::size size);
43  virtual bool mark(void *data, t::size size);
44  inline void free(void *block) { delete [] (char *)block; }
45  virtual ~DefaultAllocator() { }
46 };
47 
48 } // elm
49 
50 #endif /* ELM_ALLOC_DEFAULTALLOCATOR_H_ */
elm::DefaultAllocator::allocate
void * allocate(t::size size)
Definition: alloc_DefaultAllocator.cpp:131
elm::Exception
Definition: Exception.h:29
elm::BadAlloc
Definition: DefaultAllocator.h:32
elm::DefaultAllocator::~DefaultAllocator
virtual ~DefaultAllocator()
Definition: DefaultAllocator.h:45
elm::DefaultAllocator::free
void free(void *block)
Definition: DefaultAllocator.h:44
elm
Definition: adapter.h:26
elm::t::size
uint64 size
Definition: arch.h:35
elm::DefaultAllocator
Definition: DefaultAllocator.h:39
elm::DefaultAllocator::DEFAULT
static DefaultAllocator DEFAULT
Definition: DefaultAllocator.h:41
elm::BadAlloc::~BadAlloc
virtual ~BadAlloc(void)
Definition: alloc_DefaultAllocator.cpp:104
elm::String
Definition: String.h:30
elm::DefaultAllocator::mark
virtual bool mark(void *data, t::size size)
Definition: alloc_DefaultAllocator.cpp:148
elm::BadAlloc::message
virtual String message(void)
Definition: alloc_DefaultAllocator.cpp:109