Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Dyn_Slist_Nc< T > Class Template Reference

Lista dinámica de elementos de tipo T. More...

#include <tpl_dyn_slist_nc.H>

Inheritance diagram for Aleph::Dyn_Slist_Nc< T >:
[legend]
Collaboration diagram for Aleph::Dyn_Slist_Nc< T >:
[legend]

Classes

class  Iterator
 

Public Types

typedef Snode_Nc< TNode
 

Public Member Functions

void empty ()
 Vacía totalmente a la lista.
 
Tinsert (const T &data) throw (std::exception, std::bad_alloc)
 Inserta un elemento al principio de la lista.
 
Tappend (const T &data) throw (std::exception, std::bad_alloc)
 Inserta un elemento al final de la lista.
 
Tget_first ()
 Retorna una referencia al primer elemento de la lista.
 
Tget_last ()
 Retorna una referencia al último elemento de la lista.
 
T remove_first ()
 Elimina el primer elemento de la lista: retorna una copia del elemento eliminado.
 
Tput (const T &item)
 Si this es una cola, entonces mete el elemento item.
 
T get ()
 Si this es una cola, entonces extrae el elemento más antiguo.
 
Trear ()
 Si this e suna cola, entonces retorna el elemento más joven.
 
Tfront ()
 Si this e suna cola, entonces retorna el elemento más antiguo.
 
Tpush (const T &item)
 Si this es una pila, entonces inserta item.
 
T pop ()
 Si this es una pila, entonces elimina el tope.
 
Ttop () const
 Si this es una pila, entonces retorna el tope.
 
const size_tsize () const
 
 Dyn_Slist_Nc ()
 Constructor vacío.
 
 Dyn_Slist_Nc (const Dyn_Slist_Nc &l)
 Constructor de copia.
 
 ~Dyn_Slist_Nc ()
 
Dyn_Slist_Ncoperator= (const Dyn_Slist_Nc &list)
 Asignación de lista dinámica con semántica lvalue.
 
Toperator[] (const size_t &n)
 
- Public Member Functions inherited from Aleph::Snode_Nc< T >
 Snode_Nc ()
 Constructor vacío.
 
 Snode_Nc (const T &_data)
 Constructor que copia dato.
 
 ~Snode_Nc ()
 
Tget_data ()
 Retorna una referencia al dato contenido en el nodo.
 
Snode_Ncremove_next ()
 Elimina el nodo siguiente a this.
 
Snode_Nc *& get_next ()
 Retorna el nodo siguiente a this.
 

Private Attributes

Nodehead
 
size_t num_items
 

Additional Inherited Members

Detailed Description

template<typename T>
class Aleph::Dyn_Slist_Nc< T >

Lista dinámica de elementos de tipo T.

Dyn_Slist_Nc<T> define una lista dinámica, es una secuencia de elementos de algún tipo T.

Este tipo puede emplearse como pila o cola.

Parameters
Tel tipo de elementos de la lista.
See also
Slink, Snode_Nc, Dyn_Slist_Nc::Iterator
Author
Leandro R. León
Alejandro J. Mujica

Definition at line 63 of file tpl_dyn_slist_nc.H.

Member Typedef Documentation

◆ Node

Definition at line 66 of file tpl_dyn_slist_nc.H.

Constructor & Destructor Documentation

◆ Dyn_Slist_Nc() [1/2]

template<typename T >
Aleph::Dyn_Slist_Nc< T >::Dyn_Slist_Nc ( )
inline

Constructor vacío.

Definition at line 205 of file tpl_dyn_slist_nc.H.

◆ Dyn_Slist_Nc() [2/2]

template<typename T >
Aleph::Dyn_Slist_Nc< T >::Dyn_Slist_Nc ( const Dyn_Slist_Nc< T > &  l)
inline

Constructor de copia.

Definition at line 211 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::append(), Aleph::Slink_Nc::Iterator::has_curr(), and l.

◆ ~Dyn_Slist_Nc()

template<typename T >
Aleph::Dyn_Slist_Nc< T >::~Dyn_Slist_Nc ( )
inline

Definition at line 218 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::empty().

Member Function Documentation

◆ append()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::append ( const T data)
throw (std::exception,
std::bad_alloc
)
inline

Inserta un elemento al final de la lista.

Inserta en la lista this como último elemento una copia de data.

Después de la operación el último elemento de la lista es data.

Parameters
[in]datael dato a insertarse.
Returns
referencia al dato recién insertado.
Exceptions
bad_allocsi no hay memoria para el nuevo elemento.

Definition at line 115 of file tpl_dyn_slist_nc.H.

References Aleph::Snode_Nc< T >::data, Aleph::Snode_Nc< T >::get_data(), Aleph::Dyn_Slist_Nc< T >::head, Aleph::Slink_Nc::insert(), Aleph::maps(), and Aleph::Dyn_Slist_Nc< T >::num_items.

Referenced by Aleph::Dyn_Slist_Nc< T >::Dyn_Slist_Nc(), Aleph::Dyn_Slist_Nc< T >::operator=(), and Aleph::Dyn_Slist_Nc< T >::put().

◆ empty()

◆ front()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::front ( )
inline

Si this e suna cola, entonces retorna el elemento más antiguo.

Definition at line 170 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::get_first().

◆ get()

template<typename T >
T Aleph::Dyn_Slist_Nc< T >::get ( )
inline

Si this es una cola, entonces extrae el elemento más antiguo.

Definition at line 164 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::remove_first().

◆ get_first()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::get_first ( )
inline

◆ get_last()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::get_last ( )
inline

Retorna una referencia al último elemento de la lista.

Definition at line 135 of file tpl_dyn_slist_nc.H.

References ah_underflow_error_if, Aleph::Snode_Nc< T >::get_data(), and Aleph::Slink_Nc::is_empty().

Referenced by Aleph::Dyn_Slist_Nc< T >::rear().

◆ insert()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::insert ( const T data)
throw (std::exception,
std::bad_alloc
)
inline

Inserta un elemento al principio de la lista.

Inserta en la lista this como primer elemento una copia de data.

Después de la operación el primer elemento de la lista es data.

Parameters
[in]datael dato a insertarse.
Returns
referencia al dato recién insertado.
Exceptions
bad_allocsi no hay memoria para el nuevo elemento.

Definition at line 94 of file tpl_dyn_slist_nc.H.

References Aleph::Snode_Nc< T >::data, Aleph::Snode_Nc< T >::get_data(), Aleph::Dyn_Slist_Nc< T >::head, Aleph::Slink_Nc::insert(), and Aleph::Dyn_Slist_Nc< T >::num_items.

Referenced by Aleph::Dyn_Slist_Nc< T >::push().

◆ operator=()

template<typename T >
Dyn_Slist_Nc & Aleph::Dyn_Slist_Nc< T >::operator= ( const Dyn_Slist_Nc< T > &  list)
inline

Asignación de lista dinámica con semántica lvalue.

La asignación elimina todos los elementos de this y luego copia en this los elementos contenidos en la lista list.

Parameters
[in]listlista a ser asignada
Exceptions
bad_allocsi no hay memoria.

Definition at line 231 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::append(), Aleph::Dyn_Slist_Nc< T >::empty(), Aleph::Slink_Nc::Iterator::has_curr(), Aleph::Slink_Nc::is_empty(), and Aleph::maps().

◆ operator[]()

◆ pop()

template<typename T >
T Aleph::Dyn_Slist_Nc< T >::pop ( )
inline

Si this es una pila, entonces elimina el tope.

Definition at line 176 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::remove_first().

◆ push()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::push ( const T item)
inline

Si this es una pila, entonces inserta item.

Definition at line 173 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::insert().

◆ put()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::put ( const T item)
inline

Si this es una cola, entonces mete el elemento item.

Definition at line 161 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::append().

◆ rear()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::rear ( )
inline

Si this e suna cola, entonces retorna el elemento más joven.

Definition at line 167 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::get_last().

◆ remove_first()

template<typename T >
T Aleph::Dyn_Slist_Nc< T >::remove_first ( )
inline

Elimina el primer elemento de la lista: retorna una copia del elemento eliminado.

Returns
una copia del elemento eliminado.
Exceptions
underflow_errorsi la lista está vacía.

Definition at line 148 of file tpl_dyn_slist_nc.H.

References ah_underflow_error_if, Aleph::Snode_Nc< T >::get_data(), Aleph::Dyn_Slist_Nc< T >::head, Aleph::Slink_Nc::is_empty(), Aleph::maps(), Aleph::Dyn_Slist_Nc< T >::num_items, and Aleph::Snode_Nc< T >::remove_next().

Referenced by Aleph::Dyn_Slist_Nc< T >::get(), and Aleph::Dyn_Slist_Nc< T >::pop().

◆ size()

template<typename T >
const size_t & Aleph::Dyn_Slist_Nc< T >::size ( ) const
inline

Definition at line 181 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::num_items.

◆ top()

template<typename T >
T & Aleph::Dyn_Slist_Nc< T >::top ( ) const
inline

Si this es una pila, entonces retorna el tope.

Definition at line 179 of file tpl_dyn_slist_nc.H.

References Aleph::Dyn_Slist_Nc< T >::get_first().

Member Data Documentation

◆ head

◆ num_items


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