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

slab_cache_anon.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef slab_cache_anon_h
00004 #define slab_cache_anon_h
00005 
00006 //
00007 // INTERFACE definition follows 
00008 //
00009 
00010 
00011 // The anonymous slab allocator.  You can specialize this allocator by
00012 // providing your own initialization functions and your own low-level
00013 // allocation functions.
00014 
00015 class slab;
00016 
00017 class slab_cache_anon
00018 {
00019 protected:
00020   friend class slab;
00021 
00022   // Low-level allocator functions:
00023 
00024   // Allocate/free a block.  "size" is always a multiple of PAGE_SIZE.
00025   virtual void *block_alloc(unsigned long size, unsigned long alignment) = 0;
00026   virtual void block_free(void *block, unsigned long size) = 0;
00027 
00028 private:
00029   slab_cache_anon();
00030   slab_cache_anon(const slab_cache_anon&); // default constructor is undefined
00031 
00032   //
00033   // data declaration follows
00034   // 
00035 
00036   // The slabs of this cache are held in a partially-sorted
00037   // doubly-linked list.  First come the fully-active slabs (all
00038   // elements in use), then the partially active slabs, then empty
00039   // slabs.
00040   slab *_first_slab, *_first_available_slab, *_last_slab;
00041   unsigned long _slab_size;
00042   unsigned _elem_size, _latest_offset, _alignment;
00043 
00044 public:  
00045   // 
00046   // slab_cache_anon
00047   // 
00048   slab_cache_anon(unsigned long slab_size, unsigned elem_size, unsigned alignment);
00049   
00050   virtual ~slab_cache_anon();
00051   
00052   virtual void * alloc();       // request initialized member from cache
00053   
00054   virtual void free(void *cache_entry); // return initialized member to cache
00055   
00056   virtual bool reap();          // request that cache returns memory to system
00057 
00058 protected:  
00059   void destroy();       // descendant should call this in destructor
00060   
00061   // Element initialization/destruction
00062   virtual void elem_ctor(void *);
00063   
00064   virtual void elem_dtor(void *);
00065 };                              // end declaration of class slab_cache
00066 
00067 #endif // slab_cache_anon_h

Generated on Mon Sep 26 14:20:12 2005 for Fiasco by  doxygen 1.4.2