Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

lock_map< S, T > Class Template Reference

#include <lock_map.h>

A map which inherits from mutex to provide synchronization capabilities. It guarantees the following:


Parameters
S
The type of the keys for this map.
T
The type of the values to be stored in this map.

Inheritance diagram for lock_map< S, T >:

mutex List of all members.

Public Types

typedef map_type::iterator iterator
typedef map_type::const_iterator const_iterator
typedef map_type::size_type size_type
typedef S key_type
typedef T data_type

Public Member Functions

iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
size_type size () const
size_type erase (const key_type &k)
void erase (iterator pos)
iterator find (const key_type &k)
data_typeoperator[] (const key_type &k)

Private Types

typedef std::map< S, T > map_type

Private Attributes

std::map< S, T > m_map

template<class S, class T>
class lock_map< S, T >


Member Typedef Documentation

template<class S, class T>
typedef map_type::const_iterator lock_map< S, T >::const_iterator
 

An iterator for the map. Note that the map does not retain the order in which the elements are added, rather it sorts the elements by their keys. The iterator points to a pair which has the form . The key is accessed by using c->first, assuming c is a const_iterator object. The value is accessed by using c->second. With a const_iterator, the value may not be modified.

template<class S, class T>
typedef T lock_map< S, T >::data_type
 

The type of the values stored in the map.

template<class S, class T>
typedef map_type::iterator lock_map< S, T >::iterator
 

An iterator for the map. Note that the map does not retain the order in which the elements are added, rather it sorts the elements by their keys. The iterator points to a pair which has the form . The key is accessed by using i->first, assuming i is a iterator object. The value is accessed by using i->second.

template<class S, class T>
typedef S lock_map< S, T >::key_type
 

The type of the keys used to index the map.

template<class S, class T>
typedef std::map<S, T> lock_map< S, T >::map_type [private]
 

The type of the map used internally. Currently this is std::map.

template<class S, class T>
typedef map_type::size_type lock_map< S, T >::size_type
 

The type used to keep track of the number of elements in the map.


Member Function Documentation

template<class S, class T>
const_iterator lock_map< S, T >::begin  )  const [inline]
 

Gets the element at the beginning of the map.

Return Value
A const_iterator referring to the first element in the map.

template<class S, class T>
iterator lock_map< S, T >::begin  )  [inline]
 

Gets the element at the beginning of the map.

Return Value
An iterator referring to the first element in the map.

template<class S, class T>
const_iterator lock_map< S, T >::end  )  const [inline]
 

Gets an element at the end of the map. Note that the const_iterator returned by end() does not refer to a valid element and that any valid element that the const_iterator may refer to cannot be modified.

Return Value
A const_iterator referring to an invalid element just off the end of the map.

template<class S, class T>
iterator lock_map< S, T >::end  )  [inline]
 

Gets an element at the end of the map. Note that the iterator returned by end() does not refer to a valid element.

Return Value
An iterator referring to an invalid element just off the end of the map.

template<class S, class T>
void lock_map< S, T >::erase iterator  pos  )  [inline]
 

Removes an element from the map.

Parameters

pos
An iterator referring to the element to be removed.

template<class S, class T>
size_type lock_map< S, T >::erase const key_type k  )  [inline]
 

Removes an element from the map.

Parameters

k
The key of the element to be removed.
Return Value
The number of elements removed from the map.

template<class S, class T>
iterator lock_map< S, T >::find const key_type k  )  [inline]
 

Finds an element in the map.

Parameters

k
The key of the element to be found.
Return Value
An iterator referring to the element with the specified key.

template<class S, class T>
data_type& lock_map< S, T >::operator[] const key_type k  )  [inline]
 

Gets a value in the map by using the associated key.

Parameters

k
The key of the element in the map being accessed.
Return Value
A reference to the value associated with the specified key.

template<class S, class T>
size_type lock_map< S, T >::size  )  const [inline]
 

Gets the number of elements in the map.

Return Value
The number of elements in the map.


Member Data Documentation

template<class S, class T>
std::map<S, T> lock_map< S, T >::m_map [private]
 


The documentation for this class was generated from the following file:
Generated on Wed May 24 23:03:25 2006 for RTSync by  doxygen 1.4.4