GL Studio Safety Critical Embedded C++ Runtime Library
GlsPointerArray Class Reference

#include <gls_pointer_array.h>

Public Member Functions

 GlsPointerArray (const GlsUInt32 size)
 
virtual ~GlsPointerArray ()
 
GlsUInt32 GetSize (void) const
 
void * GetPointer (const GlsUInt32 index)
 
const void * GetPointer (const GlsUInt32 index) const
 
void SetPointer (const GlsUInt32 index, void *const src)
 

Protected Attributes

void **const _pointers
 
const GlsUInt32 _count
 

Detailed Description

Abstracts an array of pointers

Invariant
_pointers array is GLS_NULL if _count == 0, else non GLS_NULL if _count > 0

Constructor & Destructor Documentation

GlsPointerArray::GlsPointerArray ( const GlsUInt32  size)

Constructor

Parameters
sizenumber of pointers this array will hold
Precondition
none
Postcondition
array constructed and initialized to GLS_NULL
virtual GlsPointerArray::~GlsPointerArray ( )
virtual

Destructor - shall never be called

Precondition
none
Postcondition
none

Member Function Documentation

void* GlsPointerArray::GetPointer ( const GlsUInt32  index)

Get a pointer in the array

Parameters
indexindex of desired pointer
Returns
ref to pointer at given index
Precondition
index < GetSize()
const void* GlsPointerArray::GetPointer ( const GlsUInt32  index) const

Get a const pointer in the array

Parameters
indexindex of desired pointer
Returns
ref to pointer at given index
Precondition
index < GetSize()
GlsUInt32 GlsPointerArray::GetSize ( void  ) const

Get the number of pointers in the array

Returns
number of pointers in the array
Precondition
none
Postcondition
none
void GlsPointerArray::SetPointer ( const GlsUInt32  index,
void *const  src 
)

Set a pointer in the array

Parameters
indexindex of pointer to set
srcnew value for pointer
Precondition
index < GetSize()
Postcondition
pointer at given index is set to src

Member Data Documentation

const GlsUInt32 GlsPointerArray::_count
protected

number of pointers in pointers array

void** const GlsPointerArray::_pointers
protected

array of pointers else GLS_NULL if count == 0