fixed_mem_buf.hpp

См. документацию.
00001 /*
00002 
00003 Copyright (c) 2002-2005, Yauheni Akhotnikau
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009 - Redistributions of source code must retain the above copyright notice, this
00010 list of conditions and the following disclaimer.
00011 
00012 - Redistributions in binary form must reproduce the above copyright notice, this
00013 list of conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.
00015 
00016 - The name of the author may not be used to endorse or promote products derived
00017 from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00022 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00024 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00027 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00028 OF SUCH DAMAGE.
00029 
00030 */
00031 
00038 #if !defined( _OESS_1__IO__FIXED_MEM_BUF_HPP_ )
00039 #define _OESS_1__IO__FIXED_MEM_BUF_HPP_
00040 
00041 #include <oess_1/io/h/declspec.hpp>
00042 
00043 #include <auto_ptr_3/h/vect_ptr.hpp>
00044 
00045 #include <oess_1/io/h/binbuffer.hpp>
00046 
00047 namespace oess_1 {
00048 
00049 namespace io {
00050 
00051 //
00052 // ifixed_mem_buf_t
00053 //
00054 
00056 
00074 class OESS_1__IO__TYPE  ifixed_mem_buf_t :
00075   public ibinbuffer_t
00076 {
00077   public :
00078     ifixed_mem_buf_t(
00081 
00085       const oess_1::char_t * buf,
00087       size_t capacity );
00088     virtual ~ifixed_mem_buf_t();
00089 
00091 
00096     size_t
00097     capacity() const;
00098 
00100 
00104     virtual size_t
00105     size() const;
00106 
00109     virtual size_t
00110     pos() const;
00111 
00114 
00118     void
00119     set_pos( size_t pos );
00120 
00122     virtual bool
00123     eof() const;
00124 
00126     const oess_1::char_t *
00127     ptr() const;
00128 
00130     const oess_1::char_t *
00131     current_ptr() const;
00132 
00133   protected :
00135 
00140     virtual const oess_1::char_t *
00141     in_reserve(
00144       size_t item_count,
00146       size_t item_size,
00149       size_t & item_available );
00150 
00152     virtual void
00153     in_shift(
00155       size_t item_count,
00157       size_t item_size );
00158 
00159   private :
00161     const oess_1::char_t *  m_buf;
00163 
00166     size_t  m_capacity;
00168     size_t  m_pos;
00169 
00170   private :
00172     ifixed_mem_buf_t(
00173       const ifixed_mem_buf_t & );
00175     ifixed_mem_buf_t &
00176     operator=(
00177       const ifixed_mem_buf_t & );
00178 };
00179 
00180 //
00181 // ofixed_mem_buf_t
00182 //
00183 
00185 
00213 class OESS_1__IO__TYPE  ofixed_mem_buf_t :
00214   public obinbuffer_t
00215 {
00216   public :
00217     ofixed_mem_buf_t(
00220 
00224       oess_1::char_t * buf,
00226       size_t capacity,
00228       size_t initial_size = 0 );
00229     virtual ~ofixed_mem_buf_t();
00230 
00232 
00235     virtual size_t
00236     capacity() const;
00237 
00239 
00241     virtual size_t
00242     size() const;
00243 
00246     virtual size_t
00247     pos() const;
00248 
00251 
00255     void
00256     set_pos( size_t pos );
00257 
00259     const oess_1::char_t *
00260     ptr() const;
00261 
00263     const oess_1::char_t *
00264     current_ptr() const;
00265 
00266   protected :
00268     virtual oess_1::char_t *
00269     out_reserve(
00272       size_t item_count,
00274       size_t item_size,
00277       size_t & item_available );
00278 
00280     virtual void
00281     out_shift(
00283       size_t item_count,
00285       size_t item_size );
00286 
00287   private :
00289     oess_1::char_t *  m_buf;
00291 
00294     size_t  m_capacity;
00296     size_t  m_size;
00298     size_t  m_pos;
00299 
00300   private :
00302     ofixed_mem_buf_t(
00303       const ofixed_mem_buf_t & );
00305     ofixed_mem_buf_t &
00306     operator=(
00307       const ofixed_mem_buf_t & );
00308 };
00309 
00310 } /* namespace io */
00311 
00312 } /* namespace oess_1 */
00313 
00314 #endif

Документация по ObjESSty. Последние изменения: Fri Oct 13 18:35:36 2006. Создано системой  doxygen 1.4.7
Hosted by uCoz