bytearray.h

00001 /***************************************************************************
00002 *   Copyright (C) 2005 by                                                 *
00003 *   Alejandro Perez Mendez     alejandro_perez@dif.um.es                  *
00004 *   Pedro J. Fernandez Ruiz    pedroj.fernandez@dif.um.es                 *
00005 *                                                                         *
00006 *   This library is free software; you can redistribute it and/or         *
00007 *   modify it under the terms of the GNU Lesser General Public            *
00008 *   License as published by the Free Software Foundation; either          *
00009 *   version 2.1 of the License, or (at your option) any later version.    *
00010 *                                                                         *
00011 *   This library is distributed in the hope that it will be useful,       *
00012 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014 *   Lesser General Public License for more details.                       *
00015 *                                                                         *
00016 *   You should have received a copy of the GNU Lesser General Public      *
00017 *   License along with this library; if not, write to the Free Software   *
00018 *   Foundation, Inc., 51 Franklin St, Fifth Floor,                        *
00019 *   Boston, MA  02110-1301  USA                                           *
00020 ***************************************************************************/
00021 
00022 #ifndef BYTEARRAY_H
00023 #define BYTEARRAY_H
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #include "config.h"
00027 #endif
00028 
00029 #include "printable.h"
00030 
00031 namespace openikev2 {
00032 
00037     class ByteArray : public Printable {
00038             friend class ByteBuffer;
00039 
00040             /****************************** ATTRIBUTES ******************************/
00041         protected:
00042             uint8_t* begin_array;       
00043             uint8_t* end_data;          
00044             uint8_t* end_array;          
00047             /****************************** METHODS ******************************/
00048         protected:
00053             virtual uint32_t capacity() const;
00054             
00055         public:
00060             ByteArray( uint32_t capacity );
00061 
00067             ByteArray( uint32_t capacity, uint8_t pattern );
00068             
00076             ByteArray( const void * array, uint32_t size, uint32_t capacity, bool owns_memory = false);
00077             
00084             ByteArray( const void * array, uint32_t size, bool owns_memory = false);
00085 
00090             ByteArray( const ByteArray& other );
00091 
00096             virtual uint8_t* getRawPointer() const;
00097 
00103             virtual bool operator==( const ByteArray &other ) const;
00104 
00110             virtual bool operator<( const ByteArray &other ) const;
00111 
00117             virtual bool operator>( const ByteArray &other ) const;
00118 
00124             virtual uint8_t& operator[] ( const uint32_t position ) const;
00125 
00130             virtual auto_ptr<ByteArray> clone() const;
00131 
00136             virtual uint32_t size() const;
00137             
00142             virtual void setSize( uint32_t size );
00143 
00144             virtual string toStringTab( uint8_t tabs ) const;
00145 
00146             virtual ~ByteArray();
00147 
00148     };
00149 
00150 }
00151 
00152 #endif

Generated on Fri Jul 27 11:04:44 2007 for libopenikev2 by  doxygen 1.5.1