Flow123d
3.9.0-49fc60d4d
|
Struct is a container that encapsulates variable size arrays. More...
#include <revertable_list.hh>
Public Member Functions | |
RevertableList (std::size_t reserved_size, std::size_t enlarged_by=0) | |
Constructor, create new instance with reserved size. More... | |
RevertableList (const RevertableList &other) | |
Copy constructor. More... | |
void | resize (std::size_t new_size) |
std::size_t | permanent_size () const |
Return permanent size of list. More... | |
std::size_t | temporary_size () const |
Return temporary size of list (full size of stored data). More... | |
std::size_t | reserved_size () const |
Return reserved (maximal) size. More... | |
std::size_t | push_back (const Type &t) |
template<class... Args> | |
std::size_t | emplace_back (Args &&... args) |
std::size_t | make_permanent () |
Finalize temporary part of data. More... | |
std::size_t | revert_temporary () |
Erase temporary part of data. More... | |
void | reset () |
Clear the list. More... | |
std::vector< Type >::iterator | begin () |
std::vector< Type >::iterator | end () |
const Type & | operator[] (std::size_t pos) const |
Return item on given position. More... | |
Private Attributes | |
std::vector< Type > | data_ |
Vector of items. More... | |
std::size_t | temporary_size_ |
Temporary size (full size of used data). More... | |
std::size_t | permanent_size_ |
Final size of data (part of finalize data). More... | |
std::size_t | enlardeg_by_ |
Allow to enlarge list dynamically during call push_back if reserved size is full. More... | |
Struct is a container that encapsulates variable size arrays.
Allows to:
This algorith allows to add blocks of data, evaluates external condition and possibly reverts unfinished block if condition is not met.
Reserved (maximal) size is set in constructor. This size can be enlarged manually through method resize or constructor accepts parameter enlarged_by. If this value is greater than 0 size of container is automatically enlarged during call push_back if container is full.
Definition at line 43 of file revertable_list.hh.
|
inline |
Constructor, create new instance with reserved size.
Definition at line 46 of file revertable_list.hh.
|
inline |
Copy constructor.
Definition at line 53 of file revertable_list.hh.
|
inline |
|
inline |
Create new item in list.
New item is created at the end of list and temporary size value is incremented. Method is equivalent with std::vector::emplace_back(). Method passes argumets of Type constructor.
Definition at line 114 of file revertable_list.hh.
|
inline |
|
inline |
Finalize temporary part of data.
Definition at line 126 of file revertable_list.hh.
|
inline |
Return item on given position.
Definition at line 159 of file revertable_list.hh.
|
inline |
Return permanent size of list.
Definition at line 71 of file revertable_list.hh.
|
inline |
Add new item of list.
New item is added to end of list and temporary size value is incremented. Method is equivalent with std::vector::push_back(). This method needs to create copy of passed Type and it's beter to use emplace_back method.
Definition at line 95 of file revertable_list.hh.
|
inline |
Return reserved (maximal) size.
Definition at line 83 of file revertable_list.hh.
|
inline |
Clear the list.
Definition at line 141 of file revertable_list.hh.
|
inline |
Resize to new reserved size.
New size must be higher than actual size!
Definition at line 64 of file revertable_list.hh.
|
inline |
Erase temporary part of data.
Definition at line 133 of file revertable_list.hh.
|
inline |
Return temporary size of list (full size of stored data).
Definition at line 77 of file revertable_list.hh.
|
private |
Vector of items.
Definition at line 165 of file revertable_list.hh.
|
private |
Allow to enlarge list dynamically during call push_back if reserved size is full.
Definition at line 168 of file revertable_list.hh.
|
private |
Final size of data (part of finalize data).
Definition at line 167 of file revertable_list.hh.
|
private |
Temporary size (full size of used data).
Definition at line 166 of file revertable_list.hh.