openikev2::ByteArray Class Reference

This class represents a ByteArray. More...

#include <bytearray.h>

Inheritance diagram for openikev2::ByteArray:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ByteArray (uint32_t capacity)
 Creates a new ByteArray with the indicated capacity.
 ByteArray (uint32_t capacity, uint8_t pattern)
 Creates a new ByteArray with the indicated capacity.
 ByteArray (const void *array, uint32_t size, uint32_t capacity, bool owns_memory=false)
 Creates a new ByteArray using an existing raw byte array.
 ByteArray (const void *array, uint32_t size, bool owns_memory=false)
 Creates a new ByteArray using an existing raw byte array.
 ByteArray (const ByteArray &other)
 Creates a new ByteArray cloning another one.
virtual uint8_t * getRawPointer () const
 Gets the raw pointer to the array.
virtual bool operator== (const ByteArray &other) const
 Compares if this ByteArray object is equal to other.
virtual bool operator< (const ByteArray &other) const
 Compares if this ByteArray object is lesser than other (lexicographically).
virtual bool operator> (const ByteArray &other) const
 Compares if this ByteArray object is greater than other (lexicographically).
virtual uint8_t & operator[] (const uint32_t position) const
 Gets the i-nth element in the array.
virtual auto_ptr< ByteArrayclone () const
 Gets a clone of this object.
virtual uint32_t size () const
 Returns the size of the valid data.
virtual void setSize (uint32_t size)
 Sets the size of the array.
virtual string toStringTab (uint8_t tabs) const
 Construct a textual representation of the object, preceded of a num of tabs of size TAB_SIZE.

Protected Member Functions

virtual uint32_t capacity () const
 Returns the internal array capacity.

Protected Attributes

uint8_t * begin_array
 Internal pointer to the begin of the array.
uint8_t * end_data
 Internal pointer to the end of valid data.
uint8_t * end_array
 Internal pointer to the end of the array.

Friends

class ByteBuffer

Detailed Description

This class represents a ByteArray.

It takes care with memory

Author:
Alejandro Perez Mendez, Pedro J. Fernandez Ruiz <alejandro_perez@dif.um.es, pedroj.fernandez@dif.um.es>


Constructor & Destructor Documentation

openikev2::ByteArray::ByteArray ( uint32_t  capacity  ) 

Creates a new ByteArray with the indicated capacity.

Parameters:
capacity Capacity of the array.

openikev2::ByteArray::ByteArray ( uint32_t  capacity,
uint8_t  pattern 
)

Creates a new ByteArray with the indicated capacity.

Parameters:
capacity Capacity of the array.
pattern Patter to fill the array

openikev2::ByteArray::ByteArray ( const void *  array,
uint32_t  size,
uint32_t  capacity,
bool  owns_memory = false 
)

Creates a new ByteArray using an existing raw byte array.

Parameters:
array Pointer to the raw array
size Size of the actual data in the array
capacity Capacity of the array
owns_memory Indicates if the ByteArray must own the memory of "array". Defaults to FALSE (make copy)

openikev2::ByteArray::ByteArray ( const void *  array,
uint32_t  size,
bool  owns_memory = false 
)

Creates a new ByteArray using an existing raw byte array.

The capacity will be the size + 1

Parameters:
array Pointer to the raw array
size Size of the actual data in the array
owns_memory Indicates if the ByteArray must own the memory of "array". Defaults to FALSE (make copy)

openikev2::ByteArray::ByteArray ( const ByteArray other  ) 

Creates a new ByteArray cloning another one.

Parameters:
other The other ByteArray


Member Function Documentation

uint32_t openikev2::ByteArray::capacity (  )  const [protected, virtual]

Returns the internal array capacity.

Returns:
The internal array capacity

Reimplemented in openikev2::ByteBuffer.

uint8_t * openikev2::ByteArray::getRawPointer (  )  const [virtual]

Gets the raw pointer to the array.

Returns:
The raw pointer

bool openikev2::ByteArray::operator== ( const ByteArray other  )  const [virtual]

Compares if this ByteArray object is equal to other.

Parameters:
other The other ByteArray
Returns:
TRUE if both are equals, FALSE otherwise

bool openikev2::ByteArray::operator< ( const ByteArray other  )  const [virtual]

Compares if this ByteArray object is lesser than other (lexicographically).

Parameters:
other The other ByteArray
Returns:
TRUE if this ByteArray is lesser than the other. FALSE otherwise

bool openikev2::ByteArray::operator> ( const ByteArray other  )  const [virtual]

Compares if this ByteArray object is greater than other (lexicographically).

Parameters:
other The other ByteArray
Returns:
TRUE if this ByteArray is greater than the other. FALSE otherwise

uint8_t & openikev2::ByteArray::operator[] ( const uint32_t  position  )  const [virtual]

Gets the i-nth element in the array.

Parameters:
position Array position
Returns:
Element in the array

auto_ptr< ByteArray > openikev2::ByteArray::clone (  )  const [virtual]

Gets a clone of this object.

Returns:
A new cloned ByteArray

uint32_t openikev2::ByteArray::size (  )  const [virtual]

Returns the size of the valid data.

Returns:
The size of the valid data

void openikev2::ByteArray::setSize ( uint32_t  size  )  [virtual]

Sets the size of the array.

Parameters:
size The new size

string openikev2::ByteArray::toStringTab ( uint8_t  tabs  )  const [virtual]

Construct a textual representation of the object, preceded of a num of tabs of size TAB_SIZE.

Parameters:
tabs Num of tabs preceding the textual representation.
Returns:
Textual tabulated represetation of the object.

Implements openikev2::Printable.


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