Newer
Older
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
Martin Killenberg
committed
#pragma once
#include <ChimeraTK/TransferElement.h>
Martin Killenberg
committed
namespace ChimeraTK {
/** A Helper struct to store an accessor and a version number.
* Like this you can set the user buffer of the accessors and the version number which shall be used
* when the accessor is written, but delay the writing do a later point in time.
*/
Martin Killenberg
committed
struct RecoveryHelper {
enum class Direction { fromDevice, toDevice };
Martin Killenberg
committed
boost::shared_ptr<TransferElement> accessor;
VersionNumber versionNumber;
Martin Killenberg
committed
uint64_t writeOrder;
bool wasWritten{false};
cppext::future_queue<void> notificationQueue;
Direction recoveryDirection{Direction::toDevice};
Martin Killenberg
committed
explicit RecoveryHelper(boost::shared_ptr<TransferElement> a, VersionNumber v = VersionNumber(nullptr),
uint64_t order = 0, Direction direction = Direction::toDevice)
: accessor(std::move(a)), versionNumber(v), writeOrder(order), recoveryDirection(direction) {}
Martin Killenberg
committed
};
} // end of namespace ChimeraTK