24template <
typename TBase>
25class SequenceSizeForcing :
public TBase
27 using BaseImpl = TBase;
29 using ValueType =
typename BaseImpl::ValueType;
30 using ElementType =
typename BaseImpl::ElementType;
32 SequenceSizeForcing() =
default;
34 explicit SequenceSizeForcing(
const ValueType& val)
39 explicit SequenceSizeForcing(ValueType&& val)
40 : BaseImpl(
std::move(val))
44 SequenceSizeForcing(
const SequenceSizeForcing&) =
default;
45 SequenceSizeForcing(SequenceSizeForcing&&) =
default;
46 SequenceSizeForcing& operator=(
const SequenceSizeForcing&) =
default;
47 SequenceSizeForcing& operator=(SequenceSizeForcing&&) =
default;
49 void forceReadElemCount(std::size_t val)
55 void clearReadElemCount()
60 template <
typename TIter>
63 if (forced_ == Cleared) {
64 return BaseImpl::read(iter, len);
67 return BaseImpl::readN(forced_, iter, len);
70 template <
typename TIter>
71 ErrorStatus readN(std::size_t count, TIter& iter, std::size_t& len) =
delete;
74 template <
typename TIter>
75 void readNoStatus(TIter& iter)
77 if (forced_ == Cleared) {
78 BaseImpl::readNoStatus(iter);
82 BaseImpl::readNoStatusN(forced_, iter);
85 template <
typename TIter>
86 void readNoStatusN(std::size_t count, TIter& iter) =
delete;
90 static const std::size_t Cleared = std::numeric_limits<std::size_t>::max();
91 std::size_t forced_ = Cleared;
This file contains classes required for generic custom assertion functionality.
#define COMMS_ASSERT(expr)
Generic assert macro.
Definition Assert.h:170
This file contain definition of error statuses used by comms module.
Main namespace for all classes / functions of COMMS library.
ErrorStatus
Error statuses reported by the Communication module.
Definition ErrorStatus.h:17