openDAQ
Open data acquisition platform
ListObjectPtr< T, TValueInterface, TValuePtr > Class Template Reference

Represents a heterogeneous collection of objects that can be individually accessed by index. More...

Detailed Description

template<class T, class TValueInterface, class TValuePtr>
class ListObjectPtr< T, TValueInterface, TValuePtr >

Represents a heterogeneous collection of objects that can be individually accessed by index.

Public Member Functions

TValuePtr getItemAt (size_t index) const
 Gets the element at a specific position. More...
 
SizeT getCount () const
 Gets the number of elements contained in the list. More...
 
SizeT empty () const
 Returns true if there are no elements in the list. More...
 
void setItemAt (size_t index, const TValuePtr &obj)
 Sets the element at a specific position. More...
 
void pushBack (const TValuePtr &obj)
 Inserts the element at the end of the list. More...
 
void pushBack (TValuePtr &&obj)
 Inserts the element at the end of the list. More...
 
void pushFront (const TValuePtr &obj)
 Inserts the element at the start of the list. More...
 
void pushFront (TValuePtr &&obj)
 Inserts the element at the start of the list. More...
 
TValuePtr popBack ()
 Gets the element from the end of the list. More...
 
TValuePtr popFront ()
 Gets the element from the start of the list. More...
 
void insertAt (size_t index, const TValuePtr &obj)
 Inserts the element at a specific position. More...
 
TValuePtr removeAt (size_t index)
 Removes the element at a specific position. More...
 
void deleteAt (size_t index)
 Deletes the element at a specific position. More...
 
void clear ()
 Removes all elements from the list.
 
IteratorType begin () const
 Creates start iterator for the list.
 
IteratorType end () const
 Creates end iterator for the list.
 
IntfID getElementInterfaceId () const
 Returns the interface id of the expected list element type. More...
 
std::vector< TValuePtr > toVector ()
 Returns a copy of list as std::vector.
 

Member Function Documentation

◆ deleteAt()

void deleteAt ( size_t  index)

Deletes the element at a specific position.

Parameters
indexThe zero-based index of the element to remove.

If the client needs the element deleted, it should use removeAt method.

◆ empty()

SizeT empty

Returns true if there are no elements in the list.

Returns
True if no elements are in the list, False otherwise.

◆ getCount()

SizeT getCount

Gets the number of elements contained in the list.

Returns
The number of elements contained in the list.

◆ getElementInterfaceId()

IntfID getElementInterfaceId

Returns the interface id of the expected list element type.

Returns
The interface id of the expected element type otherwise returns the id of IUnknown.

◆ getItemAt()

V getItemAt ( size_t  index) const

Gets the element at a specific position.

Parameters
indexThe zero-based index of the element to get.
Returns
The element at the specified index.

◆ insertAt()

void insertAt ( size_t  index,
const TValuePtr &  obj 
)

Inserts the element at a specific position.

Parameters
indexThe zero-based index of the element to insert.
objThe element to insert at the specified index.

◆ popBack()

V popBack

Gets the element from the end of the list.

Returns
The extracted element.

◆ popFront()

V popFront

Gets the element from the start of the list.

Returns
The extracted element.

◆ pushBack() [1/2]

void pushBack ( const TValuePtr &  obj)

Inserts the element at the end of the list.

Parameters
objThe element to insert.

◆ pushBack() [2/2]

void pushBack ( TValuePtr &&  obj)

Inserts the element at the end of the list.

Parameters
objThe element to insert.

◆ pushFront() [1/2]

void pushFront ( const TValuePtr &  obj)

Inserts the element at the start of the list.

Parameters
objThe element to insert.

◆ pushFront() [2/2]

void pushFront ( TValuePtr &&  obj)

Inserts the element at the start of the list.

Parameters
objThe element to insert.

◆ removeAt()

V removeAt ( size_t  index)

Removes the element at a specific position.

Parameters
indexThe zero-based index of the element to remove.
Returns
The removed element.

If the client does not need the element after it is removed, it should call delete method.

◆ setItemAt()

void setItemAt ( size_t  index,
const TValuePtr &  obj 
)

Sets the element at a specific position.

Parameters
indexThe zero-based index of the element to set.
objThe element to set at the specified index.