ldas-tools-framecpp 3.0.4
Loading...
Searching...
No Matches
FrameCPP::Common::SearchContainer< T, F > Class Template Reference

A searchable container. More...

#include <SearchContainer.hh>

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

Public Member Functions

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

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?

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?

Constructor & Destructor Documentation

◆ SearchContainer() [1/4]

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

◆ SearchContainer() [2/4]

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.

◆ SearchContainer() [3/4]

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

◆ SearchContainer() [4/4]

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.

Member Function Documentation

◆ append() [1/2]

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.

◆ append() [2/2]

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.

◆ erase() [1/4]

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.

◆ erase() [2/4]

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.

◆ erase() [3/4]

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.

◆ erase() [4/4]

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.

◆ find() [1/8]

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.

◆ find() [2/8]

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

Finds an element with the given name.

Parameters
[in]nameName to search for.
Returns
Iterator pointing to first element found.

◆ find() [3/8]

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.

◆ find() [4/8]

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

Finds an element with the given name.

Parameters
[in]nameName to search for.
Returns
Iterator pointing to first element found.

◆ find() [5/8]

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.

◆ find() [6/8]

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.

◆ find() [7/8]

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.

◆ find() [8/8]

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.

◆ hashFind() [1/4]

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.

◆ hashFind() [2/4]

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.

◆ hashFind() [3/4]

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.

◆ hashFind() [4/4]

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.

◆ insert() [1/4]

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.

◆ insert() [2/4]

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.

◆ insert() [3/4]

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.

◆ insert() [4/4]

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.

◆ operator!=() [1/2]

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.

◆ operator!=() [2/2]

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.

◆ operator=() [1/2]

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.

◆ operator=() [2/2]

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.

◆ operator==() [1/2]

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.

◆ operator==() [2/2]

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.

◆ regexFind() [1/8]

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.

◆ regexFind() [2/8]

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

Finds an element with a name matching the given regex.

Parameters
[in]regexRegular expression to search for.
Returns
Iteartor poiting to the element found.

◆ regexFind() [3/8]

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.

◆ regexFind() [4/8]

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

Finds an element with a name matching the given regex.

Parameters
[in]regexRegular expression to search for.
Returns
Iterator pointing to first element found.

◆ regexFind() [5/8]

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.

◆ regexFind() [6/8]

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.

◆ regexFind() [7/8]

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.

◆ regexFind() [8/8]

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.

The documentation for this class was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/ldas-tools-framecpp-3.0.4-build/ldas-tools-framecpp-3.0.4/build/include/framecpp/Common/IOStream.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-framecpp-3.0.4-build/ldas-tools-framecpp-3.0.4/build/include/framecpp/Common/SearchContainer.hh
  • /home/abuild/rpmbuild/BUILD/ldas-tools-framecpp-3.0.4-build/ldas-tools-framecpp-3.0.4/src/Common/SearchContainer.hh