fix8
version 1.4.0
Open Source C++ FIX Framework
|
#include <f8types.hpp>
Public Types | |
using | iterator = T * |
using | const_iterator = const T * |
using | result = std::pair< iterator, bool > |
Public Member Functions | |
presorted_set (const_iterator arr_start, const size_t sz, const size_t reserve=FIX8_RESERVE_PERCENT) | |
presorted_set (const presorted_set &from) | |
presorted_set (const size_t sz=0, const size_t reserve=FIX8_RESERVE_PERCENT) | |
~presorted_set () | |
dtor More... | |
iterator | find (const T what, bool &answer) |
iterator | find (const K key, bool &answer) |
const_iterator | find (const K key) const |
const_iterator | find (const T what) const |
iterator | find (const K key) |
iterator | find (const T what) |
const_iterator | at (const size_t idx) const |
result | insert (const_iterator what) |
void | insert (const_iterator what_begin, const_iterator what_end) |
void | clear () |
size_t | size () const |
bool | empty () const |
size_t | rsize () const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
Static Public Member Functions | |
static size_t | distance (const_iterator what_begin, const_iterator what_end) |
Private Types | |
using | internal_result = std::pair< iterator, iterator > |
using | const_internal_result = std::pair< const_iterator, const_iterator > |
Static Private Member Functions | |
static size_t | calc_reserve (size_t sz, size_t res) |
Private Attributes | |
const size_t | _reserve |
size_t | _sz |
size_t | _rsz |
T * | _arr |
Presorted set designed for infrequent insertions but super fast initialisation from a sorted static array. Search complexity is O(logN), ctor complexity approaches O(1), insert is O(N).
K | the key |
T | the value type |
Comp | the comparitor |
Definition at line 186 of file f8types.hpp.
|
private |
Definition at line 199 of file f8types.hpp.
using FIX8::presorted_set< K, T, Comp >::const_iterator = const T* |
Definition at line 190 of file f8types.hpp.
|
private |
Definition at line 198 of file f8types.hpp.
using FIX8::presorted_set< K, T, Comp >::iterator = T* |
Definition at line 189 of file f8types.hpp.
using FIX8::presorted_set< K, T, Comp >::result = std::pair<iterator, bool> |
Definition at line 191 of file f8types.hpp.
|
inline |
ctor - initialise from static sorted set
arr_start | pointer to start of static array to copy elements from |
sz | number of elements in set to copy |
reserve | percentage of sz to keep in reserve |
Definition at line 218 of file f8types.hpp.
|
inline |
copy ctor
from | presorted_set object to copy |
Definition at line 224 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_arr.
|
inlineexplicit |
ctor - initialise an empty set; defer memory allocation;
sz | number of elements to initially allocate |
reserve | percentage of sz to keep in reserve |
Definition at line 231 of file f8types.hpp.
|
inline |
dtor
Definition at line 235 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_arr.
|
inline |
Get the element at index location
idx | of the pair to retrieve |
Definition at line 285 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::end().
|
inline |
Get a pointer to the first element
Definition at line 359 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_arr.
|
inline |
Get a const pointer to the first element
Definition at line 367 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_arr.
|
inlinestaticprivate |
Calculate the amount of space to reserve in set
sz | number of elements currently in set; if 0 retun reserve elements as size to reserve |
res | percentage of sz to keep in reserve |
Definition at line 205 of file f8types.hpp.
Referenced by FIX8::presorted_set< K, T, Comp >::insert(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert().
|
inline |
|
inlinestatic |
Find the distance between two iterators
what_begin | start iterator |
what_end | end iterator (must be >= to what_begin |
Definition at line 329 of file f8types.hpp.
|
inline |
|
inline |
Get a pointer to the last element + 1
Definition at line 363 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_sz.
Referenced by FIX8::presorted_set< K, T, Comp >::at(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::at(), FIX8::presorted_set< K, T, Comp >::find(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::find(), FIX8::presorted_set< K, T, Comp >::insert(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert().
|
inline |
Get a const pointer to the last element + 1
Definition at line 371 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_sz.
|
inline |
Find an element with the given value
what | element to find |
answer | true if element is found |
Definition at line 241 of file f8types.hpp.
Referenced by FIX8::presorted_set< K, T, Comp >::insert(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert().
|
inline |
Find an element with the given key
key | to find |
answer | true if element is found |
Definition at line 252 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::find().
Referenced by FIX8::presorted_set< K, T, Comp >::find().
|
inline |
Find an element with the given key (const version)
key | to find |
Definition at line 257 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::find().
Referenced by FIX8::presorted_set< K, T, Comp >::find().
|
inline |
Find an element with the given value (const version)
what | element to find |
Definition at line 262 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::end().
|
inline |
Find an element with the given key
key | to find |
Definition at line 271 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::find().
Referenced by FIX8::presorted_set< K, T, Comp >::find().
|
inline |
Find an element with the given value
what | value to find |
Definition at line 276 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::end().
|
inline |
Insert an element into the set
what | pointer to element to insert |
Definition at line 290 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_arr, FIX8::presorted_set< K, T, Comp >::_rsz, FIX8::presorted_set< K, T, Comp >::_sz, FIX8::presorted_set< K, T, Comp >::calc_reserve(), FIX8::presorted_set< K, T, Comp >::end(), and FIX8::presorted_set< K, T, Comp >::find().
Referenced by FIX8::presorted_set< K, T, Comp >::insert(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert().
|
inline |
Insert a range of elements into the set
what_begin | pointer to 1st element to insert |
what_end | pointer to nth element + 1 to insert |
Definition at line 335 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::insert().
|
inline |
Obtain the number of elements that can be inserted before reallocating
Definition at line 355 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_rsz.
|
inline |
Obtain the number of elements in the set
Definition at line 347 of file f8types.hpp.
References FIX8::presorted_set< K, T, Comp >::_sz.
|
private |
Definition at line 196 of file f8types.hpp.
Referenced by FIX8::presorted_set< K, T, Comp >::begin(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::begin(), FIX8::presorted_set< K, T, Comp >::insert(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert(), FIX8::presorted_set< K, T, Comp >::presorted_set(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::presorted_set(), FIX8::presorted_set< K, T, Comp >::~presorted_set(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::~presorted_set().
|
private |
Definition at line 194 of file f8types.hpp.
|
private |
Definition at line 195 of file f8types.hpp.
Referenced by FIX8::presorted_set< K, T, Comp >::insert(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert(), FIX8::presorted_set< K, T, Comp >::rsize(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::rsize().
|
private |
Definition at line 195 of file f8types.hpp.
Referenced by FIX8::presorted_set< K, T, Comp >::end(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::end(), FIX8::presorted_set< K, T, Comp >::insert(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::insert(), FIX8::presorted_set< K, T, Comp >::size(), and FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::size().