Search Toolkit Book for CStaticArraySearchBase
class CStaticArraySet<> is an array adaptor that provides an STLish interface to statically-defined arrays, while making efficient use of the inherent sort order of such arrays. More...
#include <util/static_set.hpp>
class CStaticArraySet<> is an array adaptor that provides an STLish interface to statically-defined arrays, while making efficient use of the inherent sort order of such arrays.
This class can be used both to verify sorted order of a static array and to access a static array cleanly. The template parameters are as follows:
KeyType – type of object used for access KeyCompare – comparison functor. This must provide an operator(). This is patterned to accept PCase and PNocase and similar objects.
To use this class, define your static array as follows:
static const char* sc_MyArray[] = { "val1", "val2", "val3" };
Then, declare a static variable such as:
typedef StaticArraySet<const char*, PNocase_CStr> TStaticArray; static TStaticArray sc_Array(sc_MyArray, sizeof(sc_MyArray));
In debug mode, the constructor will scan the list of items and insure that they are in the sort order defined by the comparator used. If the sort order is not correct, then the constructor will ASSERT().
This can then be accessed as
if (sc_Array.find(some_value) != sc_Array.end()) { ... }
or
size_t idx = sc_Array.index_of(some_value); if (idx != TStaticArray::eNpos) { ... }
Definition at line 560 of file static_set.hpp.
◆ const_iteratortemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 574 of file static_set.hpp.
◆ const_referencetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 573 of file static_set.hpp.
◆ difference_typetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 576 of file static_set.hpp.
◆ gettertemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 567 of file static_set.hpp.
◆ key_comparetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 571 of file static_set.hpp.
◆ key_typetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 569 of file static_set.hpp.
◆ mapped_typetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 570 of file static_set.hpp.
◆ size_typetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 575 of file static_set.hpp.
◆ TDeallocateFunctemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 806 of file static_set.hpp.
◆ value_comparetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 572 of file static_set.hpp.
◆ value_typetemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 568 of file static_set.hpp.
◆ anonymous enumtemplate<typename KeyValueGetter , typename KeyCompare >
◆ CStaticArraySearchBase() [1/4]template<typename KeyValueGetter , typename KeyCompare >
template<size_t Size>
Default constructor.
This will build a set around a given array; the storage of the end pointer is based on the supplied array size. In debug mode, this will verify that the array is sorted.
Definition at line 582 of file static_set.hpp.
◆ CStaticArraySearchBase() [2/4]template<typename KeyValueGetter , typename KeyCompare >
template<size_t Size>
Constructor to initialize comparator object.
Definition at line 591 of file static_set.hpp.
◆ CStaticArraySearchBase() [3/4]template<typename KeyValueGetter , typename KeyCompare >
template<typename Type >
Default constructor.
This will build a set around a given array; the storage of the end pointer is based on the supplied array size. In debug mode, this will verify that the array is sorted.
Definition at line 604 of file static_set.hpp.
◆ CStaticArraySearchBase() [4/4]template<typename KeyValueGetter , typename KeyCompare >
template<typename Type >
Constructor to initialize comparator object.
Definition at line 613 of file static_set.hpp.
◆ ~CStaticArraySearchBase()template<typename KeyValueGetter , typename KeyCompare >
◆ begin()template<typename KeyValueGetter , typename KeyCompare >
Return the start of the controlled sequence.
Definition at line 641 of file static_set.hpp.
Referenced by CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::empty(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::index_of(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::lower_bound(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::size(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::upper_bound(), and CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::x_DeallocateFunc().
◆ count()template<typename KeyValueGetter , typename KeyCompare >
Return the count of the elements in the sequence.
This will be either 0 or 1, as this structure holds unique keys.
Definition at line 688 of file static_set.hpp.
◆ empty()template<typename KeyValueGetter , typename KeyCompare >
Return true if the container is empty.
Definition at line 653 of file static_set.hpp.
◆ end()template<typename KeyValueGetter , typename KeyCompare >
Return the end of the controlled sequence.
Definition at line 647 of file static_set.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::empty(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::find(), CGb_qual::FixPseudogeneValue(), CGb_qual::FixRptTypeValue(), CClientPseudoTypeStrings::GenerateClassCode(), CSeqFeatData::IsRegulatory(), CBioSource::IsStopWord(), CCountries::IsValid(), CGb_qual::IsValidPseudogeneValue(), CGb_qual::IsValidRptTypeValue(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::lower_bound(), CSeq_gap::NameToGapTypeInfo(), CTableNames::NameToTable(), s_IsTaxNameElement(), s_MayIgnoreCase(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::size(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::upper_bound(), CImpFeatValidator::Validate(), CCountries::WasValid(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::x_Bad(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::x_DeallocateFunc(), and CCountries::x_FindCountryName().
◆ equal_range()template<typename KeyValueGetter , typename KeyCompare >
Return a pair of iterators bracketing the given element in the controlled sequence.
Definition at line 696 of file static_set.hpp.
◆ find()template<typename KeyValueGetter , typename KeyCompare >
Return a const_iterator pointing to the specified element, or to the end if the element is not found.
Definition at line 680 of file static_set.hpp.
Referenced by BOOST_AUTO_TEST_CASE(), CGb_qual::FixPseudogeneValue(), CGb_qual::FixRptTypeValue(), CClientPseudoTypeStrings::GenerateClassCode(), CSeqFeatData::IsRegulatory(), CBioSource::IsStopWord(), CCountries::IsValid(), CGb_qual::IsValidPseudogeneValue(), CGb_qual::IsValidRptTypeValue(), CSeq_gap::NameToGapTypeInfo(), CTableNames::NameToTable(), s_IsTaxNameElement(), s_MayIgnoreCase(), CImpFeatValidator::Validate(), CCountries::WasValid(), and CCountries::x_FindCountryName().
◆ index_of()template<typename KeyValueGetter , typename KeyCompare >
Return the index of the indicated element, or eNpos if the element is not found.
Definition at line 708 of file static_set.hpp.
◆ key_comp()template<typename KeyValueGetter , typename KeyCompare >
Definition at line 635 of file static_set.hpp.
◆ lower_bound()template<typename KeyValueGetter , typename KeyCompare >
Return an iterator into the sequence such that the iterator's key is less than or equal to the indicated key.
Definition at line 666 of file static_set.hpp.
Referenced by CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::count(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::equal_range(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::find(), and CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::index_of().
◆ size()template<typename KeyValueGetter , typename KeyCompare >
◆ upper_bound()template<typename KeyValueGetter , typename KeyCompare >
Return an iterator into the sequence such that the iterator's key is greater than the indicated key.
Definition at line 673 of file static_set.hpp.
◆ value_comp()template<typename KeyValueGetter , typename KeyCompare >
Definition at line 630 of file static_set.hpp.
Referenced by CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::key_comp(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::lower_bound(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::upper_bound(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::x_Bad(), and CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::x_Set().
◆ x_Bad()template<typename KeyValueGetter , typename KeyCompare >
Definition at line 814 of file static_set.hpp.
Referenced by CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::count(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::equal_range(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::find(), and CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::index_of().
◆ x_DeallocateFunc()template<typename KeyValueGetter , typename KeyCompare >
◆ x_Set() [1/2]template<typename KeyValueGetter , typename KeyCompare >
template<typename Type >
Assign array pointer and end pointer from differently typed array.
Allocate necessarily typed array and copy its content.
Definition at line 758 of file static_set.hpp.
◆ x_Set() [2/2]template<typename KeyValueGetter , typename KeyCompare >
◆ x_Validate()template<typename KeyValueGetter , typename KeyCompare >
◆ m_Begintemplate<typename KeyValueGetter , typename KeyCompare >
Definition at line 810 of file static_set.hpp.
Referenced by CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::begin(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::value_comp(), CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::x_Set(), and CStaticArraySearchBase< NStaticArray::PKeyValuePair< SStaticPair< KeyType, ValueType > >, less< KeyType > >::~CStaticArraySearchBase().
◆ m_DeallocateFunctemplate<typename KeyValueGetter , typename KeyCompare >
◆ m_Endtemplate<typename KeyValueGetter , typename KeyCompare >
The documentation for this class was generated from the following file:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4