Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

use_ruby_allocator.hpp

00001 #ifndef Exc_Ruby__use_ruby_allocator__hpp_
00002 #define Exc_Ruby__use_ruby_allocator__hpp_
00003 
00004 // *******************************************************
00005 // TODO: Make sure this is right
00006 // (Should operator new throw bad_alloc?)
00007 #define USE_RUBY_ALLOCATOR             \
00008   static void* operator new(size_t s)  \
00009   {                                    \
00010     return ruby_xmalloc(s);            \
00011   }                                    \
00012                                        \
00013   static void operator delete(void* p) \
00014   {                                    \
00015     ruby_xfree(p);                     \
00016   }
00017 // *******************************************************
00018 
00019 namespace Exc_Ruby
00020 {
00021 
00022 class Use_Ruby_Allocator
00023 {
00024 protected:
00025   ~Use_Ruby_Allocator() { }
00026 
00027   USE_RUBY_ALLOCATOR
00028 };
00029 
00030 } // namespace Exc_Ruby
00031 
00032 #endif // Exc_Ruby__use_ruby_allocator__hpp_
00033 

Generated on Sat Jan 1 12:02:20 2005 for Exceptional Ruby by doxygen 1.3.6