ldas-tools-framecpp  2.5.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | List of all members
FrameCPP::Common::SearchContainer< T, F > Class Template Reference

A searchable container. More...

#include <SearchContainer.hh>

Inheritance diagram for FrameCPP::Common::SearchContainer< T, F >:
FrameCPP::Common::Container< T >

Public Types

typedef Container< T >::value_type value_type
 
typedef Container< T >
::const_value_type 
const_value_type
 
typedef Container< T >::iterator iterator
 
typedef Container< T >
::const_iterator 
const_iterator
 
typedef Container< T >
::reverse_iterator 
reverse_iterator
 
typedef Container< T >
::const_reverse_iterator 
const_reverse_iterator
 
typedef
LDASTools::AL::unordered_multimap
< std::string, value_type,
LDASTools::AL::hash
< std::string >
, LDASTools::AL::CaseInsensitiveCmp > 
hash_type
 
typedef hash_type::const_iterator const_hash_iterator
 
typedef hash_type::iterator hash_iterator
 
typedef std::vector< value_typecontainer_base_type
 
typedef
container_base_type::size_type 
size_type
 

Public Member Functions

 SearchContainer (bool AllowDuplicates=true)
 Default Constructor. More...
 
 SearchContainer (const SearchContainer< T, F > &sc)
 Copy Constructor. More...
 
virtual ~SearchContainer ()
 Destructor. More...
 
const SearchContainer< T, F > & operator= (const SearchContainer< T, F > &sc)
 Assignment Operator. More...
 
bool AllowDuplicates () const
 
const_iterator find (const std::string &name) const
 Finds an element with the given name. More...
 
const_iterator find (const std::string &name, const_iterator start) const
 Finds an element with the given name. More...
 
iterator find (const std::string &name)
 Finds an element with the given name. More...
 
iterator find (const std::string &name, iterator start)
 Finds an element with the given name. More...
 
const_iterator regexFind (const std::string &regex) const
 Finds an element with a name matching the given regex. More...
 
const_iterator regexFind (const std::string &regex, const_iterator start) const
 Finds an element with a name matching the given regex. More...
 
iterator regexFind (const std::string &regex)
 Finds an element with a name matching the given regex. More...
 
iterator regexFind (const std::string &regex, iterator start)
 Finds an element with a name matching the given regex. More...
 
std::pair< const_hash_iterator,
const_hash_iterator
hashFind (const std::string &name) const
 Finds an element with the given name via a hash. More...
 
std::pair< hash_iterator,
hash_iterator
hashFind (const std::string &name)
 Finds an element with a the given name via a hash. More...
 
void rehash () const
 Rehash search container. More...
 
iterator append (value_type data)
 Append an item to the container. More...
 
iterator append (const T &data)
 
iterator insert (iterator pos, value_type data)
 Insert an item into the container. More...
 
iterator insert (size_t index, const T &data)
 Insert an item into the container. More...
 
void erase (unsigned int index)
 Remove an element from the container. More...
 
void erase (iterator start, iterator finish)
 Remove a sequence of elements from the container. More...
 
SearchContainer< T, F > & Merge (const SearchContainer< T, F > &RHS)
 
bool operator== (const Container< T > &c) const
 Equality operator. More...
 
bool operator!= (const Container< T > &c) const
 Inequality operator. More...
 
IStreamStreamIn (IStream &Stream)
 
OStreamStreamOut (OStream &Stream) const
 

Detailed Description

template<class T, const std::string &(T::*)() const F>
class FrameCPP::Common::SearchContainer< T, F >

A searchable container.

The SearchContainer class allows the user to find an element in the class based upon an attribute of the contained object. For this class, there are two template parameters:

Template Parameters
TThe type of object to store.
FA constant method of class T returning a const string&. This is used to supply the attribute to query on.
Todo:
Should this be an adaptor class?

Member Typedef Documentation

template<class T, const std::string &(T::*)() const F>
typedef hash_type::const_iterator FrameCPP::Common::SearchContainer< T, F >::const_hash_iterator
template<class T, const std::string &(T::*)() const F>
typedef Container< T >::const_iterator FrameCPP::Common::SearchContainer< T, F >::const_iterator
template<class T, const std::string &(T::*)() const F>
typedef Container< T >::const_reverse_iterator FrameCPP::Common::SearchContainer< T, F >::const_reverse_iterator
template<class T, const std::string &(T::*)() const F>
typedef Container< T >::const_value_type FrameCPP::Common::SearchContainer< T, F >::const_value_type
template<class T>
typedef std::vector< value_type > FrameCPP::Common::Container< T >::container_base_type
inherited
template<class T, const std::string &(T::*)() const F>
typedef hash_type::iterator FrameCPP::Common::SearchContainer< T, F >::hash_iterator
template<class T, const std::string &(T::*)() const F>
typedef LDASTools::AL:: unordered_multimap< std::string, value_type, LDASTools::AL::hash< std::string >, LDASTools::AL::CaseInsensitiveCmp > FrameCPP::Common::SearchContainer< T, F >::hash_type
template<class T, const std::string &(T::*)() const F>
typedef Container< T >::iterator FrameCPP::Common::SearchContainer< T, F >::iterator
template<class T, const std::string &(T::*)() const F>
typedef Container< T >::reverse_iterator FrameCPP::Common::SearchContainer< T, F >::reverse_iterator
template<class T>
typedef container_base_type::size_type FrameCPP::Common::Container< T >::size_type
inherited
template<class T, const std::string &(T::*)() const F>
typedef Container< T >::value_type FrameCPP::Common::SearchContainer< T, F >::value_type

Constructor & Destructor Documentation

template<class T, const std::string &(T::*)() const F>
FrameCPP::Common::SearchContainer< T, F >::SearchContainer ( bool  AllowDuplicates = true)

Default Constructor.

Parameters
[in]AllowDuplicatesTrue if duplicates are allowed in the set
template<class T, const std::string &(T::*)() const F>
FrameCPP::Common::SearchContainer< T, F >::SearchContainer ( const SearchContainer< T, F > &  sc)

Copy Constructor.

Parameters
[in]scSearch container to be copied.
template<class T, const std::string &(T::*)() const F>
virtual FrameCPP::Common::SearchContainer< T, F >::~SearchContainer ( )
virtual

Destructor.

Member Function Documentation

template<class T, const std::string &(T::*)() const F>
bool FrameCPP::Common::SearchContainer< T, F >::AllowDuplicates ( ) const
template<class T, const std::string &(T::*)() const F>
iterator FrameCPP::Common::SearchContainer< T, F >::append ( value_type  data)
inline

Append an item to the container.

Parameters
[in]dataAn element to append.
Returns
The iterator correspinding to the appended object.
template<class T, const std::string &(T::*)() const F>
iterator FrameCPP::Common::SearchContainer< T, F >::append ( const T &  data)
inline
template<class T, const std::string &(T::*)() const F>
void FrameCPP::Common::SearchContainer< T, F >::erase ( unsigned int  index)

Remove an element from the container.

If the element is owned, then it will be destructed.

Parameters
[in]indexwhich element to erase.
template<class T, const std::string &(T::*)() const F>
void FrameCPP::Common::SearchContainer< T, F >::erase ( iterator  start,
iterator  finish 
)

Remove a sequence of elements from the container.

All owned elements in sequence will be destructed.

Parameters
[in]startSequence beginning.
[in]finishSequence end.
template<class T , const std::string &(T::*)() const F>
SearchContainer< T, F >::const_iterator FrameCPP::Common::SearchContainer< T, F >::find ( const std::string &  name) const
inline

Finds an element with the given name.

Parameters
[in]nameName to search for.
Returns
Iterator pointing to first element found.
template<class T, const std::string &(T::*)() const F>
const_iterator FrameCPP::Common::SearchContainer< T, F >::find ( const std::string &  name,
const_iterator  start 
) const

Finds an element with the given name.

Parameters
[in]nameName to search for.
[in]startStarting position.
Returns
Constant iterator pointing to first element found.
template<class T , const std::string &(T::*)() const F>
SearchContainer< T, F >::iterator FrameCPP::Common::SearchContainer< T, F >::find ( const std::string &  name)
inline

Finds an element with the given name.

Parameters
[in]nameName to search for.
Returns
Iterator pointing to first element found.
template<class T, const std::string &(T::*)() const F>
iterator FrameCPP::Common::SearchContainer< T, F >::find ( const std::string &  name,
iterator  start 
)

Finds an element with the given name.

Parameters
[in]nameName to search for.
[in]startWhere to begin search.
Returns
Iterator pointing to first element found.
template<class T, const std::string &(T::*)() const F>
std::pair< const_hash_iterator, const_hash_iterator > FrameCPP::Common::SearchContainer< T, F >::hashFind ( const std::string &  name) const

Finds an element with the given name via a hash.

Parameters
[in]nameThe name to search for.
Returns
Iterator range for the elements found.
template<class T, const std::string &(T::*)() const F>
std::pair< hash_iterator, hash_iterator > FrameCPP::Common::SearchContainer< T, F >::hashFind ( const std::string &  name)

Finds an element with a the given name via a hash.

Parameters
[in]nameThe name to search for.
Returns
Iterator range for the elements found.
template<class T, const std::string &(T::*)() const F>
iterator FrameCPP::Common::SearchContainer< T, F >::insert ( iterator  pos,
value_type  data 
)
inline

Insert an item into the container.

Parameters
[in]posAn iterator pointing to the location where the element should be added.
[in]dataThe item to add.
Returns
An iterator pointing to the added item.
Exceptions
std::bad_allocMemory could not be allocated for the element.
template<class T, const std::string &(T::*)() const F>
iterator FrameCPP::Common::SearchContainer< T, F >::insert ( size_t  index,
const T &  data 
)
inline

Insert an item into the container.

Parameters
[in]indexThe index at which the element should be added. If the index is out of range then the element will be inserted at the end.
[in]dataThe item to add.
Returns
iterator An iterator pointing to the added item.
template<class T, const std::string &(T::*)() const F>
SearchContainer< T, F>& FrameCPP::Common::SearchContainer< T, F >::Merge ( const SearchContainer< T, F > &  RHS)
template<class T>
bool FrameCPP::Common::Container< T >::operator!= ( const Container< T > &  c) const
inherited

Inequality operator.

Parameters
[in]cThe container to compare with.
Returns
true if the containers are not equal.

This chacks to see if two containers do not contain identical elements.

template<class T, const std::string &(T::*)() const F>
const SearchContainer< T, F >& FrameCPP::Common::SearchContainer< T, F >::operator= ( const SearchContainer< T, F > &  sc)

Assignment Operator.

Parameters
[in]scSearch container to be assigned.
Returns
"this" search container.
template<class T>
bool FrameCPP::Common::Container< T >::operator== ( const Container< T > &  c) const
inherited

Equality operator.

Parameters
[in]cThe container to compare with.
Returns
true if the containers are equal.
template<class T , const std::string &(T::*)() const F>
SearchContainer< T, F >::const_iterator FrameCPP::Common::SearchContainer< T, F >::regexFind ( const std::string &  regex) const
inline

Finds an element with a name matching the given regex.

Parameters
[in]regexRegular expression to search for.
Returns
Iterator pointing to first element found.
template<class T, const std::string &(T::*)() const F>
const_iterator FrameCPP::Common::SearchContainer< T, F >::regexFind ( const std::string &  regex,
const_iterator  start 
) const

Finds an element with a name matching the given regex.

Parameters
[in]regexRegular expression to search for.
[in]startWhere to begin search.
Returns
Iterator pointing to first element found.
template<class T , const std::string &(T::*)() const F>
SearchContainer< T, F >::iterator FrameCPP::Common::SearchContainer< T, F >::regexFind ( const std::string &  regex)
inline

Finds an element with a name matching the given regex.

Parameters
[in]regexRegular expression to search for.
Returns
Iteartor poiting to the element found.
template<class T, const std::string &(T::*)() const F>
iterator FrameCPP::Common::SearchContainer< T, F >::regexFind ( const std::string &  regex,
iterator  start 
)

Finds an element with a name matching the given regex.

Parameters
[in]regexRegular expression to search for.
[in]startWhere to begin search.
Returns
iterator Iteartor poiting to the element found.
template<class T, const std::string &(T::*)() const F>
void FrameCPP::Common::SearchContainer< T, F >::rehash ( ) const

Rehash search container.

template<class T >
IStream & FrameCPP::Common::Container< T >::StreamIn ( IStream Stream)
inherited
template<class T >
OStream & FrameCPP::Common::Container< T >::StreamOut ( OStream Stream) const
inherited

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