GlobalObjects
|
Template list class for pointers to objects. More...
#include <PtlTDVList.h>
Public Member Functions | |
TDVList (const TDVList &rList) | |
TDVList (ListMode eMode=DEFAULT) | |
virtual | ~TDVList () |
virtual int | addElementFrom (TDVList &rList) |
virtual T_DATA * | get (ElementPosition eElementPos=FIRST_POS) |
int | get (T_DATA *&prRetVal, std::size_t nPosition, DVElement *pRefElement) |
int | get (T_DATA *&prRetVal, std::size_t nPosition, SeekMode eMode) |
ListMode | getListMode () override |
std::size_t | getNumberDataObjects (T_DATA *pDataObject) |
virtual int | insert (T_DATA *pDataObject, InsertPosition eWhere=InsertLAST, VH eBeforeBehind=BEHIND) |
TDVList< T_DATA > & | operator= (const TDVList &rList) |
int | remove (ElementPosition eElementPos=CURRENT_POS) |
void | removeAll () |
int | setCurrentPosition (T_DATA *pDataObject) |
Public Member Functions inherited from ptl::ATDVList | |
ATDVList (ListMode eMode=DEFAULT) | |
virtual | ~ATDVList () |
int | currentElementCache (ElementCache eWhich) |
int | getErrorCode () |
std::size_t | getSize () |
VDVList * | getVDVList () |
Additional Inherited Members | |
Protected Attributes inherited from ptl::ATDVList | |
VDVList * | m_VDVListe |
Template list class for pointers to objects.
A TDVList consists of list elements, which have pointers to the objects to be managed. The first, last and current element can be queried. In addition, it is possible to select by a subsequent or previous element (with respect to the current element).
An element can be inserted before or after the first, last and current element. By setting a UNIQUE list, you can specify that objects may only appear once in the list.
You can delete the first, last or current element, whereby the data object is also deleted, if this (via setting RESPONSIBLE or UNIQUE | RESPONSIBLE) is set.
In order to establish type security, this has been a template class with aggregation on VDVList. With mostly inline methods, equivalent methods are stored in the VDVList called.
<B>T_DATA</B> | Type of list object pointer |
ptl::TDVList< T_DATA >::TDVList | ( | ListMode | eMode = DEFAULT | ) |
Constructor with optional parameter passing.
The list is empty at first. With parameter eMode a list can be instantiated, which includes data objects several times (no parameter or DEFAULT) or only once (UNIQUE) and/or should be the owner of the data objects (RESPONSIBLE). The values can be passed as OR-linked (e.g. UNIQUE | RESPONSIBLE).
[in] | eMode | The list mode |
<"Example"?
|
virtual |
Destructor, the list will be cleared.
If the list was instantiated with parameter RESPONSIBLE, all data objects are also destroyed.
ptl::TDVList< T_DATA >::TDVList | ( | const TDVList< T_DATA > & | rList | ) |
Copy constructor.
[in] | rList | The list whose pointers to objects are copied to this list. |
eut::ErrorNException | If an error occurs, a exception is thrown. |
|
virtual |
Copies all list elements of parameter rList to this list.
You can copy data objects from subclasses, as well as subclasses can transfer data objects among themselves. There are not duplicates the data objects, but only the pointers to them.
If there was a current element, it remains what it was, otherwise the last element will be to the current element.
If the list has been instantiated with parameter UNIQUE and a data object is already in the list, it is not inserted.
[in] | rList | The list from which the elements are copied. |
|
virtual |
Returns a pointer to a data object from the element position specified in the parameter.
If an element was delivered, it becomes the current element, otherwise the current element remains what it was.
[in] | eElementPos | From which position should the data object be delivered? Possible values are FIRST_POS, LAST_POS, CURRENT_POS, NEXT_POS or PREVIOUS_POS. |
int ptl::TDVList< T_DATA >::get | ( | T_DATA *& | prRetVal, |
std::size_t | nPosition, | ||
DVElement * | pRefElement ) |
Returns a pointer to an object in prRetVal from passed position with respect to passed pointer to an element.
[in,out] | prRetVal | In the passed pointer a found object is returned. |
[in] | nPosition | The position relative to the transferred pRefElement |
[in] | pRefElement | The reference element |
int ptl::TDVList< T_DATA >::get | ( | T_DATA *& | prRetVal, |
std::size_t | nPosition, | ||
SeekMode | eMode ) |
Returns a pointer to an object in prRetVal from the list with respect to the transfer parameters.
You can use this method to iterate through the list.
[in,out] | prRetVal | In the passed pointer a found object delivered. |
[in] | nPosition | The position relative to the search mode. |
[in] | eMode | The search mode. |
Parameter examples:
|
overridevirtual |
Returns the List mode.
Implements ptl::ATDVList.
size_t ptl::TDVList< T_DATA >::getNumberDataObjects | ( | T_DATA * | pDataObject | ) |
Returns the number of data objects that are equal to the passed data object.
[in] | pDataObject | The pointer to the object |
|
virtual |
This method inserts the pointer to a data object in the list. The current element is set to the new element.
If the list was instantiated with parameter UNIQUE and the data object is already in the list, it is not inserted.
[in] | pDataObject | Is the pointer to the data object. |
[in] | eWhere | Indicates where the data object is to be inserted in the list. Possible parameters are InsertHEAD, InsertLAST and InsertCURRENT . |
[in] | eBeforeBehind | Indicates whether the new element is placed before or after the element specified in the eWhere parameter. Possible parameters are BEFORE and BEHIND. |
TDVList< T_DATA > & ptl::TDVList< T_DATA >::operator= | ( | const TDVList< T_DATA > & | rList | ) |
Assignment operator=
When an assignment is made, all elements are removed from this list (if the list was instantiated with the parameter RESPONSIBLE, all data objects are also destroyed) and then all data objects from the assigning list are transferred to this list.
[in] | rList | The list to be assigned. |
It should be called getErrorCode() after this call.
int ptl::TDVList< T_DATA >::remove | ( | ElementPosition | eElementPos = CURRENT_POS | ) |
Removes the element specified as parameter from the list.
If a subsequent element exists, it becomes the current element, otherwise the previous element, if it exists. If list has been instantiated with parameter RESPONSIBLE, the destructor is called by the removed data object.
[in] | eElementPos | Possible values are FIRST_POS, LAST_POS and CURRENT_POS. |
void ptl::TDVList< T_DATA >::removeAll | ( | ) |
Removes all elements from the list.
If the List has been instantiated with the RESPONSIBLE parameter, the destructor is called from each removed data object.
int ptl::TDVList< T_DATA >::setCurrentPosition | ( | T_DATA * | pDataObject | ) |
If there is a PtlDV element in the list with a passed pointer, the current pointer is set to the PtlDV element, otherwise the current pointer remains what it was.
[in] | pDataObject | The data object you are looking for |