ldas-tools-framecpp
2.6.5
|
A searchable container. More...
#include <SearchContainer.hh>
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_type > | container_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 ®ex) const |
Finds an element with a name matching the given regex. More... | |
const_iterator | regexFind (const std::string ®ex, const_iterator start) const |
Finds an element with a name matching the given regex. More... | |
iterator | regexFind (const std::string ®ex) |
Finds an element with a name matching the given regex. More... | |
iterator | regexFind (const std::string ®ex, 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... | |
IStream & | StreamIn (IStream &Stream) |
OStream & | StreamOut (OStream &Stream) const |
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:
T | The type of object to store. |
F | A constant method of class T returning a const string&. This is used to supply the attribute to query on. |
typedef hash_type::const_iterator FrameCPP::Common::SearchContainer< T, F >::const_hash_iterator |
typedef Container< T >::const_iterator FrameCPP::Common::SearchContainer< T, F >::const_iterator |
typedef Container< T >::const_reverse_iterator FrameCPP::Common::SearchContainer< T, F >::const_reverse_iterator |
typedef Container< T >::const_value_type FrameCPP::Common::SearchContainer< T, F >::const_value_type |
|
inherited |
typedef hash_type::iterator FrameCPP::Common::SearchContainer< T, F >::hash_iterator |
typedef LDASTools::AL::unordered_multimap< std::string, value_type, LDASTools::AL::hash< std::string >, LDASTools::AL::CaseInsensitiveCmp > FrameCPP::Common::SearchContainer< T, F >::hash_type |
typedef Container< T >::iterator FrameCPP::Common::SearchContainer< T, F >::iterator |
typedef Container< T >::reverse_iterator FrameCPP::Common::SearchContainer< T, F >::reverse_iterator |
|
inherited |
typedef Container< T >::value_type FrameCPP::Common::SearchContainer< T, F >::value_type |
FrameCPP::Common::SearchContainer< T, F >::SearchContainer | ( | bool | AllowDuplicates = true | ) |
Default Constructor.
[in] | AllowDuplicates | True if duplicates are allowed in the set |
FrameCPP::Common::SearchContainer< T, F >::SearchContainer | ( | const SearchContainer< T, F > & | sc | ) |
Copy Constructor.
[in] | sc | Search container to be copied. |
|
virtual |
Destructor.
bool FrameCPP::Common::SearchContainer< T, F >::AllowDuplicates | ( | ) | const |
|
inline |
Append an item to the container.
[in] | data | An element to append. |
|
inline |
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.
[in] | index | which element to erase. |
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.
[in] | start | Sequence beginning. |
[in] | finish | Sequence end. |
|
inline |
Finds an element with the given name.
[in] | name | Name to search for. |
const_iterator FrameCPP::Common::SearchContainer< T, F >::find | ( | const std::string & | name, |
const_iterator | start | ||
) | const |
Finds an element with the given name.
[in] | name | Name to search for. |
[in] | start | Starting position. |
|
inline |
Finds an element with the given name.
[in] | name | Name to search for. |
iterator FrameCPP::Common::SearchContainer< T, F >::find | ( | const std::string & | name, |
iterator | start | ||
) |
Finds an element with the given name.
[in] | name | Name to search for. |
[in] | start | Where to begin search. |
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.
[in] | name | The name to search for. |
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.
[in] | name | The name to search for. |
|
inline |
Insert an item into the container.
[in] | pos | An iterator pointing to the location where the element should be added. |
[in] | data | The item to add. |
std::bad_alloc | Memory could not be allocated for the element. |
|
inline |
Insert an item into the container.
[in] | index | The 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] | data | The item to add. |
SearchContainer< T, F >& FrameCPP::Common::SearchContainer< T, F >::Merge | ( | const SearchContainer< T, F > & | RHS | ) |
|
inherited |
Inequality operator.
[in] | c | The container to compare with. |
This chacks to see if two containers do not contain identical elements.
const SearchContainer< T, F >& FrameCPP::Common::SearchContainer< T, F >::operator= | ( | const SearchContainer< T, F > & | sc | ) |
Assignment Operator.
[in] | sc | Search container to be assigned. |
|
inherited |
Equality operator.
[in] | c | The container to compare with. |
|
inline |
Finds an element with a name matching the given regex.
[in] | regex | Regular expression to search for. |
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.
[in] | regex | Regular expression to search for. |
[in] | start | Where to begin search. |
|
inline |
Finds an element with a name matching the given regex.
[in] | regex | Regular expression to search for. |
iterator FrameCPP::Common::SearchContainer< T, F >::regexFind | ( | const std::string & | regex, |
iterator | start | ||
) |
Finds an element with a name matching the given regex.
[in] | regex | Regular expression to search for. |
[in] | start | Where to begin search. |
void FrameCPP::Common::SearchContainer< T, F >::rehash | ( | ) | const |
Rehash search container.
|
inherited |
|
inherited |