LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
misc::endo_map< T > Class Template Reference

A renaming mapping defaulting to identity: Mapping a class with itself (endomorphism). Unless a value is already mapped onto another, map it to itself if nonstrict. This is a special case of std::map. More...

#include <endomap.hh>

Inheritance diagram for misc::endo_map< T >:
Collaboration diagram for misc::endo_map< T >:

Public Types

enum  strictness_type { nonstrict, strict }
typedef map< T, T > super_type
 Super class type.
typedef map_type::key_type key_type
 The map's key type.
typedef map_type::mapped_type mapped_type
 The type of object associated with the keys.
typedef map_type::value_type value_type
typedef map_type::key_compare key_compare
 Type of the function object that compares two keys for ordering.
typedef map_type::iterator iterator
 Iterator used to iterate through a map.
typedef map_type::const_iterator const_iterator
 Const iterator used to iterate through a map.

Public Member Functions

virtual endo_mapclone () const
 Return a duplicate of this.
virtual T & operator[] (const T &t)
virtual T operator() (const T &t) const override
 Lookup for t, returning it if unknown.
key_compare key_comp () const
 Returns the key_compare object used by the map.
virtual T operator[] (const T &t) const
 Lookup for the value associated to t.
virtual std::list< T > operator() (const std::list< T > &ts) const
virtual std::pair< iterator, bool > insert (const std::pair< const T, T > &x)
 Inserts x into the map.
virtual void insert (const map &other)
 Copy the contents of other to this.
std::pair< iterator, bool > emplace (Args &&...args)
 Insert a new element built in-place using args into the map.
virtual bool empty () const
 Is the map empty ?
virtual size_t size () const
 Number of known identifiers.
virtual T take (const T &t)
 Remove and return mapping for t from the map.
virtual void clear ()
 Erase all of the elements.
virtual std::ostream & print (std::ostream &ostr) const
 Description of known mappings.
Constructors and destructor.
 endo_map ()
virtual ~endo_map ()
virtual iterator find (const T &t)
virtual const_iterator find (const T &t) const
virtual iterator xfind (const T &t)
virtual const_iterator xfind (const T &t) const
Iterating.
virtual iterator begin ()
virtual const_iterator begin () const
virtual iterator end ()
virtual const_iterator end () const
virtual iterator lower_bound (const T &k)
virtual const_iterator lower_bound (const T &k) const

Protected Types

typedef std::map< T, T > map_type

Protected Attributes

strictness_type strictness_
 If strict, queries for an unknown (unmapped) Identifier is an error.
map_type map_
 Mapping from T to N.

Detailed Description

template<class T>
class misc::endo_map< T >

A renaming mapping defaulting to identity: Mapping a class with itself (endomorphism). Unless a value is already mapped onto another, map it to itself if nonstrict. This is a special case of std::map.

Member Typedef Documentation

typedef map_type::const_iterator misc::map< T, T >::const_iterator
inherited

Const iterator used to iterate through a map.

typedef map_type::iterator misc::map< T, T >::iterator
inherited

Iterator used to iterate through a map.

typedef map_type::key_compare misc::map< T, T >::key_compare
inherited

Type of the function object that compares two keys for ordering.

typedef map_type::key_type misc::map< T, T >::key_type
inherited

The map's key type.

typedef std::map<T, T > misc::map< T, T >::map_type
protectedinherited
typedef map_type::mapped_type misc::map< T, T >::mapped_type
inherited

The type of object associated with the keys.

template<class T>
typedef map<T, T> misc::endo_map< T >::super_type

Super class type.

typedef map_type::value_type misc::map< T, T >::value_type
inherited

The type of object, std::pair<const key_type, data_type>, stored in the map.

Member Enumeration Documentation

template<class T>
enum misc::endo_map::strictness_type
Enumerator:
nonstrict 

Querying about an unknown identifier returns itself.

strict 

Querying about an unknown identifier is an error.

Constructor & Destructor Documentation

template<class T >
misc::endo_map< T >::endo_map ( )
template<class T >
misc::endo_map< T >::~endo_map ( )
virtual

Member Function Documentation

virtual iterator misc::map< T, T >::begin ( )
virtualinherited
virtual const_iterator misc::map< T, T >::begin ( ) const
virtualinherited
virtual void misc::map< T, T >::clear ( )
virtualinherited

Erase all of the elements.

template<class T >
endo_map< T > * misc::endo_map< T >::clone ( ) const
virtual

Return a duplicate of this.

Reimplemented from misc::map< T, T >.

std::pair<iterator, bool> misc::map< T, T >::emplace ( Args &&...  args)
inherited

Insert a new element built in-place using args into the map.

virtual bool misc::map< T, T >::empty ( ) const
virtualinherited

Is the map empty ?

virtual iterator misc::map< T, T >::end ( )
virtualinherited
virtual const_iterator misc::map< T, T >::end ( ) const
virtualinherited
virtual iterator misc::map< T, T >::find ( const T &  t)
virtualinherited

Lookup for t.

virtual const_iterator misc::map< T, T >::find ( const T &  t) const
virtualinherited
virtual std::pair<iterator, bool> misc::map< T, T >::insert ( const std::pair< const T, T > &  x)
virtualinherited

Inserts x into the map.

virtual void misc::map< T, T >::insert ( const map< T, T > &  other)
virtualinherited

Copy the contents of other to this.

key_compare misc::map< T, T >::key_comp ( ) const
inherited

Returns the key_compare object used by the map.

virtual iterator misc::map< T, T >::lower_bound ( const T &  k)
virtualinherited

Finds the first element whose key is not less than k.

virtual const_iterator misc::map< T, T >::lower_bound ( const T &  k) const
virtualinherited
template<class T>
T misc::endo_map< T >::operator() ( const T &  t) const
overridevirtual

Lookup for t, returning it if unknown.

Reimplemented from misc::map< T, T >.

References misc::find().

virtual std::list<T > misc::map< T, T >::operator() ( const std::list< T > &  ts) const
virtualinherited

Lookup for a list ts of T's, throwing std::range_error if one or several elements are not found.

template<class T>
T & misc::endo_map< T >::operator[] ( const T &  t)
virtual

Return a reference to the value associated to t.

If t was not inserted before, then, contrary to std::map, we insert t -> t into the map, instead of `t -> T()'. This spares the construction of a new T, which may have nasty effects if this constructor has side effects (e.g., incrementing a counter).

Reimplemented from misc::map< T, T >.

virtual T misc::map< T, T >::operator[] ( const T &  t) const
virtualinherited

Lookup for the value associated to t.

virtual std::ostream& misc::map< T, T >::print ( std::ostream &  ostr) const
virtualinherited

Description of known mappings.

virtual size_t misc::map< T, T >::size ( ) const
virtualinherited

Number of known identifiers.

virtual T misc::map< T, T >::take ( const T &  t)
virtualinherited

Remove and return mapping for t from the map.

virtual iterator misc::map< T, T >::xfind ( const T &  t)
virtualinherited

Lookup for t and throw an exception if not available.

virtual const_iterator misc::map< T, T >::xfind ( const T &  t) const
virtualinherited

Member Data Documentation

map_type misc::map< T, T >::map_
protectedinherited

Mapping from T to N.

template<class T>
strictness_type misc::endo_map< T >::strictness_
protected

If strict, queries for an unknown (unmapped) Identifier is an error.


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