Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

freestore.h

Go to the documentation of this file.
00001 
00007 /*
00008  *  Copyright (C) 2004 Bregmasoft
00009  * 
00010  * This program is free software; you can redistribute it and/or modify it under
00011  * the terms of the GNU General Public License as published by the Free Software
00012  * Foundation; either version 2 of the License, or (at your option) any later
00013  * version.
00014  * 
00015  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
00016  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00017  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License along with
00020  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021  * Place, Suite 330, Boston, MA 02111-1307 USA
00022  */
00023 #ifndef ZYGOMA_KHEAP_H_ 
00024 #define ZYGOMA_KHEAP_H_ 
00025 
00026 #include <cstdlib>
00027 #include <types.h>
00028 
00029 namespace Zygoma
00030 {
00037   class Freestore
00038   {
00039   public:
00040     typedef u08            value_type;
00041     typedef u08&           reference;
00042     typedef const u08&     const_reference;
00043     typedef u08*           iterator;
00044     typedef const u08*     const_iterator;
00045     typedef std::ptrdiff_t difference_type;
00046     typedef std::size_t    size_type;
00047 
00048   public:
00050     /* @{ */
00051 
00055     Freestore();
00056 
00065     Freestore(u08* base, u08* top);
00066 
00070     Freestore(const Freestore&);
00071 
00075     Freestore&
00076     operator=(const Freestore&);
00077 
00081     ~Freestore();
00082 
00083     /* @} */
00084 
00086     /* @{ */
00087 
00093     size_type
00094     size() const
00095     { return end() - begin(); }
00096 
00100     size_type
00101     max_size() const;
00102 
00115     void
00116     resize(size_type sz);
00117 
00123     bool
00124     empty() const
00125     { return size() == 0; }
00126 
00127     /* @} */
00128 
00130     /* @{ */
00131 
00134     iterator
00135     begin();
00136 
00139     const_iterator
00140     begin() const;
00141 
00144     iterator
00145     end();
00146 
00149     const_iterator
00150     end() const;
00151 
00152     /* @} */
00153 
00154   private:
00155     u08*      m_baseAddress;
00156     size_type m_size;
00157   };
00158 
00162   Freestore& freestore();
00163 } // namespace Zygoma
00164 #endif // ZYGOMA_KHEAP_H_ 

Generated on Fri Sep 2 10:44:36 2005 for zygoma by doxygen 1.4.2