Isomet Modular Synthesiser (iMS) API  v1.4.2
iMS API
Public Member Functions | List of all members
iMS::ListBase< T > Class Template Reference

Template Class encapsulating a list object and acting as a base list class for other classes in the library to inherit from. More...

#include <include/Containers.h>

Public Member Functions

bool operator== (ListBase const &rhs) const
 Equality Operator checks ListBase object for equivalence. More...
 
Constructors & Destructor
 ListBase (const std::string &Name="[no name]", const std::time_t &modified_time=std::time(nullptr))
 Create a default empty List with optional name parameter.
 
 ~ListBase ()
 Destructor.
 
 ListBase (const ListBase &)
 Copy Constructor.
 
ListBaseoperator= (const ListBase &)
 Assignment Constructor.
 
ListBase Unique Identifier
const std::array< std::uint8_t, 16 > GetUUID () const
 Returns a vector representing the Unique Identifier assigned to the ListBase object. More...
 
Timestamping
const std::time_t & ModifiedTime () const
 Returns Time at which the Container was last modified. More...
 
std::string ModifiedTimeFormat () const
 Returns Human-readable string for the time at which the Container was last modified. More...
 
Container Description
const std::string & Name () const
 A string stored with the Container to aid human users in identifying its purpose. More...
 
std::string & Name ()
 
Modifiers
void assign (size_t n, const T &val)
 Assign new content to ImageSequence list. More...
 
void push_front (const T &val)
 Insert ImageSequenceEntry at beginning. More...
 
void pop_front ()
 Delete first ImageSequenceEntry. More...
 
void push_back (const T &val)
 Add ImageSequenceEntry at end. More...
 
void pop_back ()
 Delete last ImageSequenceEntry. More...
 
iterator insert (iterator position, const T &val)
 Insert ImageSequenceEntry. More...
 
iterator insert (iterator position, const_iterator first, const_iterator last)
 Insert Range Of ImageSequenceEntry's. More...
 
iterator erase (iterator position)
 Erase ImageSequenceEntry. More...
 
iterator erase (iterator first, iterator last)
 Erase a range of ImageSequenceEntry's. More...
 
void resize (size_t n)
 Change Size. More...
 
void clear ()
 Clear Content. More...
 
Helper Functions
bool empty () const
 Returns True if the ListBase is empty. More...
 
std::size_t size () const
 Returns the Number of Entries in the ListBase. More...
 

Iterator Specification

Use these iterators when you want to iteratively read through or update the entries stored within a ListBase. Iterators can be used to access elements at an arbitrary offset position relative to the element they point to.

Two types of iterators are supported; both are random access iterators. Dereferencing const_iterator yields a reference to a constant entry in the ListBase(const ListBase&).

typedef std::list< T >::iterator iterator
 Iterator defined for user manipulation of ListBase.
 
typedef std::list< T >::const_iterator const_iterator
 Const Iterator defined for user readback of ListBase.
 
iterator begin ()
 Returns an iterator pointing to the first element in the ListBase container. More...
 
iterator end ()
 Returns an iterator referring to the past-the-end element in the ListBase container. More...
 
const_iterator begin () const
 Returns a const_iterator pointing to the first element in the ListBase container. More...
 
const_iterator end () const
 Returns a const_iterator referring to the past-the-end element in the ListBase container. More...
 
const_iterator cbegin () const
 Returns a const_iterator pointing to the first element in the ListBase container. More...
 
const_iterator cend () const
 Returns a const_iterator referring to the past-the-end element in the ListBase container. More...
 

Detailed Description

template<typename T>
class iMS::ListBase< T >

Template Class encapsulating a list object and acting as a base list class for other classes in the library to inherit from.

Date
2016-11-09
Since
1.3

Member Function Documentation

template<typename T>
void iMS::ListBase< T >::assign ( size_t  n,
const T &  val 
)

Assign new content to ImageSequence list.

Assigns new contents to the ImageSequence list container, replacing its current contents, and modifying its size accordingly. the new contents are n elements, each initialized to a copy of val.

Parameters
[in]nNew size for the container.
[in]valImageSequenceEntry to fill the ImageSequence with. Each of the n elements in the container will be initialized to a copy of this value.
template<typename T>
iterator iMS::ListBase< T >::begin ( )

Returns an iterator pointing to the first element in the ListBase container.

Returns
An iterator to the beginning of the ListBase container.
template<typename T>
const_iterator iMS::ListBase< T >::begin ( ) const

Returns a const_iterator pointing to the first element in the ListBase container.

Returns
A ListBase to the beginning of the ListBase container.
Since
1.2.5
template<typename T>
const_iterator iMS::ListBase< T >::cbegin ( ) const

Returns a const_iterator pointing to the first element in the ListBase container.

Returns
A const_iterator to the beginning of the ListBase container.
template<typename T>
const_iterator iMS::ListBase< T >::cend ( ) const

Returns a const_iterator referring to the past-the-end element in the ListBase container.

Returns
A const_iterator to the element past the end of the ListBase.
template<typename T>
void iMS::ListBase< T >::clear ( )

Clear Content.

Removes all elements from the list container (which are destroyed), and leaving the ImageSequence with a size of 0.

template<typename T>
bool iMS::ListBase< T >::empty ( ) const

Returns True if the ListBase is empty.

Returns
True if the ListBase is empty
template<typename T>
iterator iMS::ListBase< T >::end ( )

Returns an iterator referring to the past-the-end element in the ListBase container.

The past-the-end element is the theoretical element that would follow the last element in the ListBase container. It does not point to any element, and thus shall not be dereferenced.

Because the ranges used by functions of the standard library do not include the element pointed by their closing iterator, this function can be used in combination with ListBase::begin to specify a range including all the elements in the container.

Returns
An iterator to the element past the end of the ListBase
template<typename T>
const_iterator iMS::ListBase< T >::end ( ) const

Returns a const_iterator referring to the past-the-end element in the ListBase container.

Returns
A const_iterator to the element past the end of the ListBase.
Since
1.2.5
template<typename T>
iterator iMS::ListBase< T >::erase ( iterator  position)

Erase ImageSequenceEntry.

Removes a single ImageSequenceEntry element (at position) from the list container

Parameters
[in]positionIterator pointing to a single element to be removed from the list.
Returns
An iterator pointing to the element that followed the last element erased by the function call. This is the container end if the operation erased the last element in the sequence.
template<typename T>
iterator iMS::ListBase< T >::erase ( iterator  first,
iterator  last 
)

Erase a range of ImageSequenceEntry's.

Removes a range of ImageSequenceEntry elements (first,last) from the list container

Parameters
[in]firstIterators within the list to be removed.
[in]lastIterators within the list to be removed.
Returns
An iterator pointing to the element that followed the last element erased by the function call. This is the container end if the operation erased the last element in the sequence.
template<typename T>
const std::array<std::uint8_t, 16> iMS::ListBase< T >::GetUUID ( ) const

Returns a vector representing the Unique Identifier assigned to the ListBase object.

Returns
UUID as an array of uint8_t's
template<typename T>
iterator iMS::ListBase< T >::insert ( iterator  position,
const T &  val 
)

Insert ImageSequenceEntry.

The ImageSequence container is extended by inserting new elements before the element at the specified position. This effectively increases the ImageSequence list size by one.

Parameters
[in]positionPosition in the container where the new elements are inserted.
[in]valImageSequenceEntry Value to be copied (or moved) to the inserted elements.
Returns
An iterator that points to the first of the newly inserted elements.
template<typename T>
iterator iMS::ListBase< T >::insert ( iterator  position,
const_iterator  first,
const_iterator  last 
)

Insert Range Of ImageSequenceEntry's.

The ImageSequence container is extended by inserting new elements before the element at the specified position from a range of ImageSequenceEntries present in another ImageSequence. This effectively increases the ImageSequence list size by the number of entries in the range

Parameters
[in]positionPosition in the container where the new elements are inserted.
[in]firstIterator specifying the first of a range of elements.
[in]lastIterator specifying the last of a range of elements. All the elements between first and last, including the element pointed by first but not the one pointed by last are inserted to the ImageSequence before position.
Returns
An iterator that points to the first of the newly inserted elements.
template<typename T>
const std::time_t& iMS::ListBase< T >::ModifiedTime ( ) const

Returns Time at which the Container was last modified.

Any time the container is modified (added to, deleted from, elements updated), the system time is recorded. This happens coincident with the UUID if the container also being updated. This function returns to the user that timestamp.

Returns
a reference to a std::time_t representing the time at which the container was last modified
Since
1.3
template<typename T>
std::string iMS::ListBase< T >::ModifiedTimeFormat ( ) const

Returns Human-readable string for the time at which the Container was last modified.

Since
1.3
template<typename T>
const std::string& iMS::ListBase< T >::Name ( ) const

A string stored with the Container to aid human users in identifying its purpose.

Updating the Container Name does not cause the Container UUID to change.

template<typename T>
bool iMS::ListBase< T >::operator== ( ListBase< T > const &  rhs) const

Equality Operator checks ListBase object for equivalence.

Parameters
[in]rhsAn ListBase object to perform the comparison with
Returns
True if the supplied ListBase is identical to this one.
template<typename T>
void iMS::ListBase< T >::pop_back ( )

Delete last ImageSequenceEntry.

Removes the last ImageSequenceEntry in the ImageSequence list container, effectively reducing its size by one. This destroys the removed entry.

template<typename T>
void iMS::ListBase< T >::pop_front ( )

Delete first ImageSequenceEntry.

Removes the first ImageSequenceEntry in the ImageSequence list container, effectively reducing its size by one. This destroys the removed entry.

template<typename T>
void iMS::ListBase< T >::push_back ( const T &  val)

Add ImageSequenceEntry at end.

Adds a new ImageSequenceEntry at the end of the ImageSequence list container, after its current last element. The content of val is copied (or moved) to the new element. This effectively increases the Sequence size by one.

Parameters
[in]valImageSequenceEntry to be copied (or moved) to the new element.
template<typename T>
void iMS::ListBase< T >::push_front ( const T &  val)

Insert ImageSequenceEntry at beginning.

Inserts a new element at the beginning of the list, right before its current first element. The content of val is copied (or moved) to the inserted element. This effectively increases the Sequence size by one.

Parameters
[in]valImageSequenceEntry to be copied (or moved) to the inserted element.
template<typename T>
void iMS::ListBase< T >::resize ( size_t  n)

Change Size.

Resizes the ImageSequence container so that it contains n elements. If n is smaller than the current container size, the content is reduced to its first n elements, removing those beyond (and destroying them). If n is greater than the current container size, the content is expanded by inserting at the end as many elements as needed to reach a size of n. The new ImageSequenceEntry 's are default-initialized. Notice that this function changes the actual content of the container by inserting or erasing elements from it.

Parameters
[in]nNew container size, expressed in number of elements.
template<typename T>
std::size_t iMS::ListBase< T >::size ( ) const

Returns the Number of Entries in the ListBase.

Returns
std::size_t representing the number of elements in the ListBase

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