20#include <fmt/format.h>
22#include <boost/container/vector.hpp>
23#include <boost/core/demangle.hpp>
28#include <unordered_set>
62 std::pair<RepositoryIf::PathList, RepositoryIf::PathList>&
result;
76 std::optional<std::reference_wrapper<RepositoryIf::MetaData>>
metadata;
138 for (
auto dimention : shape) {
139 nelements *= dimention;
147 fmt::format(
"DataPointPath is not absolute: '{}'.", path));
177 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
178 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
179 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
180 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
181 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
182 std::is_same_v<ElementType, RtcDouble>,
183 "The scalar type is not supported.");
219 if (shape.size() == 0) {
241 std::shared_ptr<TempBufferType>& temp_buffer,
243 size_t count) =
delete;
259 const std::shared_ptr<TempBufferType>& temp_buffer,
261 size_t count) =
delete;
267 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
273 return {buffer.size()};
285 if (shape.size() == 1) {
286 buffer.resize(shape[0]);
297 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
303 return {buffer.size()};
312 return {buffer.data(), buffer.size()};
316 if (shape.size() == 1 and shape[0] == buffer.size()) {
325template <
typename T,
typename A>
328 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
335 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
336 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
337 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
338 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
339 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
340 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
341 std::is_same_v<ElementType, std::byte>,
342 "The vector type is not supported.");
343 return {buffer.size()};
355 if (shape.size() == 1) {
356 buffer.resize(shape[0]);
367 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
373 return {buffer.size()};
387 if (shape.size() == 1) {
388 buffer.resize(shape[0]);
396 std::shared_ptr<TempBufferType>& temp_buffer,
399 assert((buffer.size() >= offset + count) && (
"The input buffer is too small."));
400 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
401 std::copy(buffer.begin() + offset, buffer.begin() + offset + count, temp_buffer->begin());
405 const std::shared_ptr<TempBufferType>& temp_buffer,
408 assert((buffer.size() >= offset + count) && (
"The output buffer is too small."));
409 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
410 std::copy(temp_buffer->begin(), temp_buffer->begin() + count, buffer.begin() + offset);
414template <
typename T,
typename A>
417 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
424 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
425 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
426 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
427 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
428 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
429 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
430 std::is_same_v<ElementType, std::byte>,
431 "The vector type is not supported.");
432 return {buffer.size()};
444 if (shape.size() == 1) {
445 buffer.resize(shape[0]);
453template <
typename T, decltype(gsl::dynamic_extent) N>
456 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
463 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
464 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
465 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
466 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
467 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
468 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
469 std::is_same_v<ElementType, std::byte>,
470 "The vector type is not supported.");
471 return {buffer.size()};
483 if (shape.size() == 1 and shape[0] == buffer.size()) {
492template <decltype(gsl::dynamic_extent) N>
495 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
501 return {buffer.size()};
517template <decltype(gsl::dynamic_extent) N>
520 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
526 return {buffer.size()};
542template <
typename T,
typename A>
545 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
552 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
553 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
554 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
555 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
556 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
557 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
558 "The matrix type is not supported.");
571 if (shape.size() == 2) {
572 buffer.
resize(shape[0], shape[1]);
583 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
603 if (shape.size() == 2) {
604 buffer.
resize(shape[0], shape[1]);
612 std::shared_ptr<TempBufferType>& temp_buffer,
615 assert((buffer.size() >= offset + count) && (
"The input buffer is too small."));
616 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
617 std::copy(buffer.begin() + offset, buffer.begin() + offset + count, temp_buffer->begin());
621 const std::shared_ptr<TempBufferType>& temp_buffer,
624 assert((buffer.size() >= offset + count) && (
"The output buffer is too small."));
625 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
626 std::copy(temp_buffer->begin(), temp_buffer->begin() + count, buffer.begin() + offset);
633 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
640 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
641 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
642 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
643 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
644 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
645 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
646 "The matrix type is not supported.");
659 if (shape.size() == 2 and shape[0] == buffer.
GetNrows() and shape[1] == buffer.
GetNcols()) {
668template <
typename T, std::
size_t N>
671 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
678 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
679 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
680 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
681 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
682 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
683 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
684 std::is_same_v<ElementType, std::byte>,
685 "The array type is not supported.");
686 return {buffer.size()};
698 if (shape.size() == 1 and shape[0] == buffer.size()) {
707template <std::
size_t N>
710 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
716 return {buffer.size()};
728 if (shape.size() == 1 and shape[0] == buffer.size()) {
737template <
typename T, std::
size_t N, std::
size_t M>
747 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
748 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
749 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
750 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
751 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
752 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
753 "The array type is not supported.");
760 return {begin, N * M};
766 return {begin, N * M};
770 if (shape.size() == 2 and shape[0] == N and shape[1] == M) {
785template <
typename T, std::
size_t N>
795 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
796 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
797 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
798 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
799 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
800 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
801 std::is_same_v<ElementType, std::byte>,
802 "The array type is not supported.");
815 if (shape.size() == 1 and shape[0] == N) {
824template <std::
size_t N>
845 if (shape.size() == 1 and shape[0] == N) {
857template <
typename T, std::
size_t N, std::
size_t M>
867 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
868 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
869 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
870 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
871 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
872 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
873 "The array type is not supported.");
879 return {&buffer[0][0], N * M};
884 return {&buffer[0][0], N * M};
888 if (shape.size() == 2 and shape[0] == N and shape[1] == M) {
909inline bool TypeIsAllowedForValue(
const std::type_info& type) {
910 static const std::unordered_set<std::type_index> valid_types = {
912 std::type_index(
typeid(
void)),
913 std::type_index(
typeid(
RtcBool)),
914 std::type_index(
typeid(
RtcInt8)),
925 return valid_types.contains(std::type_index(type));
935inline const std::type_info& GetMetaDataReservedKeyType(
const std::string& key) {
936 static const std::map<std::string, const std::type_info&> reserved_key_types = {
937 {
"type",
typeid(std::reference_wrapper<const std::type_info>)},
942 {
"symlinks",
typeid(std::set<DataPointPath>)},
944 auto iter = reserved_key_types.find(key);
945 if (iter != reserved_key_types.end()) {
961inline void CheckMetaDataTypeForReservedKeys(
const std::string& key,
const std::type_info& type) {
962 const std::type_info& type_expected = GetMetaDataReservedKeyType(key);
963 if (type_expected ==
typeid(
void)) {
966 if (type !=
typeid(
void) and type_expected != type) {
979inline void CheckMetaDataValueType(
const std::string& key,
const std::type_info& type) {
980 const std::type_info& type_expected = GetMetaDataReservedKeyType(key);
981 if (type_expected !=
typeid(
void)) {
984 if (type !=
typeid(
void) and type_expected != type) {
985 throw CII_MAKE_EXCEPTION(
991 if (not TypeIsAllowedForValue(type)) {
1008template <
typename T>
1009void CheckMetaDataValueType(
const std::string& key) {
1011 std::is_same_v<T, RtcBool> or std::is_same_v<T, RtcInt8> or std::is_same_v<T, RtcInt16> or
1012 std::is_same_v<T, RtcInt32> or std::is_same_v<T, RtcInt64> or
1013 std::is_same_v<T, RtcUInt8> or std::is_same_v<T, RtcUInt16> or
1014 std::is_same_v<T, RtcUInt32> or std::is_same_v<T, RtcUInt64> or
1015 std::is_same_v<T, RtcFloat> or std::is_same_v<T, RtcDouble> or
1016 std::is_same_v<T, RtcString> or std::is_same_v<T, RtcBinary> or
1017 std::is_same_v<T, RtcVectorUInt64> or std::is_same_v<T, const std::type_info&> or
1018 std::is_same_v<T, RepositoryIf::Timestamp> or std::is_same_v<T, DataPointPath> or
1019 std::is_same_v<T, std::set<DataPointPath>>,
1020 "The type is not supported for MetaData values.");
1021 if constexpr (std::is_same_v<T, const std::type_info&>) {
1024 CheckMetaDataTypeForReservedKeys(key,
typeid(std::reference_wrapper<const std::type_info>));
1026 CheckMetaDataValueType(key,
typeid(T));
1037inline bool MetaDataKeyValueIsValid(
const std::string& key,
const std::any& value) {
1038 const std::type_info& type_expected = GetMetaDataReservedKeyType(key);
1039 if (type_expected !=
typeid(
void)) {
1042 if (value.type() !=
typeid(
void)) {
1043 return type_expected == value.type();
1051 return TypeIsAllowedForValue(value.type());
1067template <
typename T>
1070 if (expected_size > span.size()) {
1077inline bool RepositoryIf::MetaData::ConstValueProxy::HasValue() const noexcept {
1078 return m_value.has_value();
1081inline RepositoryIf::MetaData::ConstValueProxy::operator
const std::any&()
const {
1085template <
typename T>
1086const T& RepositoryIf::MetaData::ConstValueProxy::Cast()
const {
1087 CheckMetaDataValueType<T>(m_key);
1088 if constexpr (std::is_same_v<T, const std::type_info&>) {
1089 return std::any_cast<std::reference_wrapper<const std::type_info>>(m_value).get();
1091 return std::any_cast<const T&>(m_value);
1096 const std::any& value)
1097 : m_key(key), m_value(value) {
1100inline bool RepositoryIf::MetaData::ValueProxy::HasValue() const noexcept {
1101 return m_value.has_value();
1104inline RepositoryIf::MetaData::ValueProxy::operator
const std::any&()
const {
1108template <
typename T>
1109T& RepositoryIf::MetaData::ValueProxy::Cast() {
1110 CheckMetaDataValueType<T>(m_key);
1111 if constexpr (std::is_same_v<T, const std::type_info&>) {
1112 return std::any_cast<std::reference_wrapper<const std::type_info>>(m_value).get();
1114 return std::any_cast<T&>(m_value);
1118template <
typename T>
1119const T& RepositoryIf::MetaData::ValueProxy::Cast()
const {
1120 CheckMetaDataValueType<T>(m_key);
1121 if constexpr (std::is_same_v<T, const std::type_info&>) {
1122 return std::any_cast<std::reference_wrapper<const std::type_info>>(m_value).get();
1124 return std::any_cast<const T&>(m_value);
1128template <
typename T>
1130 using U = std::remove_cv_t<std::remove_reference_t<T>>;
1131 if constexpr (std::is_same_v<U, ValueProxy> or std::is_same_v<U, ConstValueProxy>) {
1133 CheckMetaDataValueType(m_key, rhs.m_value.type());
1134 m_value = rhs.m_value;
1135 }
else if constexpr (std::is_rvalue_reference_v<
decltype(rhs)>) {
1138 if constexpr (std::is_same_v<U, std::type_info>) {
1140 CheckMetaDataTypeForReservedKeys(m_key,
1141 typeid(std::reference_wrapper<const std::type_info>));
1142 m_value = std::make_any<std::reference_wrapper<const std::type_info>>(rhs);
1143 }
else if constexpr (std::is_same_v<U, std::any>) {
1144 CheckMetaDataValueType(m_key, rhs.type());
1145 m_value = std::forward<T>(rhs);
1147 CheckMetaDataValueType<U>(m_key);
1148 m_value = std::forward<T>(rhs);
1152 if constexpr (std::is_same_v<U, std::type_info>) {
1154 CheckMetaDataTypeForReservedKeys(m_key,
1155 typeid(std::reference_wrapper<const std::type_info>));
1156 m_value = std::make_any<std::reference_wrapper<const std::type_info>>(rhs);
1157 }
else if constexpr (std::is_same_v<U, std::any>) {
1158 CheckMetaDataValueType(m_key, rhs.type());
1161 CheckMetaDataValueType<U>(m_key);
1165 assert(MetaDataKeyValueIsValid(m_key, m_value) &&
1166 (
"Metadata was modified in an invalid manner."));
1170inline void RepositoryIf::MetaData::ValueProxy::Reset() noexcept {
1171 return m_value.reset();
1175 : m_key(key), m_value(value) {
1178template <
typename MapIterType,
typename ProxyType>
1179typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type&
1180RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator*() {
1181 m_pair.emplace(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1182 return m_pair.value();
1185template <
typename MapIterType,
typename ProxyType>
1186typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type
1187RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator*()
const {
1188 return value_type(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1191template <
typename MapIterType,
typename ProxyType>
1192typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type*
1193RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator->() {
1194 m_pair.emplace(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1195 return &m_pair.value();
1198template <
typename MapIterType,
typename ProxyType>
1199const typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type*
1200RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator->()
const {
1201 m_pair.emplace(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1202 return &m_pair.value();
1205template <
typename MapIterType,
typename ProxyType>
1206RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>&
1207RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator++() {
1212template <
typename MapIterType,
typename ProxyType>
1213RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>
1214RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator++(
int) {
1220template <
typename MapIterType,
typename ProxyType>
1221RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>&
1222RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator--() {
1227template <
typename MapIterType,
typename ProxyType>
1228RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>
1229RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator--(
int) {
1235template <
typename MapIterType,
typename ProxyType>
1236bool RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator==(
1237 const RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>& rhs)
const {
1238 return m_iterator == rhs.m_iterator;
1241template <
typename MapIterType,
typename ProxyType>
1242bool RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator!=(
1243 const RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>& rhs)
const {
1244 return m_iterator != rhs.m_iterator;
1247template <
typename MapIterType,
typename ProxyType>
1248RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::IteratorImpl(MapIterType&& iter)
1249 : m_iterator(std::forward<MapIterType>(iter)) {
1253 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::iterator,
1255 std::forward<RepositoryIf::
MetaData::MapType::iterator>(iter)) {
1259 RepositoryIf::MetaData::MapType::const_iterator&& iter)
1260 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::const_iterator,
1262 std::forward<RepositoryIf::
MetaData::MapType::const_iterator>(iter)) {
1266 RepositoryIf::MetaData::MapType::reverse_iterator&& iter)
1267 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::reverse_iterator,
1269 std::forward<RepositoryIf::
MetaData::MapType::reverse_iterator>(iter)) {
1273 MapType::const_reverse_iterator&& iter)
1274 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::const_reverse_iterator,
1276 std::forward<RepositoryIf::
MetaData::MapType::const_reverse_iterator>(iter)) {
1279inline RepositoryIf::MetaData::TypeMismatch::Attributes::Attributes(
1280 const std::string& key,
const std::type_info& type_used,
const std::type_info& type_expected)
1281 : m_key(key), m_type_used(type_used), m_type_expected(type_expected) {
1285 return m_metadata.empty();
1289 return m_metadata.size();
1293 return m_metadata.contains(key);
1296template <
typename T>
1298 std::string key_copy = key;
1299 return Insert(std::move(key_copy), std::forward<T>(value));
1302template <
typename T>
1304 using U = std::remove_cv_t<std::remove_reference_t<T>>;
1305 decltype(m_metadata)::iterator iter;
1307 if constexpr (std::is_same_v<U, std::type_info>) {
1309 CheckMetaDataTypeForReservedKeys(key,
typeid(std::reference_wrapper<const std::type_info>));
1310 auto type = std::make_any<std::reference_wrapper<const std::type_info>>(value);
1311 std::tie(iter, inserted) = m_metadata.try_emplace(std::forward<std::string>(key), type);
1313 CheckMetaDataValueType<U>(key);
1314 std::tie(iter, inserted) =
1315 m_metadata.try_emplace(std::forward<std::string>(key), std::forward<T>(value));
1321 throw CII_MAKE_EXCEPTION(
KeyAlreadyExists, std::forward<std::string>(key));
1323 assert(MetaDataKeyValueIsValid(iter->first, iter->second) &&
1324 (
"Metadata was modified in an invalid manner."));
1325 if constexpr (std::is_same_v<U, std::type_info>) {
1326 return std::any_cast<std::reference_wrapper<const std::type_info>>(iter->second).get();
1328 return std::any_cast<U&>(iter->second);
1335 return m_metadata.begin();
1339 return m_metadata.begin();
1343 return m_metadata.cbegin();
1347 return m_metadata.end();
1351 return m_metadata.end();
1355 return m_metadata.cend();
1359 return m_metadata.rbegin();
1363 return m_metadata.rbegin();
1368 return m_metadata.crbegin();
1372 return m_metadata.rend();
1376 return m_metadata.rend();
1380 return m_metadata.crend();
1384template <
typename T>
1387 const T& initial_value,
1388 std::optional<std::reference_wrapper<const MetaData>> metadata,
1395 if (metadata.has_value()) {
1396 merged_metadata = metadata.value();
1398 auto shape = TypeHandler::GetShape(initial_value);
1399 merged_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1400 merged_metadata[
"shape"] = shape;
1402 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1407 using TempBufferType =
typename TypeHandler::TempBufferType;
1409 auto temp_buffer = std::make_shared<TempBufferType>();
1410 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, shape);
1411 if (not buffer_resized) {
1412 throw CII_MAKE_EXCEPTION(
1414 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1415 boost::core::demangle(
typeid(TempBufferType).name())));
1418 TypeHandler::CopyToTempBuffer(initial_value, temp_buffer, 0, count);
1419 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1423 auto cb = [temp_buffer, callback](
const DataPointPath& path)
mutable {
1424 temp_buffer.reset();
1430 using ElementType =
typename TempBufferHandler::ElementType;
1432 path, std::move(span), std::move(merged_metadata), std::move(cb)});
1436 auto span = TypeHandler::MakeSpan(initial_value);
1437 using ElementType =
typename TypeHandler::ElementType;
1439 path, std::move(span), std::move(merged_metadata), callback});
1443template <
typename T>
1447 std::optional<std::reference_wrapper<MetaData>> metadata,
1456 ReadDataPointImpl(path, buffer, metadata, callback);
1459template <
typename T>
1460void RepositoryIf::BatchRequest::ReadDataPointImpl(
1463 std::optional<std::reference_wrapper<MetaData>> metadata,
1465 static_assert(not std::is_same_v<T, std::string_view>,
1466 "It is not possible to read data from a datapoint into a read-only string_view.");
1469 using DataPointType =
typename TypeHandler::DataPointType;
1473 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1474 using TempBufferType =
typename TypeHandler::TempBufferType;
1476 auto temp_buffer = std::make_shared<TempBufferType>();
1486 auto prepare_buffer = [&, temp_buffer](
const MetaData& md) {
1487 assert((md.Contains(
"type")) && (
"Adapter must provide the type in the metadata."));
1488 assert((md.Contains(
"shape")) && (
"Adapter must provide the shape in the metadata."));
1489 if (md[
"type"].Cast<const std::type_info&>() !=
typeid(DataPointType)) {
1493 TypeHandler::ResizeBuffer(buffer, shape);
1494 TempBufferHandler::ResizeBuffer(*temp_buffer, shape);
1497 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1498 CheckSpanSize(span, md);
1505 auto cb = [&, temp_buffer, callback](
const DataPointPath& path)
mutable {
1506 auto shape = TempBufferHandler::GetShape(*temp_buffer);
1508 TypeHandler::CopyFromTempBuffer(buffer, temp_buffer, 0, count);
1509 temp_buffer.reset();
1515 using ElementType =
typename TempBufferHandler::ElementType;
1516 m_requests.push_back(detail::ReadRequest<ElementType>{
1517 path, std::move(prepare_buffer), metadata, std::move(cb)});
1519 auto prepare_buffer = [&](
const MetaData& md) {
1520 assert((md.Contains(
"type")) && (
"Adapter must provide the type in the metadata."));
1521 assert((md.Contains(
"shape")) && (
"Adapter must provide the shape in the metadata."));
1522 if (md[
"type"].Cast<const std::type_info&>() !=
typeid(DataPointType)) {
1523 throw CII_MAKE_EXCEPTION(IncompatibleType,
"Datapoint type mismatch.");
1525 TypeHandler::ResizeBuffer(buffer, md[
"shape"].Cast<RtcVectorUInt64>());
1526 auto span = TypeHandler::MakeSpan(buffer);
1527 CheckSpanSize(span, md);
1531 using ElementType =
typename TypeHandler::ElementType;
1532 m_requests.push_back(
1533 detail::ReadRequest<ElementType>{path, std::move(prepare_buffer), metadata, callback});
1537template <
typename T>
1541 std::optional<std::reference_wrapper<MetaData>> metadata,
1548 if (metadata.has_value()) {
1549 merged_metadata = metadata.value();
1551 auto shape = TypeHandler::GetShape(buffer);
1552 merged_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1553 merged_metadata[
"shape"] = shape;
1555 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1560 using TempBufferType =
typename TypeHandler::TempBufferType;
1562 auto temp_buffer = std::make_shared<TempBufferType>();
1563 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, shape);
1564 if (not buffer_resized) {
1565 throw CII_MAKE_EXCEPTION(
1567 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1568 boost::core::demangle(
typeid(TempBufferType).name())));
1571 TypeHandler::CopyToTempBuffer(buffer, temp_buffer, 0, count);
1572 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1576 auto cb = [temp_buffer, callback](
const DataPointPath& path)
mutable {
1577 temp_buffer.reset();
1583 using ElementType =
typename TempBufferHandler::ElementType;
1585 path, std::move(span), std::move(merged_metadata), metadata, std::move(cb)});
1587 auto span = TypeHandler::MakeSpan(buffer);
1588 using ElementType =
typename TypeHandler::ElementType;
1590 path, std::move(span), std::move(merged_metadata), metadata, callback});
1594template <
typename T>
1601 std::optional<std::reference_wrapper<MetaData>> metadata,
1604 PartialReadDataPointImpl(path, buffer, first, last, d_first, metadata, callback);
1607template <
typename T>
1608void RepositoryIf::BatchRequest::PartialReadDataPointImpl(
1614 std::optional<std::reference_wrapper<MetaData>> metadata,
1620 auto shape = TypeHandler::GetShape(buffer);
1622 size_t expected_size = d_first + last - first;
1623 if (first > last or expected_size > buffer_size) {
1627 "Make sure first <= last and d_first + last - first <= number of "
1628 "elements in the output buffer.");
1631 input_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1632 input_metadata[
"shape"] = shape;
1634 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1642 using TempBufferType =
typename TypeHandler::TempBufferType;
1644 auto temp_buffer = std::make_shared<TempBufferType>();
1645 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, {last - first});
1646 if (not buffer_resized) {
1647 throw CII_MAKE_EXCEPTION(
1648 RepositoryIf::ServiceFailure,
1649 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1650 boost::core::demangle(
typeid(TempBufferType).name())));
1652 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1653 assert((span.size() >= last - first) &&
1654 (
"The temporary buffer was not resized correctly."));
1661 [&, temp_buffer, callback, first, last, d_first](
const DataPointPath& path)
mutable {
1662 TypeHandler::CopyFromTempBuffer(buffer, temp_buffer, d_first, last - first);
1663 temp_buffer.reset();
1669 using ElementType =
typename TempBufferHandler::ElementType;
1670 m_requests.push_back(detail::PartialReadRequest<ElementType>{
1671 path, span, input_metadata, metadata, first, std::move(cb)});
1673 auto span = TypeHandler::MakeSpan(buffer);
1674 using ElementType =
typename TypeHandler::ElementType;
1675 m_requests.push_back(detail::PartialReadRequest<ElementType>{
1676 path, span.subspan(d_first, last - first), input_metadata, metadata, first, callback});
1680template <
typename T>
1687 std::optional<std::reference_wrapper<MetaData>> metadata,
1693 auto shape = TypeHandler::GetShape(buffer);
1695 if (first > last or last > buffer_size) {
1696 throw CII_MAKE_EXCEPTION(
1700 "Make sure first <= last <= number of elements in the input buffer.");
1704 if (metadata.has_value()) {
1705 merged_metadata = metadata.value();
1707 merged_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1708 merged_metadata[
"shape"] = shape;
1710 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1717 using TempBufferType =
typename TypeHandler::TempBufferType;
1719 auto temp_buffer = std::make_shared<TempBufferType>();
1720 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, {last - first});
1721 if (not buffer_resized) {
1722 throw CII_MAKE_EXCEPTION(
1724 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1725 boost::core::demangle(
typeid(TempBufferType).name())));
1727 TypeHandler::CopyToTempBuffer(buffer, temp_buffer, 0, last - first);
1728 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1729 assert((span.size() >= last - first) &&
1730 (
"The temporary buffer was not resized correctly."));
1734 auto cb = [temp_buffer, callback](
const DataPointPath& path)
mutable {
1735 temp_buffer.reset();
1741 using ElementType =
typename TempBufferHandler::ElementType;
1743 path, span, std::move(merged_metadata), d_first, metadata, std::move(cb)});
1745 auto span = TypeHandler::MakeSpan(buffer);
1746 using ElementType =
typename TypeHandler::ElementType;
1749 span.subspan(first, last - first),
1750 std::move(merged_metadata),
1762 const std::any& initial_value,
1763 std::optional<std::reference_wrapper<const MetaData>> metadata,
1767void RepositoryIf::BatchRequest::ReadDataPointImpl(
1770 std::optional<std::reference_wrapper<MetaData>> metadata,
1776 const std::any& buffer,
1777 std::optional<std::reference_wrapper<MetaData>> metadata,
1781void RepositoryIf::BatchRequest::PartialReadDataPointImpl(
1787 std::optional<std::reference_wrapper<MetaData>> metadata,
1793 const std::any& buffer,
1797 std::optional<std::reference_wrapper<MetaData>> metadata,
1800template <
typename Rep,
typename Period>
1806 auto maxtime = Clock::now();
1807 maxtime += std::chrono::duration_cast<Clock::duration>(timeout);
1811template <
typename Clk,
typename Duration>
1815 if (response.wait_until(timeout) != std::future_status::ready) {
1825template <
typename T>
1827 static_assert(not std::is_same_v<T, std::any>,
1828 "Cannot create a datapoint using an empty std::any. Datapoint type is unknown.");
1835template <
typename T>
1842template <
typename T>
1848 if constexpr (std::is_same_v<T, std::any>) {
1860template <
typename T>
1865 return std::nullopt;
1868template <
typename T>
1875template <
typename T>
1879 if constexpr (std::is_same_v<T, std::any>) {
1880 if (not buffer.has_value()) {
1893template <
typename T>
1900template <
typename... T>
1902 std::optional<std::reference_wrapper<const DataPointPath>> path_ref;
1906 if constexpr (std::is_same_v<
const DataPointPath&,
decltype(args)>) {
1916template <
typename... T>
1918 std::optional<std::reference_wrapper<const DataPointPath>> path_ref;
1922 if constexpr ((std::is_same_v<T, std::any> or ...)) {
1923 using Entry = std::pair<std::reference_wrapper<std::any>,
MetaData>;
1924 std::vector<Entry> any_buffers;
1927 any_buffers.reserve(
sizeof...(T));
1931 if constexpr (std::is_same_v<
DataPointPath&,
decltype(args)>) {
1933 }
else if constexpr (std::is_same_v<std::any&,
decltype(args)>) {
1934 if (not args.has_value()) {
1935 auto& metadata = any_buffers.emplace_back(Entry(args,
MetaData{})).second;
1936 meta_req.
ReadMetaData(path_ref.value().get(), metadata);
1941 if (not any_buffers.empty()) {
1943 for (
auto [buffer, metadata] : any_buffers) {
1952 if constexpr (std::is_same_v<
DataPointPath&,
decltype(args)>) {
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:77
bool IsAbsolutePath() const
Checks whether the path is an absolute path.
Definition dataPointPath.cpp:145
A buffer class representing 2D matrix data.
Definition matrixBuffer.hpp:28
size_type GetNcols() const
Definition matrixBuffer.hpp:89
size_type GetNrows() const
Definition matrixBuffer.hpp:85
constexpr void resize(size_type n, size_type m)
Definition matrixBuffer.hpp:60
A span referencing a 2D matrix buffer.
Definition matrixSpan.hpp:36
size_type GetNrows() const
Definition matrixSpan.hpp:156
size_type GetNcols() const
Definition matrixSpan.hpp:160
An object representing one or more asynchronous I/O requests to a repository.
Definition repositoryIf.hpp:634
RequestList m_requests
Definition repositoryIf.hpp:922
void WriteDataPoint(const DataPointPath &path, const T &buffer, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)
Definition repositoryIf.ipp:1538
void ReadDataPoint(const DataPointPath &path, T &buffer, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr) const
Definition repositoryIf.ipp:1444
void PartialReadDataPoint(const DataPointPath &path, T &buffer, size_t first, size_t last, size_t d_first, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr) const
Definition repositoryIf.ipp:1595
void ReadMetaData(const DataPointPath &path, MetaData &metadata, const CallbackType &callback=nullptr) const
Definition repositoryIf.cpp:367
void PartialWriteDataPoint(const DataPointPath &path, const T &buffer, size_t first, size_t last, size_t d_first, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)
Definition repositoryIf.ipp:1681
void CreateDataPoint(const DataPointPath &path, const T &initial_value, std::optional< std::reference_wrapper< const MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)
Definition repositoryIf.ipp:1385
void Wait()
Definition repositoryIf.cpp:645
ResponseList m_responses
Definition repositoryIf.hpp:957
bool WaitFor(const std::chrono::duration< Rep, Period > &timeout)
Definition repositoryIf.ipp:1801
bool WaitUntil(const std::chrono::time_point< Clk, Duration > &timeout)
Definition repositoryIf.ipp:1812
Definition repositoryIf.hpp:90
Definition repositoryIf.hpp:78
Definition repositoryIf.hpp:74
Definition repositoryIf.hpp:66
std::optional< T > TryGetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition repositoryIf.ipp:1861
Clock::time_point Timestamp
Definition repositoryIf.hpp:58
void WriteDataPoints(const T &... args)
Definition repositoryIf.ipp:1901
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition repositoryIf.ipp:1843
void ReadDataPoints(T &... args) const
Definition repositoryIf.ipp:1917
void CreateDataPoint(const DataPointPath &path)
Creates a new empty datapoint in the repository.
Definition repositoryIf.ipp:1826
static std::any MakeAnyBuffer(const MetaData &metadata)
Helper method to create an std::any buffer compatible with a specific datapoint.
Definition repositoryIf.cpp:897
void SetDataPoint(const DataPointPath &path, const T &value)
Sets a datapoint in the repository.
Definition repositoryIf.ipp:1869
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition repositoryIf.ipp:1894
BatchResponse SendRequest(const BatchRequest &request)
Definition repositoryIf.cpp:669
void ReadDataPoint(const DataPointPath &path, T &buffer) const
Reads a datapoint from the repository.
Definition repositoryIf.ipp:1876
std::function< void(const DataPointPath &)> CallbackType
Signature of the callback functions that can be registered with the repository requests.
Definition repositoryIf.hpp:61
bool DataPointExists(const DataPointPath &path) const
Checks for the existence of a datapoint in the repository.
Definition repositoryIf.cpp:766
Definition measurable.hpp:26
RtcUInt64 GetNumOfElements(const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:136
void EnsureAbsolutePath(const DataPointPath &path)
Definition repositoryIf.ipp:144
Definition commandReplier.cpp:22
RepositoryIf::MetaData MetaData
Definition oldbAdapter.cpp:55
void to_json(JsonPayload &j, const DataPointPath &v)
Definition dataPointPath.cpp:218
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
std::int64_t RtcInt64
Definition basicTypes.hpp:41
std::int16_t RtcInt16
Definition basicTypes.hpp:39
std::uint16_t RtcUInt16
Definition basicTypes.hpp:43
float RtcFloat
Definition basicTypes.hpp:46
std::int32_t RtcInt32
Definition basicTypes.hpp:40
componentFramework::MatrixBuffer< T > RtcMatrix
Definition basicTypes.hpp:35
std::int8_t RtcInt8
Definition basicTypes.hpp:38
std::string RtcString
Definition basicTypes.hpp:48
std::vector< T > RtcVector
Definition basicTypes.hpp:29
bool RtcBool
Definition basicTypes.hpp:37
std::uint32_t RtcUInt32
Definition basicTypes.hpp:44
RtcMatrix< RtcBool > RtcMatrixBool
Definition basicTypes.hpp:62
std::uint8_t RtcUInt8
Definition basicTypes.hpp:42
RtcVector< RtcBool > RtcVectorBool
Definition basicTypes.hpp:50
RtcVector< RtcUInt64 > RtcVectorUInt64
Definition basicTypes.hpp:58
std::uint64_t RtcUInt64
Definition basicTypes.hpp:45
double RtcDouble
Definition basicTypes.hpp:47
Definition ddsSub.hpp:156
Definition repositoryIf.ipp:40
gsl::span< const T > data
Definition repositoryIf.ipp:43
DataPointPath path
Definition repositoryIf.ipp:42
T ElementType
Definition repositoryIf.ipp:41
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:45
RepositoryIf::MetaData metadata
Definition repositoryIf.ipp:44
Definition repositoryIf.ipp:124
DataPointPath link_path
Definition repositoryIf.ipp:126
DataPointPath path
Definition repositoryIf.ipp:125
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:127
Definition repositoryIf.ipp:48
DataPointPath path
Definition repositoryIf.ipp:49
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:50
Definition repositoryIf.ipp:53
DataPointPath path
Definition repositoryIf.ipp:54
bool & result
Definition repositoryIf.ipp:55
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:56
Definition repositoryIf.ipp:59
bool recurse
Definition repositoryIf.ipp:61
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:63
std::pair< RepositoryIf::PathList, RepositoryIf::PathList > & result
Definition repositoryIf.ipp:62
DataPointPath path
Definition repositoryIf.ipp:60
Definition repositoryIf.ipp:91
DataPointPath path
Definition repositoryIf.ipp:93
gsl::span< T > data
Definition repositoryIf.ipp:94
T ElementType
Definition repositoryIf.ipp:92
RepositoryIf::MetaData input_metadata
Definition repositoryIf.ipp:95
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:98
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > output_metadata
Definition repositoryIf.ipp:96
size_t offset
Definition repositoryIf.ipp:97
Definition repositoryIf.ipp:102
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:109
DataPointPath path
Definition repositoryIf.ipp:104
RepositoryIf::MetaData metadata
Definition repositoryIf.ipp:106
gsl::span< const T > data
Definition repositoryIf.ipp:105
size_t offset
Definition repositoryIf.ipp:107
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > output_metadata
Definition repositoryIf.ipp:108
T ElementType
Definition repositoryIf.ipp:103
Definition repositoryIf.ipp:67
T ElementType
Definition repositoryIf.ipp:68
std::function< gsl::span< T >(const RepositoryIf::MetaData &)> PrepareFunctionType
Definition repositoryIf.ipp:69
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > metadata
Definition repositoryIf.ipp:76
PrepareFunctionType prepare_buffer
Definition repositoryIf.ipp:75
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:77
DataPointPath path
Definition repositoryIf.ipp:70
Definition repositoryIf.ipp:130
DataPointPath path
Definition repositoryIf.ipp:131
DataPointPath link_path
Definition repositoryIf.ipp:132
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:133
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:545
MatrixBuffer< T, A > BufferType
Definition repositoryIf.ipp:544
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:550
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:566
void TempBufferType
Definition repositoryIf.ipp:548
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:546
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:570
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:547
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:562
RtcMatrixBool DataPointType
Definition repositoryIf.ipp:584
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:585
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:602
static gsl::span< ElementType > MakeSpan(BufferType &buffer)=delete
Span not constructable from a MatrixBuffer<bool> type.
boost::container::vector< bool > TempBufferType
Definition repositoryIf.ipp:586
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)=delete
Span not constructable from a MatrixBuffer<bool> type.
static void CopyToTempBuffer(const BufferType &buffer, std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:611
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:583
static void CopyFromTempBuffer(BufferType &buffer, const std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:620
MatrixBuffer< bool, A > BufferType
Definition repositoryIf.ipp:582
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:588
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:638
void TempBufferType
Definition repositoryIf.ipp:636
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:650
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:658
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:633
MatrixSpan< T > BufferType
Definition repositoryIf.ipp:632
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:635
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:654
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:634
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:862
void TempBufferType
Definition repositoryIf.ipp:863
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:882
std::remove_cv_t< T > ElementType
Definition repositoryIf.ipp:860
T[N][M] BufferType
Definition repositoryIf.ipp:859
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:865
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:887
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:861
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:877
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:810
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:790
T[N] BufferType
Definition repositoryIf.ipp:787
void TempBufferType
Definition repositoryIf.ipp:791
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:789
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:793
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:814
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:806
std::remove_cv_t< T > ElementType
Definition repositoryIf.ipp:788
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:439
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:418
void TempBufferType
Definition repositoryIf.ipp:420
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:443
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:417
boost::container::vector< T, A > BufferType
Definition repositoryIf.ipp:416
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:422
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:435
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:419
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:840
RtcString DataPointType
Definition repositoryIf.ipp:828
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:836
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:844
void TempBufferType
Definition repositoryIf.ipp:830
char ElementType
Definition repositoryIf.ipp:827
char[N] BufferType
Definition repositoryIf.ipp:826
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:829
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:832
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:478
void TempBufferType
Definition repositoryIf.ipp:459
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:461
gsl::span< T, N > BufferType
Definition repositoryIf.ipp:455
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:456
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:457
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:482
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:474
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:458
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:495
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:508
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:504
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:512
gsl::span< char, N > BufferType
Definition repositoryIf.ipp:494
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:497
void TempBufferType
Definition repositoryIf.ipp:498
RtcString DataPointType
Definition repositoryIf.ipp:496
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:500
void TempBufferType
Definition repositoryIf.ipp:523
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:533
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:537
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:520
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:522
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:529
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:525
RtcString DataPointType
Definition repositoryIf.ipp:521
gsl::span< const char, N > BufferType
Definition repositoryIf.ipp:519
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:673
std::array< T, N > BufferType
Definition repositoryIf.ipp:670
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:697
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:693
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:672
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:689
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:676
void TempBufferType
Definition repositoryIf.ipp:674
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:671
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:715
void TempBufferType
Definition repositoryIf.ipp:713
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:712
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:727
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:723
std::array< char, N > BufferType
Definition repositoryIf.ipp:709
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:710
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:719
RtcString DataPointType
Definition repositoryIf.ipp:711
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:741
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:757
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:745
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:769
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:742
std::remove_cv_t< T > ElementType
Definition repositoryIf.ipp:740
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:763
void TempBufferType
Definition repositoryIf.ipp:743
std::array< std::array< T, M >, N > BufferType
Definition repositoryIf.ipp:739
std::string BufferType
Definition repositoryIf.ipp:266
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:272
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:276
void TempBufferType
Definition repositoryIf.ipp:270
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:269
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:284
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:280
RtcString DataPointType
Definition repositoryIf.ipp:268
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:267
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:302
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:315
RtcString DataPointType
Definition repositoryIf.ipp:298
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:299
static gsl::span< ElementType > MakeSpan(BufferType &buffer)=delete
It is not possible to create mutable span from a read-only string view.
void TempBufferType
Definition repositoryIf.ipp:300
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:311
std::string_view BufferType
Definition repositoryIf.ipp:296
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:297
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:328
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:333
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:346
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:330
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:329
std::vector< T, A > BufferType
Definition repositoryIf.ipp:327
void TempBufferType
Definition repositoryIf.ipp:331
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:350
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:354
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:369
static gsl::span< ElementType > MakeSpan(BufferType &buffer)=delete
Span not constructable from a std::vector<bool> type.
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)=delete
Span not constructable from a std::vector<bool> type.
boost::container::vector< bool > TempBufferType
Definition repositoryIf.ipp:370
static void CopyFromTempBuffer(BufferType &buffer, const std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:404
RtcVectorBool DataPointType
Definition repositoryIf.ipp:368
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:367
std::vector< bool, A > BufferType
Definition repositoryIf.ipp:366
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:372
static void CopyToTempBuffer(const BufferType &buffer, std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:395
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:386
Definition repositoryIf.ipp:152
void TempBufferType
Defines the temporary buffer type (set to void if USES_TEMP_BUFFER is false).
Definition repositoryIf.ipp:166
static const bool USES_TEMP_BUFFER
Flag indicating if a temporary buffer is required to read/write this type.
Definition repositoryIf.ipp:163
static void CopyToTempBuffer(const BufferType &buffer, std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)=delete
Copy data from the original buffer into the temporary buffer.
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Creates a span from a read-only buffer object.
Definition repositoryIf.ipp:201
std::remove_cv_t< T > ElementType
Defines the element type of the buffer object.
Definition repositoryIf.ipp:157
T DataPointType
Defines the corresponding data point type that type T is compatible with.
Definition repositoryIf.ipp:160
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Creates a span from a buffer object.
Definition repositoryIf.ipp:192
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Returns the shape of a buffer object.
Definition repositoryIf.ipp:175
T BufferType
Defines the type of the buffer object that handles type T.
Definition repositoryIf.ipp:154
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Tries to resize the buffer to the given shape.
Definition repositoryIf.ipp:218
static void CopyFromTempBuffer(BufferType &buffer, const std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)=delete
Copy data from the temporary buffer into the original buffer.
Definition repositoryIf.ipp:81
RepositoryIf::MetaData metadata
Definition repositoryIf.ipp:85
DataPointPath path
Definition repositoryIf.ipp:83
gsl::span< const T > data
Definition repositoryIf.ipp:84
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > output_metadata
Definition repositoryIf.ipp:86
T ElementType
Definition repositoryIf.ipp:82
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:87
Provides useful mechanisms to test various type traits.