Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Friends | List of all members
bitpit::PiercedKernel< id_t > Class Template Reference

Metafunction for generating a pierced kernel. More...

#include <piercedKernel.hpp>

Inheritance diagram for bitpit::PiercedKernel< id_t >:
Inheritance graph
[legend]
Collaboration diagram for bitpit::PiercedKernel< id_t >:
Collaboration graph
[legend]

Classes

class  ClearAction
 
class  EraseAction
 
class  FillAction
 
class  MoveAction
 
struct  positionGreater
 
struct  positionLess
 
class  ReserveAction
 
class  ResizeAction
 
class  ShrinkToFitAction
 
class  SortAction
 
class  SqueezeAction
 
class  SwapAction
 

Public Types

typedef PiercedKernelIterator< id_t > const_iterator
 
typedef PiercedKernelRange< id_t > const_range
 
typedef id_t id_type
 
typedef std::vector< id_t >::const_iterator raw_const_iterator
 
enum  SyncMode
 
- Public Types inherited from bitpit::PiercedSyncMaster
typedef std::vector< PiercedSyncSlave * > SyncGroup
 
enum  SyncMode {
  SYNC_MODE_CONCURRENT , SYNC_MODE_JOURNALED , SYNC_MODE_DISABLED , SYNC_MODE_ITR_COUNT = SYNC_MODE_DISABLED + 1 ,
  SYNC_MODE_ITR_BEGIN = 0 , SYNC_MODE_ITR_END = SYNC_MODE_ITR_BEGIN + SYNC_MODE_ITR_COUNT
}
 

Public Member Functions

 PiercedKernel ()
 
 PiercedKernel (const PiercedKernel &other)=default
 
 PiercedKernel (PiercedKernel &&other)=default
 
 PiercedKernel (std::size_t n)
 
 ~PiercedKernel () override
 
std::size_t back () const
 
const_iterator begin () const noexcept
 
std::size_t capacity () const
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
void checkIntegrity () const
 
ClearAction clear (bool release=true)
 
bool contains (id_t id) const
 
bool contiguous () const
 
std::size_t count (id_t id) const
 
void dump () const
 
void dump (std::ostream &stream) const
 
bool empty () const
 
const_iterator end () const noexcept
 
EraseAction erase (id_t id, bool flush=false)
 
std::size_t evalFlatIndex (id_t id) const
 
FillAction fillAfter (id_t referenceId, id_t id)
 
FillAction fillAppend (id_t id)
 
FillAction fillBefore (id_t referenceId, id_t id)
 
FillAction fillHead (id_t id)
 
FillAction fillHole (std::size_t hole, id_t id)
 
FillAction fillInsert (std::size_t pos, id_t id)
 
FillAction fillTail (id_t id)
 
const_iterator find (const id_t &id) const noexcept
 
void flush ()
 
std::size_t front () const
 
std::vector< id_t > getIds (bool ordered=true) const
 
std::size_t getRawIndex (id_t id) const
 
id_t getSizeMarker (std::size_t targetSize, const id_t &fallback=-1)
 
bool isIteratorSlow ()
 
bool isSynced () const
 
std::size_t maxSize () const
 
MoveAction moveAfter (id_t referenceId, id_t id, bool flush=false)
 
MoveAction moveBefore (id_t referenceId, id_t id, bool flush=false)
 
EraseAction popBack ()
 
const_iterator rawFind (std::size_t pos) const noexcept
 
ReserveAction reserve (std::size_t n)
 
ResizeAction resize (std::size_t n)
 
void restore (std::istream &stream)
 
ShrinkToFitAction shrinkToFit ()
 
std::size_t size () const
 
SortAction sort ()
 
SortAction sortAfter (id_t referenceId, bool inclusive)
 
SortAction sortBefore (id_t referenceId, bool inclusive)
 
SqueezeAction squeeze ()
 
SwapAction swap (id_t id_first, id_t id_second)
 
void swap (PiercedKernel &other) noexcept
 
void sync ()
 
void updateId (const id_t &currentId, const id_t &updatedId)
 

Protected Types

typedef holes_container::const_iterator holes_const_iterator
 
typedef std::vector< std::size_t > holes_container
 
typedef holes_container::iterator holes_iterator
 

Protected Member Functions

ClearAction _clear (bool release=true)
 
ReserveAction _reserve (std::size_t n)
 
ResizeAction _resize (std::size_t n)
 
ShrinkToFitAction _shrinkToFit ()
 
SortAction _sort (std::size_t begin, std::size_t end)
 
SqueezeAction _squeeze ()
 
std::size_t findNextUsedPos (std::size_t pos) const
 
std::size_t findPrevUsedPos (std::size_t pos) const
 
std::size_t getFirstUsedPos () const
 
std::size_t getLastUsedPos () const
 
std::size_t getPos (id_t id) const
 
std::vector< PiercedStorageSyncSlave< id_t > * > getStorages ()
 
std::vector< const PiercedStorageSyncSlave< id_t > * > getStorages () const
 
bool isPosEmpty (std::size_t pos) const
 
std::size_t rawSize () const
 
- Protected Member Functions inherited from bitpit::PiercedSyncMaster
 PiercedSyncMaster ()
 
void dump (std::ostream &stream) const
 
PiercedSyncMaster::SyncMode getSlaveSyncMode (const PiercedSyncSlave *slave) const
 
bool isSlaveRegistered (const PiercedSyncSlave *slave) const
 
bool isSlaveSynced (const PiercedSyncSlave *slave) const
 
bool isSynced () const
 
bool isSyncEnabled () const
 
void processSyncAction (const PiercedSyncAction &action)
 
void registerSlave (PiercedSyncSlave *slave, PiercedSyncMaster::SyncMode syncMode) const
 
void restore (std::istream &stream)
 
void setSyncEnabled (bool enabled) const
 
void swap (PiercedSyncMaster &other) noexcept
 
void sync ()
 
void unregisterSlave (const PiercedSyncSlave *slave) const
 

Friends

template<typename PKI_id_t >
class PiercedKernelIterator
 
template<typename PKR_id_t >
class PiercedKernelRange
 
template<typename PS_value_t , typename PS_id_t >
class PiercedStorage
 
template<typename PSI_value_t , typename PSI_id_t , typename PSI_value_no_cv_t >
class PiercedStorageIterator
 
template<typename BPS_id_t >
class PiercedStorageSyncSlave
 

Additional Inherited Members

- Protected Attributes inherited from bitpit::PiercedSyncMaster
std::unordered_map< PiercedSyncSlave *, SyncModem_slaves
 

Detailed Description

template<typename id_t = long>
class bitpit::PiercedKernel< id_t >

Metafunction for generating a pierced kernel.

Usage: use PiercedKernel<id_t> to declare a pierced kernel.

Internally all the holes are stored in a single vector. The first part of this vector contains the "regular" holes, whereas the last part contains the "pending" holes. The space reserved to the pending holes is fixed. To track begin and end of pending/regular holes section, two couple of begin/end iterators are used.

     /------ Regular holes begin
     |
     |                     /------ Regular holes end
     |                     |
     v                     v
|-+-+R+R+R+R+R+R+R+R+R+R+R+-+-+-+-+-+P+P+P+P+P+P+P+-+-+-+-+-+-|
 <   REGULAR HOLES SECTION   >   <     MAX PENDING HOLES     >
                                     ^             ^
                                     |             |
           Pending holes begin ------/             |
                                                   |
                           Pending holes end ------/

At the beginning, the vector of the holes will have a size equal to the maximum number of pending holes. When an element is deleted, its position is marked as a pending hole and it is inserted at the end of the existing pending holes (or after the regular holes if there are no pending holes). When the maximum number of pending holes is reached, the hole's vector is flushed. First, pending holes are then converted to regular holes. The difference between pending and regular holes is that the position of a pending hole is just marked as empty, whereas the position of a regular hole contains the distance from the next non-epty element (to speed-up vector traversal). Once the positions associated to the pending holes are updated, pending holes are moved into the regular holes and all the holes are compacted at the beginning of the holes' vector. Finally, the vector is resized: the new size of the vector is the number of regular holes plus the maximum number of allowed pending holes.

When a new element needs to be inserted in the element, first a suitable position is searched in the pending holes, if no suitable positions is found, the search is extended to regular holes. If, among the holes, there is no suitable position, a new element is added in the container.

Template Parameters
id_tThe type of the ids to associate to the elements

Definition at line 106 of file piercedKernel.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename id_t = long>
typedef PiercedKernelIterator<id_t> bitpit::PiercedKernel< id_t >::const_iterator

Constant iterator

Definition at line 136 of file piercedKernel.hpp.

◆ const_range

template<typename id_t = long>
typedef PiercedKernelRange<id_t> bitpit::PiercedKernel< id_t >::const_range

Constant range

Definition at line 146 of file piercedKernel.hpp.

◆ holes_const_iterator

template<typename id_t = long>
typedef holes_container::const_iterator bitpit::PiercedKernel< id_t >::holes_const_iterator
protected

Holes const iterator

Definition at line 441 of file piercedKernel.hpp.

◆ holes_container

template<typename id_t = long>
typedef std::vector<std::size_t> bitpit::PiercedKernel< id_t >::holes_container
protected

Container used for storing holes

Definition at line 431 of file piercedKernel.hpp.

◆ holes_iterator

template<typename id_t = long>
typedef holes_container::iterator bitpit::PiercedKernel< id_t >::holes_iterator
protected

Holes iterator

Definition at line 436 of file piercedKernel.hpp.

◆ id_type

template<typename id_t = long>
typedef id_t bitpit::PiercedKernel< id_t >::id_type

Type of ids stored in the kernel

Definition at line 131 of file piercedKernel.hpp.

◆ raw_const_iterator

template<typename id_t = long>
typedef std::vector<id_t>::const_iterator bitpit::PiercedKernel< id_t >::raw_const_iterator

Raw iterator

Definition at line 141 of file piercedKernel.hpp.

Member Enumeration Documentation

◆ SyncMode

template<typename id_t = long>
enum bitpit::PiercedSyncMaster::SyncMode

Sync mode

Definition at line 139 of file piercedSync.hpp.

Constructor & Destructor Documentation

◆ PiercedKernel() [1/2]

template<typename id_t >
bitpit::PiercedKernel< id_t >::PiercedKernel ( )

Constructs an empty pierced kernel with no elements.

Definition at line 38 of file piercedKernel.tpp.

◆ PiercedKernel() [2/2]

template<typename id_t >
bitpit::PiercedKernel< id_t >::PiercedKernel ( std::size_t n)

Constructs a pierced kernel with a capacity at least enough to contain n elements.

Parameters
nthe minimum capacity requested for the kernel

Definition at line 51 of file piercedKernel.tpp.

◆ ~PiercedKernel()

template<typename id_t >
bitpit::PiercedKernel< id_t >::~PiercedKernel ( )
override

Destructor

Definition at line 63 of file piercedKernel.tpp.

Member Function Documentation

◆ _clear()

template<typename id_t >
PiercedKernel< id_t >::ClearAction bitpit::PiercedKernel< id_t >::_clear ( bool release = true)
protected

Removes all elements from the kernel.

The function will NOT process the sync action.

Parameters
releaseif set to true, the containers that hold holes data are requested to release all unneeded memory (it is a non-binding request)

Definition at line 114 of file piercedKernel.tpp.

◆ _reserve()

template<typename id_t >
PiercedKernel< id_t >::ReserveAction bitpit::PiercedKernel< id_t >::_reserve ( std::size_t n)
protected

Requests that the kernel capacity be at least enough to contain n elements.

If n is greater than the current kernel capacity, the function causes the kernel to reallocate its data structured increasing its capacity to n (or greater).

In all other cases, the function call does not cause a reallocation and the kernel capacity is not affected.

The function will NOT process the sync action.

Parameters
nthe minimum capacity requested for the kernel

Definition at line 178 of file piercedKernel.tpp.

◆ _resize()

template<typename id_t >
PiercedKernel< id_t >::ResizeAction bitpit::PiercedKernel< id_t >::_resize ( std::size_t n)
protected

Resizes the kernel so that it contains n elements.

If n is smaller than the current kernel size, the content is reduced to its first n elements, removing those beyond.

If n is greater than the current kernel size, space is reserved to allow the kernel to reach the requested size.

If n is also greater than the current kernel capacity, an automatic reallocation of the allocated kernel space takes place.

Notice that this function changes the actual content of the kernel by erasing elements from it.

The function will NOT process the sync action.

Parameters
nis the new kernel size, expressed in number of elements.

Definition at line 239 of file piercedKernel.tpp.

◆ _shrinkToFit()

template<typename id_t >
PiercedKernel< id_t >::ShrinkToFitAction bitpit::PiercedKernel< id_t >::_shrinkToFit ( )
protected

Requests the kernel to reduce its capacity to fit its size. This method will NOT compact the elements, leaving the existing holes unaltered.

The request is non-binding, and the function can leave the kernel with a capacity greater than its size.

This may cause a reallocation, but has no effect on the kernel size and cannot alter its elements not the holes.

The function will NOT process the sync action.

Definition at line 573 of file piercedKernel.tpp.

◆ _sort()

template<typename id_t >
PiercedKernel< id_t >::SortAction bitpit::PiercedKernel< id_t >::_sort ( std::size_t beginPos,
std::size_t endPos )
protected

Sorts the elements of the kernel in ascending id order.

The function will NOT process the sync action.

Parameters
beginPosis the first position that will be sorted
endPosis the position past the last element that will be sorted

Definition at line 368 of file piercedKernel.tpp.

◆ _squeeze()

template<typename id_t >
PiercedKernel< id_t >::SqueezeAction bitpit::PiercedKernel< id_t >::_squeeze ( )
protected

Requests the kernel to compact the elements and reduce its capacity to fit its size.

The request is non-binding, and the function can leave the kernel with a capacity greater than its size.

This may cause a reallocation, but has no effect on the kernel size and cannot alter its elements.

The function will NOT process the sync action.

Definition at line 466 of file piercedKernel.tpp.

◆ back()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::back ( ) const

Returns the position of the last element in the kernel. If the kernel is empty, an exception is thrown.

Returns
the position of the last element in the kernel.

Definition at line 2117 of file piercedKernel.tpp.

◆ begin()

template<typename id_t >
PiercedKernel< id_t >::const_iterator bitpit::PiercedKernel< id_t >::begin ( ) const
noexcept

Returns a constant iterator pointing to the first element in the vector.

Returns
A constant iterator pointing to the first element in the vector.

Definition at line 1106 of file piercedKernel.tpp.

◆ capacity()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::capacity ( ) const

Returns the size of the space currently allocated for the kernel, expressed in terms of elements.

Returns
The size of the currently allocated capacity in the kernel, measured in terms of the number elements it can hold.
Examples
patchkernel_example_00001.cpp.

Definition at line 850 of file piercedKernel.tpp.

◆ cbegin()

template<typename id_t >
PiercedKernel< id_t >::const_iterator bitpit::PiercedKernel< id_t >::cbegin ( ) const
noexcept

Returns an conts_iterator pointing to the first element in the vector.

Returns
A const_iterator pointing to the first element in the vector.

Definition at line 1130 of file piercedKernel.tpp.

◆ cend()

template<typename id_t >
PiercedKernel< id_t >::const_iterator bitpit::PiercedKernel< id_t >::cend ( ) const
noexcept

Returns an const_iterator referring to the past-the-end element in the vector.

Returns
A const_iterator referring to the past-the-end element in the vector.

Definition at line 1142 of file piercedKernel.tpp.

◆ checkIntegrity()

template<typename id_t >
void bitpit::PiercedKernel< id_t >::checkIntegrity ( ) const

Check the integrity of the kernel.

Definition at line 684 of file piercedKernel.tpp.

◆ clear()

template<typename id_t >
PiercedKernel< id_t >::ClearAction bitpit::PiercedKernel< id_t >::clear ( bool release = true)

Removes all elements from the kernel.

Parameters
releaseif set to true, the containers that hold kernel data are requested to release all unneeded memory (it is a non-binding request)

Definition at line 94 of file piercedKernel.tpp.

◆ contains()

template<typename id_t >
bool bitpit::PiercedKernel< id_t >::contains ( id_t id) const

Checks if the kernel contains the specified id.

Parameters
idis the id to look for
Returns
Returns true if the kernel contains the specified id, otherwise it returns false.

Definition at line 863 of file piercedKernel.tpp.

◆ contiguous()

template<typename id_t >
bool bitpit::PiercedKernel< id_t >::contiguous ( ) const

Returns whether the kernel is contiguous (i.e. whether it contains no holes).

Returns
true if the kernel is contiguous, false otherwise.

Definition at line 766 of file piercedKernel.tpp.

◆ count()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::count ( id_t id) const

Searches the container for elements with the specified id and returns the number of matches.

Because all ids in a pierced kernel are unique, the function can only return 1 (if the element is found) or zero (otherwise).

Parameters
idis the id to look for
Returns
Returns 1 if the pierced kernel contains an element wit the specified id, or zero otherwise.

Definition at line 880 of file piercedKernel.tpp.

◆ dump() [1/2]

template<typename id_t >
void bitpit::PiercedKernel< id_t >::dump ( ) const

Dumps to screen the internal data.

Definition at line 629 of file piercedKernel.tpp.

◆ dump() [2/2]

template<typename id_t >
void bitpit::PiercedKernel< id_t >::dump ( std::ostream & stream) const

Dump the vector.

Parameters
streamis the stream data should be written to

Definition at line 2481 of file piercedKernel.tpp.

◆ empty()

template<typename id_t >
bool bitpit::PiercedKernel< id_t >::empty ( ) const

Returns whether the kernel is empty (i.e. whether its size is 0).

Returns
true if the kernel size is 0, false otherwise.
Examples
patchkernel_example_00001.cpp.

Definition at line 777 of file piercedKernel.tpp.

◆ end()

template<typename id_t >
PiercedKernel< id_t >::const_iterator bitpit::PiercedKernel< id_t >::end ( ) const
noexcept

Returns a constant iterator referring to the past-the-end element in the vector.

Returns
A constant iterator referring to the past-the-end element in the vector.

Definition at line 1119 of file piercedKernel.tpp.

◆ erase()

template<typename id_t >
PiercedKernel< id_t >::EraseAction bitpit::PiercedKernel< id_t >::erase ( id_t id,
bool flush = false )

Removes from the kernel the element with the specified id. If the id does not exists the function throws an exception.

The position of the element is marked as empty, this tells the kernel that the position is no longer in use.

Parameters
idis the id of the element to erase
flushcontrols if the holes will be flush after updating the kernel
Returns
The synchronization action associated with the erase.

Definition at line 1717 of file piercedKernel.tpp.

◆ evalFlatIndex()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::evalFlatIndex ( id_t id) const

Gets the flat index of the element with the specified id.

A flat id is the id associated to a numbering scheme that starts from the element in the first position of the kernel and is incremented by one for each element in the kernel. The first element will have a flat id equal to 0, the last element will have a flat id equal to (nElements - 1).

If there is no element with the specified id, an exception is thrown.

Parameters
idis the id of the element for witch the flat id is requested
Returns
The flat index of the element with the specified id.

Definition at line 912 of file piercedKernel.tpp.

◆ fillAfter()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillAfter ( id_t referenceId,
id_t id )

Fills a position and assigns to it the specified id.

The position filled will be after the specified reference position.

Parameters
referenceIdis the id of the element before which the new available position will be searched for
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1273 of file piercedKernel.tpp.

◆ fillAppend()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillAppend ( id_t id)

Fills a position and assigns to it the specified id.

A new position is created at the end of the kernel.

Parameters
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1367 of file piercedKernel.tpp.

◆ fillBefore()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillBefore ( id_t referenceId,
id_t id )

Fills a position and assigns to it the specified id.

The position filled will be before the specified reference position.

Parameters
referenceIdis the id of the element before which the new available position will be searched for
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1321 of file piercedKernel.tpp.

◆ fillHead()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillHead ( id_t id)

Fills a position and assigns to it the specified id.

The position filled will be the first position available.

Parameters
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1205 of file piercedKernel.tpp.

◆ fillHole()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillHole ( std::size_t hole,
id_t id )

Fills the specified hole with the given id.

Parameters
holeis the position of the hole to fill
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1398 of file piercedKernel.tpp.

◆ fillInsert()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillInsert ( std::size_t pos,
id_t id )

Fills a position and assigns to it the specified id.

A new postion is created at the specified position.

Parameters
posis the position at which the id will be inserted
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1485 of file piercedKernel.tpp.

◆ fillTail()

template<typename id_t >
PiercedKernel< id_t >::FillAction bitpit::PiercedKernel< id_t >::fillTail ( id_t id)

Fills a position and assigns to it the specified id.

The position filled will be the first position available.

Parameters
idis the id that will be associated to the position
Returns
The synchronization action associated with the fill.

Definition at line 1238 of file piercedKernel.tpp.

◆ find()

template<typename id_t >
PiercedKernel< id_t >::const_iterator bitpit::PiercedKernel< id_t >::find ( const id_t & id) const
noexcept

Gets a constant iterator pointing to the specified element.

Parameters
idis the id
Returns
A constant iterator pointing to the specified element.

Definition at line 1078 of file piercedKernel.tpp.

◆ findNextUsedPos()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::findNextUsedPos ( std::size_t pos) const
protected

Returns the first non-empty position after the specified starting position.

If the starting position is the last posistion, an exception is thrown.

Parameters
posstarting position
Returns
The firt non-empty position after the starting position.

Definition at line 2221 of file piercedKernel.tpp.

◆ findPrevUsedPos()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::findPrevUsedPos ( std::size_t pos) const
protected

Returns the first non-empty position before the specified starting position.

If the starting position is the first posistion, an exception is thrown.

Parameters
posstarting position
Returns
The firt non-empty position before the starting position.

Definition at line 2196 of file piercedKernel.tpp.

◆ flush()

template<typename id_t >
void bitpit::PiercedKernel< id_t >::flush ( )

Flush all pending changes.

Definition at line 619 of file piercedKernel.tpp.

◆ front()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::front ( ) const

Returns the position of the first element in the kernel. If the kernel is empty, an exception is thrown.

Returns
the position of the first element in the kernel.

Definition at line 2133 of file piercedKernel.tpp.

◆ getFirstUsedPos()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::getFirstUsedPos ( ) const
protected

Gets the position of the first element in the container.

If there is no element with the specified id, an exception is thrown.

Returns
The position of the first element in the container.

Definition at line 1169 of file piercedKernel.tpp.

◆ getIds()

template<typename id_t >
std::vector< id_t > bitpit::PiercedKernel< id_t >::getIds ( bool ordered = true) const

Gets a vector containing the ids of the elements stored in the kernel.

Parameters
orderedif is true the ids will be sorted in ascending order, otherwise the ids will be in random order
Returns
A vector with the id of the elements in stored in the kernel.

Definition at line 961 of file piercedKernel.tpp.

◆ getLastUsedPos()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::getLastUsedPos ( ) const
protected

Gets the position of the last element in the container.

If there is no element with the specified id, an exception is thrown.

Returns
The position of the last element in the container.

Definition at line 1186 of file piercedKernel.tpp.

◆ getPos()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::getPos ( id_t id) const
protected

Gets the position of the element with the specified id.

If there is no element with the specified id, an exception is thrown.

Parameters
idis the id of the element for witch the raw id is requested
Returns
The position of the element with the specified id.

Definition at line 1156 of file piercedKernel.tpp.

◆ getRawIndex()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::getRawIndex ( id_t id) const

Gets the raw index associated to the element with the specified id.

Returns
The raw index associated to the element with the specified id.

Definition at line 891 of file piercedKernel.tpp.

◆ getSizeMarker()

template<typename id_t >
id_t bitpit::PiercedKernel< id_t >::getSizeMarker ( std::size_t targetSize,
const id_t & fallback = -1 )

Returns the id of the elmement before which there is the requested number of other elements. If this element does not exist the fallback value will be returned.

Parameters
targetSizeis the number of elements that needs to be contained before the marker
fallbackis the fallback value to be returned if the marker cannot be found
Returns
The id of the elmement before which there is the requested number of other elements. If this element does not exist the fallback value will be returned.
Examples
patchkernel_example_00001.cpp.

Definition at line 1009 of file piercedKernel.tpp.

◆ getStorages() [1/2]

template<typename id_t >
std::vector< PiercedStorageSyncSlave< id_t > * > bitpit::PiercedKernel< id_t >::getStorages ( )
protected

Get the storages assocaited with the kernel.

Returns
The storages assocaited with the kernel.

Definition at line 2148 of file piercedKernel.tpp.

◆ getStorages() [2/2]

template<typename id_t >
std::vector< const PiercedStorageSyncSlave< id_t > * > bitpit::PiercedKernel< id_t >::getStorages ( ) const
protected

Get the storages assocaited with the kernel.

Returns
The storages assocaited with the kernel.

Definition at line 2170 of file piercedKernel.tpp.

◆ isIteratorSlow()

template<typename id_t >
bool bitpit::PiercedKernel< id_t >::isIteratorSlow ( )

Checks if the kernel is in a state that can slow down the iterator.

If there are dirty positions in the kernel, the ids associated to those positions will not point directly to a non-empty element. This means that the iterator will require a loop to reach the next non-empty position and this can slow down the loop. Calling the 'flush' function allow to recover the best performances.

Returns
Return true if the kernel is in a state that can slow down the iterator, false otherwise.

Definition at line 795 of file piercedKernel.tpp.

◆ isPosEmpty()

template<typename id_t >
bool bitpit::PiercedKernel< id_t >::isPosEmpty ( std::size_t pos) const
protected

Returns if the specified position is empty.

A position is considered empty if the element in that position has an id less than 0.

Parameters
posthe position to check
Returns
true is the position is empty, false otherwise.

Definition at line 2250 of file piercedKernel.tpp.

◆ isSynced()

template<typename id_t = long>
bool bitpit::PiercedSyncMaster::isSynced ( ) const

Check if all the slaves are synced.

Returns
Returns true if all slave are synchronized, false otherwise.

Definition at line 178 of file piercedSync.cpp.

◆ maxSize()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::maxSize ( ) const

Returns the maximum number of elements that the kernel can hold.

This is the maximum potential size the kernel can reach due to known system or library implementation limitations, but the kernel is by no means guaranteed to be able to reach that size: it can still fail to allocate space at any point before that size is reached.

Definition at line 809 of file piercedKernel.tpp.

◆ moveAfter()

template<typename id_t >
PiercedKernel< id_t >::MoveAction bitpit::PiercedKernel< id_t >::moveAfter ( id_t referenceId,
id_t id,
bool flush = false )

Move the specified id after the element with the reference id.

Parameters
referenceIdis the id of the element after which the specified id will be moved
idis the id that will be moved
flushcontrols if the holes will be flush after updating the kernel
Returns
The synchronization action associated with the move.

Definition at line 1560 of file piercedKernel.tpp.

◆ moveBefore()

template<typename id_t >
PiercedKernel< id_t >::MoveAction bitpit::PiercedKernel< id_t >::moveBefore ( id_t referenceId,
id_t id,
bool flush = false )

Move the specified id before the element with the reference id.

Parameters
referenceIdis the id of the element after which the specified id will be moved
idis the id that will be moved
flushcontrols if the holes will be flush after updating the kernel
Returns
The synchronization action associated with the move.

Definition at line 1624 of file piercedKernel.tpp.

◆ popBack()

template<typename id_t >
PiercedKernel< id_t >::EraseAction bitpit::PiercedKernel< id_t >::popBack ( )

Removes the last element in the vector, effectively reducing the container size by one.

Element is not deleted from the internal vector, instead its id is changed to mark the position as empty and allow the container to reuse that position.

Definition at line 1751 of file piercedKernel.tpp.

◆ rawFind()

template<typename id_t >
PiercedKernel< id_t >::const_iterator bitpit::PiercedKernel< id_t >::rawFind ( std::size_t pos) const
noexcept

Gets a constant iterator pointing to the specified position.

Parameters
posis the position
Returns
A constant iterator pointing to the specified position.

Definition at line 1095 of file piercedKernel.tpp.

◆ rawSize()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::rawSize ( ) const
protected

Returns the number of raw positions in the kernel.

This is the number of raw positions in the kernel, which is not necessarily equal the number of actual objects held in the kernel nor to its capacity.

Returns
The number of raw positions in the kernel.

Definition at line 837 of file piercedKernel.tpp.

◆ reserve()

template<typename id_t >
PiercedKernel< id_t >::ReserveAction bitpit::PiercedKernel< id_t >::reserve ( std::size_t n)

Requests that the kernel capacity be at least enough to contain n elements.

If n is greater than the current kernel capacity, the function causes the kernel to reallocate its data structured increasing its capacity to n (or greater).

In all other cases, the function call does not cause a reallocation and the kernel capacity is not affected.

Parameters
nthe minimum capacity requested for the kernel

Definition at line 153 of file piercedKernel.tpp.

◆ resize()

template<typename id_t >
PiercedKernel< id_t >::ResizeAction bitpit::PiercedKernel< id_t >::resize ( std::size_t n)

Resizes the kernel so that it contains n elements.

If n is smaller than the current kernel size, the content is reduced to its first n elements, removing those beyond.

If n is greater than the current kernel size, space is reserved to allow the kernel to reach the requested size.

If n is also greater than the current kernel capacity, an automatic reallocation of the allocated kernel space takes place.

Notice that this function changes the actual content of the kernel by erasing elements from it.

Parameters
nis the new kernel size, expressed in number of elements.

Definition at line 209 of file piercedKernel.tpp.

◆ restore()

template<typename id_t >
void bitpit::PiercedKernel< id_t >::restore ( std::istream & stream)

Restore the vector.

Parameters
streamis the stream data should be read from

Definition at line 2422 of file piercedKernel.tpp.

◆ shrinkToFit()

template<typename id_t >
PiercedKernel< id_t >::ShrinkToFitAction bitpit::PiercedKernel< id_t >::shrinkToFit ( )

Requests the kernel to reduce its capacity to fit its size. This method will NOT compact the elements, leaving the existing holes unaltered.

The request is non-binding, and the function can leave the kernel with a capacity greater than its size.

This may cause a reallocation, but has no effect on the kernel size and cannot alter its elements not the holes.

Definition at line 550 of file piercedKernel.tpp.

◆ size()

template<typename id_t >
std::size_t bitpit::PiercedKernel< id_t >::size ( ) const

Returns the number of elements in the kernel.

This is the number of actual objects held in the kernel, which is not necessarily equal to its capacity.

Returns
The number of elements in the kernel.
Examples
patchkernel_example_00001.cpp.

Definition at line 823 of file piercedKernel.tpp.

◆ sort()

template<typename id_t >
PiercedKernel< id_t >::SortAction bitpit::PiercedKernel< id_t >::sort ( )

Sorts the elements of the kernel in ascending id order.

Definition at line 295 of file piercedKernel.tpp.

◆ sortAfter()

template<typename id_t >
PiercedKernel< id_t >::SortAction bitpit::PiercedKernel< id_t >::sortAfter ( id_t referenceId,
bool inclusive )

Sorts the kernel after the element with the reference id in ascending id order.

Parameters
referenceIdis the id of the element after which the kernel will be sorted
inclusiveif true the reference element will be sorted, otherwise the sorting will stop at the element following the reference

Definition at line 315 of file piercedKernel.tpp.

◆ sortBefore()

template<typename id_t >
PiercedKernel< id_t >::SortAction bitpit::PiercedKernel< id_t >::sortBefore ( id_t referenceId,
bool inclusive )

Sorts the kernel before the element with the reference id in ascending id order.

Parameters
referenceIdis the id of the element before which the kernel will be sorted
inclusiveif true the reference element will be sorted, otherwise the sorting will stop at the element preceding the reference

Definition at line 342 of file piercedKernel.tpp.

◆ squeeze()

template<typename id_t >
PiercedKernel< id_t >::SqueezeAction bitpit::PiercedKernel< id_t >::squeeze ( )

Requests the kernel to compact the elements and reduce its capacity to fit its size.

The request is non-binding, and the function can leave the kernel with a capacity greater than its size.

This may cause a reallocation, but has no effect on the kernel size and cannot alter its elements.

Definition at line 443 of file piercedKernel.tpp.

◆ swap() [1/2]

template<typename id_t >
PiercedKernel< id_t >::SwapAction bitpit::PiercedKernel< id_t >::swap ( id_t id_first,
id_t id_second )

Swap the elements with the specified id.

Parameters
id_firstis the id of the first element to be swapped
id_secondis the id of the second element to be swapped

Definition at line 1686 of file piercedKernel.tpp.

◆ swap() [2/2]

template<typename id_t >
void bitpit::PiercedKernel< id_t >::swap ( PiercedKernel< id_t > & other)
noexcept

Exchanges the content of the kernel by the content of x, which is another kernel object of the same type. Sizes may differ.

After the call to this member function, the elements in this kernel are those which were in x before the call, and the elements of x are those which were in this. All iterators, references and pointers remain valid for the swapped objects.

Parameters
otheris another kernel of the same type (i.e., instantiated with the same template parameters) whose content is swapped with that of this kernel.

Definition at line 597 of file piercedKernel.tpp.

◆ sync()

template<typename id_t = long>
void bitpit::PiercedSyncMaster::sync ( )

Syncronize all the registered slaves.

Definition at line 177 of file piercedSync.cpp.

◆ updateId()

template<typename id_t >
void bitpit::PiercedKernel< id_t >::updateId ( const id_t & currentId,
const id_t & updatedId )

Updates the id of the specified element.

Parameters
currentIdis the current id of the element
updatedIdis the new id of the element

Definition at line 77 of file piercedKernel.tpp.

Friends And Related Symbol Documentation

◆ PiercedKernelIterator

template<typename id_t = long>
template<typename PKI_id_t >
friend class PiercedKernelIterator
friend

Definition at line 116 of file piercedKernel.hpp.

◆ PiercedKernelRange

template<typename id_t = long>
template<typename PKR_id_t >
friend class PiercedKernelRange
friend

Definition at line 119 of file piercedKernel.hpp.

◆ PiercedStorage

template<typename id_t = long>
template<typename PS_value_t , typename PS_id_t >
friend class PiercedStorage
friend

Definition at line 125 of file piercedKernel.hpp.

◆ PiercedStorageIterator

template<typename id_t = long>
template<typename PSI_value_t , typename PSI_id_t , typename PSI_value_no_cv_t >
friend class PiercedStorageIterator
friend

Definition at line 113 of file piercedKernel.hpp.

◆ PiercedStorageSyncSlave

template<typename id_t = long>
template<typename BPS_id_t >
friend class PiercedStorageSyncSlave
friend

Definition at line 122 of file piercedKernel.hpp.


The documentation for this class was generated from the following files:
--- layout: doxygen_footer ---