C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Sorted one-dimensional array of pointers to objects. More...

#include <templ_sfdp_array.h>

+ Inheritance diagram for SFDPArray< Type >:
+ Collaboration diagram for SFDPArray< Type >:

Public Member Functions

bool Init (const SFDPArray< Type > &other)
 Reset itself and copy 'other'.
 
size_t AddTry (Type &ent, Type *&found)
 Try to add an element with sorting. More...
 
bool AddExact (Type &)
 Add an element with sorting. More...
 
bool AddIfNotExist (Type &)
 Add an element with sorting. More...
 
void AddSimple (Type &ent)
 An access to the function of the base class - add an element to the end of the array. More...
 
size_t FindNearest (const Type &el, Type *&found) const
 Find the index of the element using the comparison function. More...
 
Type * FindExact (const Type &el) const
 Find the index of the element using the comparison function. More...
 
bool IsExist (const Type &el) const
 Returns true, if the element was found, or false otherwise. More...
 
size_t SearchIt (size_t, SearchFunc, Type *&found) const
 Find the index of the element using the search function. More...
 
void Sort (size_t minInd=SYS_MAX_T, size_t maxInd=SYS_MAX_T)
 Sort an array using the comparison function.
 

Detailed Description

template<class Type>
class SFDPArray< Type >

Sorted one-dimensional array of pointers to objects.

Sorted one-dimensional array of pointers to objects.
There is no repeat adding. The array is useless without comparison function.

Member Function Documentation

◆ AddTry()

template<class Type >
size_t SFDPArray< Type >::AddTry ( Type &  ent,
Type *&  found 
)
inline

Try to add an element with sorting.

Try to add an element with sorting. If an object already exists, it is not added.

Parameters
[in]ent- An element to add.
[out]found- Added or found element.
Returns
If the element has been added, then returns the index of added element, otherwise, returns the index of the found element.

◆ AddExact()

template<class Type >
bool SFDPArray< Type >::AddExact ( Type &  ent)
inline

Add an element with sorting.

Add an element with sorting. An existed object cannot be added repeatedly.

Returns
Returns true, if the element has been added. If the element was not added:
  • if the element is equivalent to the existing element according to the comparison function, but not the same (the pointers of the given element and the existing element are not equal), false is returned.
  • if the element is the same (the pointers of the given element and the existing element are equal), true is returned.

◆ AddIfNotExist()

template<class Type >
bool SFDPArray< Type >::AddIfNotExist ( Type &  ent)
inline

Add an element with sorting.

Add an element with sorting. An existed object cannot be added repeatedly.

Returns
Returns true, if the element has been added, false - otherwise.

◆ AddSimple()

template<class Type >
void SFDPArray< Type >::AddSimple ( Type &  ent)
inline

An access to the function of the base class - add an element to the end of the array.

An access to the function of the base class - add an element to the end of the array.

◆ FindNearest()

template<class Type >
size_t SFDPArray< Type >::FindNearest ( const Type &  el,
Type *&  found 
) const
inline

Find the index of the element using the comparison function.

Find the index of the element using the comparison function.

Parameters
[in]el- An element to find.
[out]found- The 'found' will contain the found element or the nearest to the required element.
Returns
Returns -1, if this is the nearest element, or the index of the same element.

◆ FindExact()

template<class Type >
Type * SFDPArray< Type >::FindExact ( const Type &  el) const
inline

Find the index of the element using the comparison function.

Find the index of the element using the comparison function.

Returns
Returns the found element or nullptr, if element not found.

◆ IsExist()

template<class Type >
bool SFDPArray< Type >::IsExist ( const Type &  el) const
inline

Returns true, if the element was found, or false otherwise.

Returns true, if the element was found, or false otherwise.

◆ SearchIt()

template<class Type >
size_t SFDPArray< Type >::SearchIt ( size_t  ,
SearchFunc  ,
Type *&  found 
) const

Find the index of the element using the search function.

Find the index of the element using the search function.

Parameters
[out]found- The 'found' will contain the found element or the nearest to the required element.
Returns
Returns -1, if this is the nearest, or the index of the same element.

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