25#ifndef __BITPIT_PIERCED_VECTOR_TPP__
26#define __BITPIT_PIERCED_VECTOR_TPP__
36template<
typename value_t,
typename id_t>
52template<
typename value_t,
typename id_t>
65template<
typename value_t,
typename id_t>
82template<
typename value_t,
typename id_t>
99template<
typename value_t,
typename id_t>
103 this->swap(temporary);
114template<
typename value_t,
typename id_t>
132template<
typename value_t,
typename id_t>
139 return reclaimValue(reclaimAction);
158template<
typename value_t,
typename id_t>
165 return reclaimValue(reclaimAction);
179template<
typename value_t,
typename id_t>
186 return reclaimValue(reclaimAction);
205template<
typename value_t,
typename id_t>
212 return reclaimValue(reclaimAction);
226template<
typename value_t,
typename id_t>
233 return moveValue(moveAction);
247template<
typename value_t,
typename id_t>
254 return moveValue(moveAction);
265template<
typename value_t,
typename id_t>
272 return insertValue(insertAction, value);
287template<
typename value_t,
typename id_t>
294 return insertValue(insertAction, value);
309template<
typename value_t,
typename id_t>
316 return insertValue(insertAction, value);
326template<
typename value_t,
typename id_t>
348template<
typename value_t,
typename id_t>
355 return insertValue(insertAction, value);
372template<
typename value_t,
typename id_t>
380 return emreclaimValue<Args...>(emplaceAction, std::forward<Args>(args)...);
400template<
typename value_t,
typename id_t>
408 return emreclaimValue(emplaceAction, std::forward<Args>(args)...);
424template<
typename value_t,
typename id_t>
432 emreclaimValue(emplaceAction, std::forward<Args>(args)...);
452template<
typename value_t,
typename id_t>
460 return emreclaimValue(emplaceAction, std::forward<Args>(args)...);
471template<
typename value_t,
typename id_t>
472template<
typename... Args>
479 return emplaceValue(emplaceAction, std::forward<Args>(args)...);
493template<
typename value_t,
typename id_t>
494template<
typename... Args>
501 return emplaceValue(emplaceAction, std::forward<Args>(args)...);
512template<
typename value_t,
typename id_t>
513template<
typename... Args>
520 emplaceValue(emplaceAction, std::forward<Args>(args)...);
536template<
typename value_t,
typename id_t>
537template<
typename... Args>
544 return emplaceValue(emplaceAction, std::forward<Args>(args)...);
556template<
typename value_t,
typename id_t>
557template<
typename... Args>
585template<
typename value_t,
typename id_t>
592 return eraseValue(eraseAction);
603template<
typename value_t,
typename id_t>
610 eraseValue(eraseAction);
619template<
typename value_t,
typename id_t>
626 swapValues(swapAction);
637template<
typename value_t,
typename id_t>
659template<
typename value_t,
typename id_t>
686template<
typename value_t,
typename id_t>
699template<
typename value_t,
typename id_t>
718template<
typename value_t,
typename id_t>
737template<
typename value_t,
typename id_t>
757template<
typename value_t,
typename id_t>
777template<
typename value_t,
typename id_t>
800template<
typename value_t,
typename id_t>
808 other.PiercedVectorStorage<value_t, id_t>::detachKernel();
825 }
catch (
const std::exception &exception) {
827 assert(
false &&
"Error while swapping the PiercedVector!");
828 std::cout <<
"Error while swapping the PiercedVector!" << std::endl;
838template<
typename value_t,
typename id_t>
849template<
typename value_t,
typename id_t>
858template<
typename value_t,
typename id_t>
869template<
typename value_t,
typename id_t>
873 restoreKernel(stream);
883template<
typename value_t,
typename id_t>
897template<
typename value_t,
typename id_t>
910template<
typename value_t,
typename id_t>
921template<
typename value_t,
typename id_t>
924 std::size_t pos = action.info[PiercedSyncAction::INFO_POS];
925 switch (
static_cast<typename FillAction::FillActionType
>(action.type)) {
927 case FillAction::TYPE_OVERWRITE:
933 case FillAction::TYPE_INSERT:
942 case FillAction::TYPE_APPEND:
970template<
typename value_t,
typename id_t>
973 std::size_t pos = action.info[PiercedSyncAction::INFO_POS];
974 switch (
static_cast<typename FillAction::FillActionType
>(action.type)) {
976 case FillAction::TYPE_OVERWRITE:
982 case FillAction::TYPE_INSERT:
991 case FillAction::TYPE_APPEND:
1023template<
typename value_t,
typename id_t>
1024template<
typename... Args,
typename PiercedStorage<value_t, id_t>::template EnableIfHasInitialize<Args...> * >
1027 std::size_t pos = action.info[PiercedSyncAction::INFO_POS];
1028 switch (
static_cast<typename FillAction::FillActionType
>(action.type)) {
1030 case FillAction::TYPE_OVERWRITE:
1036 case FillAction::TYPE_INSERT:
1045 case FillAction::TYPE_APPEND:
1074template<
typename value_t,
typename id_t>
1075template<
typename... Args>
1078 std::size_t pos = action.info[PiercedSyncAction::INFO_POS];
1079 switch (
static_cast<typename FillAction::FillActionType
>(action.type)) {
1081 case FillAction::TYPE_OVERWRITE:
1087 case FillAction::TYPE_INSERT:
1096 case FillAction::TYPE_APPEND:
1124template<
typename value_t,
typename id_t>
1127 std::size_t posNew = action.info[PiercedSyncAction::INFO_POS_FIRST];
1128 std::size_t posOld = action.info[PiercedSyncAction::INFO_POS_SECOND];
1129 switch (
static_cast<typename MoveAction::MoveActionType
>(action.type)) {
1131 case MoveAction::TYPE_OVERWRITE:
1137 case MoveAction::TYPE_INSERT:
1146 case MoveAction::TYPE_APPEND:
1179template<
typename value_t,
typename id_t>
1182 switch (
static_cast<typename EraseAction::EraseActionType
>(action.type)) {
1184 case EraseAction::TYPE_PIERCE:
1191 case EraseAction::TYPE_SHRINK:
1193 std::size_t rawSize = action.info[PiercedSyncAction::INFO_SIZE];
1207 std::size_t nextPos = action.info[PiercedSyncAction::INFO_POS_NEXT];
1217template<
typename value_t,
typename id_t>
1218void PiercedVector<value_t, id_t>::swapValues(
const SwapAction &action)
1220 switch (
static_cast<typename SwapAction::SwapActionType
>(action.type)) {
1222 case SwapAction::TYPE_SWAP:
1224 std::size_t posFirst = action.info[PiercedSyncAction::INFO_POS_FIRST];
1225 std::size_t posSecond = action.info[PiercedSyncAction::INFO_POS_SECOND];
ResizeAction resize(std::size_t n)
std::size_t getPos(id_t id) const
SortAction sortBefore(id_t referenceId, bool inclusive)
EraseAction erase(id_t id, bool flush=false)
FillAction fillAppend(id_t id)
MoveAction moveAfter(id_t referenceId, id_t id, bool flush=false)
ClearAction clear(bool release=true)
ReserveAction reserve(std::size_t n)
FillAction fillAfter(id_t referenceId, id_t id)
FillAction fillBefore(id_t referenceId, id_t id)
void swap(PiercedKernel &other) noexcept
FillAction fillHead(id_t id)
void restore(std::istream &stream)
SortAction sortAfter(id_t referenceId, bool inclusive)
ShrinkToFitAction shrinkToFit()
std::size_t getLastUsedPos() const
MoveAction moveBefore(id_t referenceId, id_t id, bool flush=false)
Iterator for the class PiercedStorage.
void swap(PiercedStorageSyncSlave< id_t > &other) noexcept
Metafunction for generating a pierced storage.
void restore(std::istream &stream)
void rawInitialize(std::size_t pos, Args &&... args)
void commitSyncAction(const PiercedSyncAction &action) override
void rawSwap(std::size_t pos_first, std::size_t pos_second)
static constexpr bool has_dump()
void rawPushBack(const value_t &value)
iterator rawFind(std::size_t pos) noexcept
void rawEmreplace(std::size_t pos, Args &&... args)
static constexpr bool has_restore()
void rawEmplaceBack(Args &&... args)
void dump(std::ostream &stream) const
void rawEmplace(std::size_t pos, Args &&... args)
void rawInsert(std::size_t pos, std::size_t n, const value_t &value)
void rawSet(std::size_t pos, const value_t &value)
void rawResize(std::size_t n, const value_t &value=value_t())
void unregisterSlave(const PiercedSyncSlave *slave) const
Kernel of the pierced vector.
Kernel of the pierced vector.
__PVS_REFERENCE__ rawAt(std::size_t pos)
void setDynamicKernel(const PiercedVectorKernel< id_t > *kernel, PiercedSyncMaster::SyncMode syncMode)
Metafunction for generating a pierced vector.
iterator emplaceBefore(const id_t &referenceId, id_t id, Args &&... args)
void restore(std::istream &stream)
iterator insert(id_t id, const value_t &value)
iterator insertBefore(const id_t &referenceId, id_t id, const value_t &value)
iterator emreclaimAfter(const id_t &referenceId, id_t id, Args &&... args)
iterator replace(id_t id, value_t &&value)
iterator emplace(id_t id, Args &&... args)
const PiercedVectorKernel< id_t > & getKernel() const
iterator emreclaimBefore(const id_t &referenceId, id_t id, Args &&... args)
const PiercedVectorStorage< value_t, id_t > & getStorage() const
iterator reclaimBefore(const id_t &referenceId, id_t id)
void clear(bool release=true)
iterator reclaim(id_t id)
iterator emreclaim(id_t id, Args &&... args)
void sortAfter(id_t referenceId, bool inclusive)
iterator pushBack(id_t id, const value_t &value)
iterator erase(id_t id, bool delayed=false)
void swap(id_t id_first, id_t id_second)
PiercedVector< value_t, id_t > & operator=(const PiercedVector< value_t, id_t > &other)
iterator emreplace(id_t id, Args &&... args)
void restoreKernel(std::istream &stream)
iterator reclaimBack(id_t id)
iterator moveAfter(const id_t &referenceId, id_t id, bool delayed=false)
iterator insertAfter(const id_t &referenceId, id_t id, const value_t &value)
void sortBefore(id_t referenceId, bool inclusive)
iterator reclaimAfter(const id_t &referenceId, id_t id)
PiercedVectorStorage< value_t, id_t >::iterator iterator
void emreclaimBack(id_t id, Args &&... args)
void emplaceBack(id_t id, Args &&... args)
void dumpKernel(std::ostream &stream) const
void reserve(std::size_t n)
void resize(std::size_t n)
iterator moveBefore(const id_t &referenceId, id_t id, bool delayed=false)
iterator emplaceAfter(const id_t &referenceId, id_t id, Args &&... args)
#define BITPIT_UNREACHABLE(str)
#define BITPIT_UNUSED(variable)