25#ifndef __BITPIT_PIERCED_SYNC_HPP__
26#define __BITPIT_PIERCED_SYNC_HPP__
30#include <unordered_map>
57 TYPE_OVERWRITE_MULTIPLE,
86 void importData(std::vector<std::size_t> &&values);
87 void importData(
const std::vector<std::size_t> &values);
90 void restore(std::istream &stream);
91 void dump(std::ostream &stream)
const;
95 std::array<std::size_t, INFO_COUNT> info;
96 std::unique_ptr<std::vector<std::size_t>> data;
140 SYNC_MODE_CONCURRENT,
143 SYNC_MODE_ITR_COUNT = SYNC_MODE_DISABLED + 1,
144 SYNC_MODE_ITR_BEGIN = 0,
145 SYNC_MODE_ITR_END = SYNC_MODE_ITR_BEGIN + SYNC_MODE_ITR_COUNT
154 template <
typename T>
155 std::size_t operator()(T t)
const
157 return static_cast<std::size_t
>(t);
164 mutable std::unordered_map<PiercedSyncSlave *, SyncMode>
m_slaves;
185 void restore(std::istream &stream);
186 void dump(std::ostream &stream)
const;
192 mutable std::unordered_map<SyncMode, SyncGroup, SyncModeHasher> m_syncGroups;
197 std::vector<PiercedSyncAction> m_syncJournal;
202 mutable bool m_syncEnabled;
Action for pierced synchronization.
PiercedSyncAction(ActionType _type=TYPE_UNDEFINED)
void restore(std::istream &stream)
void swap(PiercedSyncAction &other) noexcept
void importData(std::vector< std::size_t > &&values)
void dump(std::ostream &stream) const
PiercedSyncAction & operator=(const PiercedSyncAction &other)
Base class for defining an object that acts like a master in pierced synchronization.
bool isSyncEnabled() const
void restore(std::istream &stream)
PiercedSyncMaster::SyncMode getSlaveSyncMode(const PiercedSyncSlave *slave) const
void setSyncEnabled(bool enabled) const
std::vector< PiercedSyncSlave * > SyncGroup
void unregisterSlave(const PiercedSyncSlave *slave) const
void swap(PiercedSyncMaster &other) noexcept
bool isSlaveRegistered(const PiercedSyncSlave *slave) const
void registerSlave(PiercedSyncSlave *slave, PiercedSyncMaster::SyncMode syncMode) const
void processSyncAction(const PiercedSyncAction &action)
bool isSlaveSynced(const PiercedSyncSlave *slave) const
void dump(std::ostream &stream) const
std::unordered_map< PiercedSyncSlave *, SyncMode > m_slaves
Base class for defining an object that acts like a slave in pierced synchronization.
void swap(PiercedSyncSlave &other) noexcept