All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

System Class CATRawCollPV

System.CATCollecRoot
  |
  +---CATRawCollPV
 

Usage: you must use this class as is. You should never derive it.


public class CATRawCollPV

Class to implement a mutable list of void * pointers.
Role: The purpose of this class is to let C++ classes easily pass and receive lists of void * pointers. The class handles all the low-level memory allocation tasks such as reallocating the list once it capacity has been exceeded. It also provides high level operations such as sorting, comparison, etc... The first element has index 1.
Use the type CATListPV


Constructor and Destructor Index


o CATRawCollPV(CATRawCollPV&)
Copy constructor.
o CATRawCollPV(int)
Constructs an empty list of void * pointers.
o CATRawCollPV(void**,int)
Constructs a list and initializes it with a C++ void * pointer array.
o ~CATRawCollPV()
Destructor.

Method Index


o Append(CATRawCollPV&)
Appends the content of a void * pointer list.
o Append(void*)
Appends a void * pointer to the list.
o Compare(CATRawCollPV&,CATRawCollPV&,int(*iPFCompare)(const void*, const*))
Compares two lists of void * pointers.
o FillArray(void**,int)
Fills a C++ array of void * pointers with elements from the list.
o InsertAt(int,void*)
Inserts a void * pointer within the list at the specified index.
o Intersection(CATRawCollPV&,CATRawCollPV&,CATRawCollPV&)
Computes the intersection of two lists.
o Locate(void*,int)
Finds the first occurrence of a void * pointer from a given index.
o NbOccur(void*)
Counts the occurrences of a void * pointer in the list.
o QuickSort(int(*iPFCompare)(const void*, const*))
Sorts the list using the quicksort algorithm.
o Remove(CATRawCollPV&)
Removes all the values specifed in iSubstract from the list.
o RemoveAll(CATCollec::MemoryHandling)
Removes all the elements from the list.
o RemoveDuplicates(CATRawCollPV*)
Removes all the duplicate occurrences of a void * pointer from the list and appends them to another list.
o RemoveNulls()
Removes all the void * pointers equal to NULL.
o RemovePosition(int)
Removes the void * pointer located at a given index.
o RemovePosition(int,unsigned int)
Removes several void * pointers from the starting given index.
o RemoveValue(void*)
Removes the first occurrence of a void * pointer from the list.
o Size()
Returns the size of the list.
o Size(int)
Forces the size of the list to an arbitrary size.
o Size(int,void*)
Forces the size of the list to an arbitrary size.
o Swap(int,int)
Swaps two list elements.
o operator !=(CATRawCollPV&)
Inequality operator.
o operator =(CATRawCollPV&)
Assignment operator.
o operator ==(CATRawCollPV&)
Equality operator.
o operator[](int)
Subscripting operator.
o operator[](int)
Subscripting operator.

Constructor and Destructor


o CATRawCollPV
public CATRawCollPV( const CATRawCollPV& iCopy)
Copy constructor.
Parameters:
iCopy
The list to copy.
o CATRawCollPV
public CATRawCollPV(int iInitAlloc= 0 )
Constructs an empty list of void * pointers.
Parameters:
iInitAlloc
The default capacity of the list.
o CATRawCollPV
public CATRawCollPV(void** iArray,
int iSize)
Constructs a list and initializes it with a C++ void * pointer array.
Parameters:
iArray
A C++ array of void * pointers used to initialize the list.
iSize
The size of the C++ array of void * pointers used to initialize the list.
o ~CATRawCollPV
public virtual ~CATRawCollPV()
Destructor.

Methods


o Append
public int Append( const CATRawCollPV& iConcat)
Appends the content of a void * pointer list.
Parameters:
iConcat
The void * pointer list to append.
Returns:
0 upon sucess, 1 if there is no more free memory.
o Append
public int Append(void* iAdd)
Appends a void * pointer to the list.
Parameters:
iAdd
The void * pointer to append.
Returns:
0 upon sucess, 1 if there is no more free memory.
o Compare
public static int Compare( const CATRawCollPV& iRC1,
const CATRawCollPV& iRC2,
int(*iPFCompare)(const void*, const*) void)
Compares two lists of void * pointers.
Parameters:
iRC1
The first list
iRC2
The second list
Returns:

Legal values: 0 if the lists are equal, -1 if the first list is smaller than the second list (smaller means that the first list contains less elements than the second list or that iRC1[i] < iRC2[i] for the first i where iRC1[i] != iRC2[i]), or 1 otherwise.
o FillArray
public void FillArray(void** ioArray,
int iMaxSize)const
Fills a C++ array of void * pointers with elements from the list.
Parameters:
ioArray
The C++ array to fill.
iMaxSize
The size of the C++ array to fill.
o InsertAt
public int InsertAt(int iPos,
void* iAdd)
Inserts a void * pointer within the list at the specified index.
Parameters:
iIndex
The index at which the void * pointer is to be inserted.
Legal values: Equals 1 of the void * pointer is to be inserted at the head of the list, and Size() + 1 if the void * pointer is to be inserted at the tail of the list.
iAdd
The void * pointer to insert.
Returns:
0 upon sucess, 1 if there is no more free memory.
o Intersection
public static void Intersection( const CATRawCollPV& iRC1,
const CATRawCollPV& iRC2,
CATRawCollPV& ioResult)
Computes the intersection of two lists.
Parameters:
iRC1
The first list.
iRC2
The second list.
ioResult
A list to which elements in the intersection are appended.
o Locate
public int Locate(void* iLocate,
int iFrom= 1 )const
Finds the first occurrence of a void * pointer from a given index.
Parameters:
iLocate
The void * pointer to locate.
iIndex
The index at which the search is to begin.
Returns:

Legal values: The index of the located void * pointer, or 0 if the list does not contain the specified void * pointer.
o NbOccur
public int NbOccur(void* iTest)
Counts the occurrences of a void * pointer in the list.
Parameters:
iTest
The void * pointer for which the occurrences are to be counted.
Returns:
The count of occurrences of the void * pointer in the list.
o QuickSort
public void QuickSort(int(*iPFCompare)(const void*, const*) void)
Sorts the list using the quicksort algorithm.
o Remove
public int Remove( const CATRawCollPV& iSubstract)
Removes all the values specifed in iSubstract from the list.
Parameters:
iSubstract
A list of void * pointers to remove.
Returns:
The count of void * pointers removed from the list.
o RemoveAll
public void RemoveAll(CATCollec::MemoryHandling iMH= CATCollec::ReleaseAllocation )
Removes all the elements from the list.
Parameters:
iMH

Legal values: Specifies whether the list capacity should be shrunk to 0 (CATCollec::ReleaseAllocation) or not (CATCollec::KeepAllocation).
o RemoveDuplicates
public int RemoveDuplicates(CATRawCollPV* ioExtract= NULL )
Removes all the duplicate occurrences of a void * pointer from the list and appends them to another list.
Parameters:
ioExtract
A list to which duplicate void * pointers are appended.
Returns:
The count of duplicate void * pointers removed from the list.
o RemoveNulls
public int RemoveNulls()
Removes all the void * pointers equal to NULL.
Returns:
The count of null void * pointers removed from the list.
o RemovePosition
public void RemovePosition(int iPos)
Removes the void * pointer located at a given index.
Parameters:
iIndex
The list index of the void * pointer to remove.
o RemovePosition
public int RemovePosition(int iIndex,
unsigned int iNbElem)
Removes several void * pointers from the starting given index.
Parameters:
iIndex
The stating list index of the void * pointers to remove.
iNbElem
The number of void * pointers to remove.
Returns:
The count of void * pointers removed from the list.
o RemoveValue
public int RemoveValue(void* iRemove)
Removes the first occurrence of a void * pointer from the list.
Parameters:
iRemove
The void * pointer to remove.
Returns:

Legal values: The index of the removed void * pointer, or 0 if the list does not contain the specified void * pointer.
o Size
public inline int Size()const
Returns the size of the list.
Returns:
the size of the list.
o Size
public int Size(int iSize)
Forces the size of the list to an arbitrary size.
Role: If iSize is larger than the current size, the newly allocated slots contain random void * pointer values.
Parameters:
iSize
The desired size.
Returns:
0 upon sucess, 1 if there is no more free memory.
o Size
public int Size(int iSize,
void* iFiller)
Forces the size of the list to an arbitrary size.
Role: If iSize is larger than the current size, the newly allocated slots contain iFiller.
Parameters:
iSize
The desired size.
iFiller
A void * pointer used to fill newly allocated slots.
Returns:
0 upon sucess, 1 if there is no more free memory.
o Swap
public void Swap(int iPos1,
int iPos2)
Swaps two list elements.
Parameters:
iIndex1
index of the first element to swap.
iIndex2
index of the second element to swap.
o operator !=
public int operator !=( const CATRawCollPV& iRC)const
Inequality operator.
Parameters:
iRC
The list to test for inequality
Returns:

Legal values: 1 if the two lists are not equal, 0 otherwise.
o operator =
public CATRawCollPV & operator =( const CATRawCollPV& iCopy)
Assignment operator.
Role: Overwrites the content of the list with another list.
Parameters:
iCopy
The assigned list.
o operator ==
public inline int operator ==( const CATRawCollPV& iRC)const
Equality operator.
Role: Two lists are equal if they contain the same elements in the same order.
Parameters:
iRC
The list to test for equality
Returns:

Legal values: 1 if the two lists are equal, 0 otherwise
o operator[]
public void * operator[](int iPos)const
Subscripting operator.
Parameters:
iIndex
The index of the element.
Returns:
The void * pointer at index iIndex.
o operator[]
public void *& operator[](int iPos)
Subscripting operator.
Parameters:
iIndex
The index of the element.
Returns:
The void * pointer at index iIndex.

This object is included in the file: CATListPV.h
If needed, your Imakefile.mk should include the module: JS0GROUP

Copyright © 2003, Dassault Systèmes. All rights reserved.