C3D Toolkit  Kernel - 110464, Vision - 2.5.0.35

One-dimensional array of pointers to objects. More...

#include <templ_rp_array.h>

Inherited by FDPArray< Type >, IFC_Array< Type > [private], PArray< Type >, and RPStack< Type > [private].

Public Types

typedef Type * TPtr
 A name of the pointer to the object.
 
typedef int(* CompFunc) (const Type **, const Type **)
 A template of sorting function.
 

Public Member Functions

 RPArray ()
 Constructor.
 
 RPArray (size_t i_upper, uint16 i_delta=1)
 Constructor.
 
virtual ~RPArray ()
 Destructor.
 
uint16 Delta () const
 Get the increment by the number of elements while the allocation of additional memory.
 
size_t Upper () const
 The number of elements the memory is allocated for.
 
void Delta (uint16 newDelta)
 Set the increment by the number of elements while the allocation of additional memory (1 - autoincrement).
 
void SetMaxDelta (uint16 newDelta)
 Set the maximum increment.
 
bool SetSize (size_t newSize)
 Functions that allocate potentially large memory, return an operation result (success/error). More...
 
bool Reserve (size_t n, bool addAdditionalSpace=true)
 Reserve space for a given number of elements.
 
bool Add (Type *)
 Add an element to the end of the array.
 
bool AddAt (Type *e, size_t index)
 Insert an element to the given position.
 
bool AddAfter (Type *e, size_t index)
 Add an element after the specified one.
 
bool Insert (size_t index, Type *)
 Insert an element before the specified one.
 
bool AddArray (const RPArray< Type > &)
 Add array.
 
bool AddCArray (const Type **, size_t count)
 Add C-array.
 
bool InsertArray (const RPArray< Type > &, size_t index)
 Add an array to the position.
 
void DetachAll ()
 Delete all elements and set the number of elements to null.
 
void Adjust ()
 Free the unnecessary memory.
 
Type * DetachInd (size_t delIndex)
 Detach an element from the array.
 
bool DetachObj (const Type *delObject)
 Detach an element from the array.
 
virtual Type * RemoveInd (size_t delIndex, DelType=defDelete)
 Delete an element from array by the index.
 
void Swap (RPArray &arr)
 Swap data of arrays.
 
size_t FindIt (const Type *) const
 Find an element by a pointer.
 
bool IsExist (const Type *) const
 Whether an element belongs the array.
 
size_t Count () const
 Get the number of array elements.
 
ptrdiff_t MaxIndex () const
 Get the index of the last element in the array.
 
void Sort (CompFunc comp)
 Sort the array.
 
Type *& operator[] (size_t loc) const
 Access by index operator.
 
Type * GetLast () const
 Get the address of the last element in the array.
 
size_t size () const
 Get the number of elements in array.
 
bool reserve (size_t n)
 Reserve space for a given number of elements.
 
size_t capacity () const
 What is the number of elements the memory is allocated for?
 
void push_back (const Type *e)
 Add an element to the end of the array.
 
template<class Iterator >
void insert (Iterator pos, const Type *e)
 Insert an element before the specified one.
 
template<class Iterator >
void erase (Iterator pos)
 Delete an element from array by the index.
 
template<class Iterator >
void erase (Iterator first, Iterator last)
 Delete elements from the array from first to last-1 inclusively.
 
virtual void clear ()
 Set the number of elements to null.
 
void shrink_to_fit ()
 Free the unnecessary memory (Reduce capacity).
 
const TPtrbegin () const
 Get the pointer to the first array element.
 
TPtrbegin ()
 Get the pointer to the first array element.
 
const TPtrend () const
 Get the pointer to the piece of memory after the array.
 
TPtrend ()
 Get the pointer to the piece of memory after the array.
 
const TPtrcbegin () const
 Get the pointer to the first array element.
 
const TPtrcend () const
 Get the pointer to the piece of memory after the array.
 

Protected Member Functions

const Type ** GetAddr () const
 Get the pointer to the first array element.
 
const TPtr_Begin () const
 Get the pointer to the first array element.
 
TPtr_Begin ()
 Get the pointer to the first array element.
 
const TPtr_End () const
 Get the pointer to the piece of memory after the array.
 
bool CatchMemory ()
 Catch memory.
 
bool AddMemory (size_t n)
 Provide memory for n elements, independently from AutoDelta.
 
size_t AutoDelta () const
 Calculate autoincrement.
 

Protected Attributes

size_t count
 The number of elements in array.
 
size_t upper
 The number of elements the memory is allocated for.
 
uint16 delta
 Increment by the number of elements while the allocation of additional memory.
 

Detailed Description

template<class Type>
class RPArray< Type >

One-dimensional array of pointers to objects.

A template array working with pointers to objects.

Member Function Documentation

◆ SetSize()

template<class Type >
bool RPArray< Type >::SetSize ( size_t  newSize)
inline

Functions that allocate potentially large memory, return an operation result (success/error).

Set the new size of an array.


The documentation for this class was generated from the following files: