libassa 3.5.1
Loading...
Searching...
No Matches
ASSA::Repository< T > Class Template Reference

#include <Repository.h>

Public Types

typedef T * value_type
typedef size_t size_type
typedef std::vector< value_typelist_t
typedef std::vector< value_type >::iterator iterator
typedef std::vector< value_type >::const_iterator const_iterator

Public Member Functions

 Repository ()
 Constructor.
virtual ~Repository ()
 Destructor.
iterator begin ()
 Get iterator to the first element of the repository.
const_iterator begin () const
 Get constant iterator to the first element of the repository.
iterator end ()
 Get iterator to the end of the repository.
const_iterator end () const
 Get constant iterator to the end of the repository.
bool empty () const
 Return true if repository is empty.
size_type size () const
 Return number of elements in the repository.
void push_back (const value_type &x_)
 Add new element to the repository.
void erase (iterator position_)
 Remove element at the position_ iterator.
bool erase (const value_type &x_)
 Remove element.
void clear ()
 Empty repository.

Private Attributes

list_tm_collection

Detailed Description

template<typename T>
class ASSA::Repository< T >

Definition at line 33 of file Repository.h.

Member Typedef Documentation

◆ const_iterator

template<typename T>
typedef std::vector<value_type>::const_iterator ASSA::Repository< T >::const_iterator

Definition at line 41 of file Repository.h.

◆ iterator

template<typename T>
typedef std::vector<value_type>::iterator ASSA::Repository< T >::iterator

Definition at line 40 of file Repository.h.

◆ list_t

template<typename T>
typedef std::vector<value_type> ASSA::Repository< T >::list_t

Definition at line 39 of file Repository.h.

◆ size_type

template<typename T>
typedef size_t ASSA::Repository< T >::size_type

Definition at line 37 of file Repository.h.

◆ value_type

template<typename T>
typedef T* ASSA::Repository< T >::value_type

Definition at line 36 of file Repository.h.

Constructor & Destructor Documentation

◆ Repository()

template<typename T>
ASSA::Repository< T >::Repository ( )
inline

Constructor.

Definition at line 45 of file Repository.h.

45 {
46 m_collection = new list_t;
47 }
list_t * m_collection
Definition Repository.h:95
std::vector< value_type > list_t
Definition Repository.h:39

References m_collection.

◆ ~Repository()

template<typename T>
virtual ASSA::Repository< T >::~Repository ( )
inlinevirtual

Destructor.

Definition at line 50 of file Repository.h.

50 {
51 if (m_collection) { clear (); delete m_collection; }
52 }
void clear()
Empty repository.
Definition Repository.h:90

References clear(), and m_collection.

Member Function Documentation

◆ begin() [1/2]

template<typename T>
iterator ASSA::Repository< T >::begin ( )
inline

Get iterator to the first element of the repository.

Definition at line 55 of file Repository.h.

55{ return m_collection->begin (); }

References m_collection.

Referenced by erase().

◆ begin() [2/2]

template<typename T>
const_iterator ASSA::Repository< T >::begin ( ) const
inline

Get constant iterator to the first element of the repository.

Definition at line 58 of file Repository.h.

58{ return m_collection->begin (); }

References m_collection.

◆ clear()

template<typename T>
void ASSA::Repository< T >::clear ( )
inline

Empty repository.

Definition at line 90 of file Repository.h.

90 {
91 m_collection->erase (m_collection->begin (), m_collection->end ());
92 }

References m_collection.

Referenced by ~Repository().

◆ empty()

template<typename T>
bool ASSA::Repository< T >::empty ( ) const
inline

Return true if repository is empty.

Definition at line 67 of file Repository.h.

67{ return m_collection->empty (); }

References m_collection.

◆ end() [1/2]

template<typename T>
iterator ASSA::Repository< T >::end ( )
inline

Get iterator to the end of the repository.

Definition at line 61 of file Repository.h.

61{ return m_collection->end (); }

References m_collection.

Referenced by erase().

◆ end() [2/2]

template<typename T>
const_iterator ASSA::Repository< T >::end ( ) const
inline

Get constant iterator to the end of the repository.

Definition at line 64 of file Repository.h.

64{ return m_collection->end (); }

References m_collection.

◆ erase() [1/2]

template<typename T>
bool ASSA::Repository< T >::erase ( const value_type & x_)
inline

Remove element.

Returns
true if element was found and erased; false otherwise

Definition at line 81 of file Repository.h.

81 {
82 iterator it = begin ();
83 while (it != end ()) {
84 if ((*it) == x_) { erase (it); break; }
85 it++;
86 }
87 }
iterator begin()
Get iterator to the first element of the repository.
Definition Repository.h:55
void erase(iterator position_)
Remove element at the position_ iterator.
Definition Repository.h:76
std::vector< value_type >::iterator iterator
Definition Repository.h:40
iterator end()
Get iterator to the end of the repository.
Definition Repository.h:61

References begin(), end(), and erase().

◆ erase() [2/2]

template<typename T>
void ASSA::Repository< T >::erase ( iterator position_)
inline

Remove element at the position_ iterator.

Definition at line 76 of file Repository.h.

76{ m_collection->erase (position_); }

References m_collection.

Referenced by erase().

◆ push_back()

template<typename T>
void ASSA::Repository< T >::push_back ( const value_type & x_)
inline

Add new element to the repository.

Definition at line 73 of file Repository.h.

73{ m_collection->push_back (x_); }

References m_collection.

◆ size()

template<typename T>
size_type ASSA::Repository< T >::size ( ) const
inline

Return number of elements in the repository.

Definition at line 70 of file Repository.h.

70{ return m_collection->size (); }

References m_collection.

Member Data Documentation

◆ m_collection

template<typename T>
list_t* ASSA::Repository< T >::m_collection
private

Definition at line 95 of file Repository.h.

Referenced by begin(), begin(), clear(), empty(), end(), end(), erase(), push_back(), Repository(), size(), and ~Repository().


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