19#include <fmt/format.h>
21#include <boost/container/vector.hpp>
22#include <boost/core/demangle.hpp>
27#include <unordered_set>
61 std::pair<RepositoryIf::PathList, RepositoryIf::PathList>&
result;
75 std::optional<std::reference_wrapper<RepositoryIf::MetaData>>
metadata;
137 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.");
220 if (shape.size() == 0) {
242 std::shared_ptr<TempBufferType>& temp_buffer,
244 size_t count) =
delete;
260 const std::shared_ptr<TempBufferType>& temp_buffer,
262 size_t count) =
delete;
268 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
274 return {buffer.size()};
286 if (shape.size() == 1) {
287 buffer.resize(shape[0]);
298 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
304 return {buffer.size()};
313 return {buffer.data(), buffer.size()};
318 if (shape.size() == 1 and shape[0] == buffer.size()) {
327template <
typename T,
typename A>
330 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
337 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
338 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
339 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
340 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
341 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
342 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
343 std::is_same_v<ElementType, std::byte>,
344 "The vector type is not supported.");
345 return {buffer.size()};
357 if (shape.size() == 1) {
358 buffer.resize(shape[0]);
369 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
375 return {buffer.size()};
389 if (shape.size() == 1) {
390 buffer.resize(shape[0]);
398 std::shared_ptr<TempBufferType>& temp_buffer,
402 assert((buffer.size() >= offset + count) && (
"The input buffer is too small."));
404 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
405 std::copy(buffer.begin() + offset, buffer.begin() + offset + count, temp_buffer->begin());
409 const std::shared_ptr<TempBufferType>& temp_buffer,
413 assert((buffer.size() >= offset + count) && (
"The output buffer is too small."));
415 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
416 std::copy(temp_buffer->begin(), temp_buffer->begin() + count, buffer.begin() + offset);
420template <
typename T,
typename A>
423 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
430 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
431 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
432 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
433 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
434 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
435 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
436 std::is_same_v<ElementType, std::byte>,
437 "The vector type is not supported.");
438 return {buffer.size()};
450 if (shape.size() == 1) {
451 buffer.resize(shape[0]);
459template <
typename T, decltype(gsl::dynamic_extent) N>
462 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
469 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
470 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
471 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
472 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
473 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
474 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
475 std::is_same_v<ElementType, std::byte>,
476 "The vector type is not supported.");
477 return {buffer.size()};
489 if (shape.size() == 1 and shape[0] == buffer.size()) {
498template <decltype(gsl::dynamic_extent) N>
501 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
507 return {buffer.size()};
523template <decltype(gsl::dynamic_extent) N>
526 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
532 return {buffer.size()};
548template <
typename T,
typename A>
551 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
558 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
559 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
560 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
561 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
562 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
563 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
564 "The matrix type is not supported.");
577 if (shape.size() == 2) {
578 buffer.
resize(shape[0], shape[1]);
589 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
609 if (shape.size() == 2) {
610 buffer.
resize(shape[0], shape[1]);
618 std::shared_ptr<TempBufferType>& temp_buffer,
622 assert((buffer.size() >= offset + count) && (
"The input buffer is too small."));
624 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
625 std::copy(buffer.begin() + offset, buffer.begin() + offset + count, temp_buffer->begin());
629 const std::shared_ptr<TempBufferType>& temp_buffer,
633 assert((buffer.size() >= offset + count) && (
"The output buffer is too small."));
635 assert((temp_buffer->size() >= count) && (
"The temporary buffer is too small."));
636 std::copy(temp_buffer->begin(), temp_buffer->begin() + count, buffer.begin() + offset);
643 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
650 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
651 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
652 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
653 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
654 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
655 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
656 "The matrix type is not supported.");
669 if (shape.size() == 2 and shape[0] == buffer.
GetNrows() and shape[1] == buffer.
GetNcols()) {
678template <
typename T, std::
size_t N>
681 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
688 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
689 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
690 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
691 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
692 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
693 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
694 std::is_same_v<ElementType, std::byte>,
695 "The array type is not supported.");
696 return {buffer.size()};
708 if (shape.size() == 1 and shape[0] == buffer.size()) {
717template <std::
size_t N>
720 using ElementType = std::remove_cv_t<typename BufferType::value_type>;
726 return {buffer.size()};
738 if (shape.size() == 1 and shape[0] == buffer.size()) {
747template <
typename T, std::
size_t N, std::
size_t M>
757 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
758 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
759 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
760 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
761 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
762 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
763 "The array type is not supported.");
770 return {begin, N * M};
776 return {begin, N * M};
780 if (shape.size() == 2 and shape[0] == N and shape[1] == M) {
795template <
typename T, std::
size_t N>
805 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
806 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
807 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
808 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
809 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
810 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString> or
811 std::is_same_v<ElementType, std::byte>,
812 "The array type is not supported.");
825 if (shape.size() == 1 and shape[0] == N) {
834template <std::
size_t N>
855 if (shape.size() == 1 and shape[0] == N) {
867template <
typename T, std::
size_t N, std::
size_t M>
877 std::is_same_v<ElementType, RtcBool> or std::is_same_v<ElementType, RtcInt8> or
878 std::is_same_v<ElementType, RtcInt16> or std::is_same_v<ElementType, RtcInt32> or
879 std::is_same_v<ElementType, RtcInt64> or std::is_same_v<ElementType, RtcUInt8> or
880 std::is_same_v<ElementType, RtcUInt16> or std::is_same_v<ElementType, RtcUInt32> or
881 std::is_same_v<ElementType, RtcUInt64> or std::is_same_v<ElementType, RtcFloat> or
882 std::is_same_v<ElementType, RtcDouble> or std::is_same_v<ElementType, RtcString>,
883 "The array type is not supported.");
889 return {&buffer[0][0], N * M};
894 return {&buffer[0][0], N * M};
898 if (shape.size() == 2 and shape[0] == N and shape[1] == M) {
919inline bool TypeIsAllowedForValue(
const std::type_info& type) {
920 static const std::unordered_set<std::type_index> valid_types = {
922 std::type_index(
typeid(
void)),
923 std::type_index(
typeid(
RtcBool)),
924 std::type_index(
typeid(
RtcInt8)),
935 return valid_types.contains(std::type_index(type));
945inline const std::type_info& GetMetaDataReservedKeyType(
const std::string& key) {
946 static const std::map<std::string, const std::type_info&> reserved_key_types = {
947 {
"type",
typeid(std::reference_wrapper<const std::type_info>)},
952 {
"symlinks",
typeid(std::set<DataPointPath>)},
954 auto iter = reserved_key_types.find(key);
955 if (iter != reserved_key_types.end()) {
971inline void CheckMetaDataTypeForReservedKeys(
const std::string& key,
const std::type_info& type) {
972 const std::type_info& type_expected = GetMetaDataReservedKeyType(key);
973 if (type_expected ==
typeid(
void)) {
976 if (type !=
typeid(
void) and type_expected != type) {
989inline void CheckMetaDataValueType(
const std::string& key,
const std::type_info& type) {
990 const std::type_info& type_expected = GetMetaDataReservedKeyType(key);
991 if (type_expected !=
typeid(
void)) {
994 if (type !=
typeid(
void) and type_expected != type) {
995 throw CII_MAKE_EXCEPTION(
1001 if (not TypeIsAllowedForValue(type)) {
1018template <
typename T>
1019void CheckMetaDataValueType(
const std::string& key) {
1021 std::is_same_v<T, RtcBool> or std::is_same_v<T, RtcInt8> or std::is_same_v<T, RtcInt16> or
1022 std::is_same_v<T, RtcInt32> or std::is_same_v<T, RtcInt64> or
1023 std::is_same_v<T, RtcUInt8> or std::is_same_v<T, RtcUInt16> or
1024 std::is_same_v<T, RtcUInt32> or std::is_same_v<T, RtcUInt64> or
1025 std::is_same_v<T, RtcFloat> or std::is_same_v<T, RtcDouble> or
1026 std::is_same_v<T, RtcString> or std::is_same_v<T, RtcBinary> or
1027 std::is_same_v<T, RtcVectorUInt64> or std::is_same_v<T, const std::type_info&> or
1028 std::is_same_v<T, RepositoryIf::Timestamp> or std::is_same_v<T, DataPointPath> or
1029 std::is_same_v<T, std::set<DataPointPath>>,
1030 "The type is not supported for MetaData values.");
1031 if constexpr (std::is_same_v<T, const std::type_info&>) {
1034 CheckMetaDataTypeForReservedKeys(key,
typeid(std::reference_wrapper<const std::type_info>));
1036 CheckMetaDataValueType(key,
typeid(T));
1047inline bool MetaDataKeyValueIsValid(
const std::string& key,
const std::any& value) {
1048 const std::type_info& type_expected = GetMetaDataReservedKeyType(key);
1049 if (type_expected !=
typeid(
void)) {
1052 if (value.type() !=
typeid(
void)) {
1053 return type_expected == value.type();
1061 return TypeIsAllowedForValue(value.type());
1077template <
typename T>
1080 if (expected_size > span.size()) {
1087inline bool RepositoryIf::MetaData::ConstValueProxy::HasValue() const noexcept {
1088 return m_value.has_value();
1091inline RepositoryIf::MetaData::ConstValueProxy::operator
const std::any&()
const {
1095template <
typename T>
1096const T& RepositoryIf::MetaData::ConstValueProxy::Cast()
const {
1097 CheckMetaDataValueType<T>(m_key);
1098 if constexpr (std::is_same_v<T, const std::type_info&>) {
1099 return std::any_cast<std::reference_wrapper<const std::type_info>>(m_value).get();
1101 return std::any_cast<const T&>(m_value);
1107 const std::any& value)
1108 : m_key(key), m_value(value) {
1111inline bool RepositoryIf::MetaData::ValueProxy::HasValue() const noexcept {
1112 return m_value.has_value();
1115inline RepositoryIf::MetaData::ValueProxy::operator
const std::any&()
const {
1119template <
typename T>
1120T& RepositoryIf::MetaData::ValueProxy::Cast() {
1121 CheckMetaDataValueType<T>(m_key);
1122 if constexpr (std::is_same_v<T, const std::type_info&>) {
1123 return std::any_cast<std::reference_wrapper<const std::type_info>>(m_value).get();
1125 return std::any_cast<T&>(m_value);
1129template <
typename T>
1130const T& RepositoryIf::MetaData::ValueProxy::Cast()
const {
1131 CheckMetaDataValueType<T>(m_key);
1132 if constexpr (std::is_same_v<T, const std::type_info&>) {
1133 return std::any_cast<std::reference_wrapper<const std::type_info>>(m_value).get();
1135 return std::any_cast<const T&>(m_value);
1139template <
typename T>
1141 using U = std::remove_cv_t<std::remove_reference_t<T>>;
1142 if constexpr (std::is_same_v<U, ValueProxy> or std::is_same_v<U, ConstValueProxy>) {
1144 CheckMetaDataValueType(m_key, rhs.m_value.type());
1145 m_value = rhs.m_value;
1146 }
else if constexpr (std::is_rvalue_reference_v<
decltype(rhs)>) {
1149 if constexpr (std::is_same_v<U, std::type_info>) {
1151 CheckMetaDataTypeForReservedKeys(m_key,
1152 typeid(std::reference_wrapper<const std::type_info>));
1153 m_value = std::make_any<std::reference_wrapper<const std::type_info>>(rhs);
1154 }
else if constexpr (std::is_same_v<U, std::any>) {
1155 CheckMetaDataValueType(m_key, rhs.type());
1156 m_value = std::forward<T>(rhs);
1158 CheckMetaDataValueType<U>(m_key);
1159 m_value = std::forward<T>(rhs);
1163 if constexpr (std::is_same_v<U, std::type_info>) {
1165 CheckMetaDataTypeForReservedKeys(m_key,
1166 typeid(std::reference_wrapper<const std::type_info>));
1167 m_value = std::make_any<std::reference_wrapper<const std::type_info>>(rhs);
1168 }
else if constexpr (std::is_same_v<U, std::any>) {
1169 CheckMetaDataValueType(m_key, rhs.type());
1172 CheckMetaDataValueType<U>(m_key);
1176 assert(MetaDataKeyValueIsValid(m_key, m_value) &&
1178 (
"Metadata was modified in an invalid manner."));
1182inline void RepositoryIf::MetaData::ValueProxy::Reset() noexcept {
1183 return m_value.reset();
1188 : m_key(key), m_value(value) {
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>
1199typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type
1200RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator*()
const {
1201 return value_type(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1204template <
typename MapIterType,
typename ProxyType>
1205typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type*
1206RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator->() {
1207 m_pair.emplace(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1208 return &m_pair.value();
1211template <
typename MapIterType,
typename ProxyType>
1212const typename RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::value_type*
1213RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator->()
const {
1214 m_pair.emplace(m_iterator->first, ProxyType(m_iterator->first, m_iterator->second));
1215 return &m_pair.value();
1218template <
typename MapIterType,
typename ProxyType>
1219RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>&
1220RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator++() {
1225template <
typename MapIterType,
typename ProxyType>
1226RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>
1227RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator++(
int) {
1233template <
typename MapIterType,
typename ProxyType>
1234RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>&
1235RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator--() {
1240template <
typename MapIterType,
typename ProxyType>
1241RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>
1242RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator--(
int) {
1248template <
typename MapIterType,
typename ProxyType>
1249bool RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator==(
1250 const RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>& rhs)
const {
1251 return m_iterator == rhs.m_iterator;
1254template <
typename MapIterType,
typename ProxyType>
1255bool RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::operator!=(
1256 const RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>& rhs)
const {
1257 return m_iterator != rhs.m_iterator;
1260template <
typename MapIterType,
typename ProxyType>
1262RepositoryIf::MetaData::IteratorImpl<MapIterType, ProxyType>::IteratorImpl(MapIterType&& iter)
1263 : m_iterator(std::forward<MapIterType>(iter)) {
1267 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::iterator,
1269 std::forward<RepositoryIf::
MetaData::MapType::iterator>(iter)) {
1273 RepositoryIf::MetaData::MapType::const_iterator&& iter)
1274 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::const_iterator,
1276 std::forward<RepositoryIf::
MetaData::MapType::const_iterator>(iter)) {
1280 RepositoryIf::MetaData::MapType::reverse_iterator&& iter)
1281 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::reverse_iterator,
1283 std::forward<RepositoryIf::
MetaData::MapType::reverse_iterator>(iter)) {
1287 MapType::const_reverse_iterator&& iter)
1288 : RepositoryIf::
MetaData::IteratorImpl<RepositoryIf::
MetaData::MapType::const_reverse_iterator,
1290 std::forward<RepositoryIf::
MetaData::MapType::const_reverse_iterator>(iter)) {
1293inline RepositoryIf::MetaData::TypeMismatch::Attributes::Attributes(
1294 const std::string& key,
const std::type_info& type_used,
const std::type_info& type_expected)
1295 : m_key(key), m_type_used(type_used), m_type_expected(type_expected) {
1299 return m_metadata.empty();
1303 return m_metadata.size();
1307 return m_metadata.contains(key);
1310template <
typename T>
1312 std::string key_copy = key;
1313 return Insert(std::move(key_copy), std::forward<T>(value));
1316template <
typename T>
1318 using U = std::remove_cv_t<std::remove_reference_t<T>>;
1319 decltype(m_metadata)::iterator iter;
1321 if constexpr (std::is_same_v<U, std::type_info>) {
1323 CheckMetaDataTypeForReservedKeys(key,
typeid(std::reference_wrapper<const std::type_info>));
1324 auto type = std::make_any<std::reference_wrapper<const std::type_info>>(value);
1325 std::tie(iter, inserted) = m_metadata.try_emplace(std::forward<std::string>(key), type);
1327 CheckMetaDataValueType<U>(key);
1328 std::tie(iter, inserted) =
1329 m_metadata.try_emplace(std::forward<std::string>(key), std::forward<T>(value));
1335 throw CII_MAKE_EXCEPTION(
KeyAlreadyExists, std::forward<std::string>(key));
1337 assert(MetaDataKeyValueIsValid(iter->first, iter->second) &&
1339 (
"Metadata was modified in an invalid manner."));
1340 if constexpr (std::is_same_v<U, std::type_info>) {
1341 return std::any_cast<std::reference_wrapper<const std::type_info>>(iter->second).get();
1343 return std::any_cast<U&>(iter->second);
1350 return m_metadata.begin();
1354 return m_metadata.begin();
1358 return m_metadata.cbegin();
1362 return m_metadata.end();
1366 return m_metadata.end();
1370 return m_metadata.cend();
1374 return m_metadata.rbegin();
1378 return m_metadata.rbegin();
1383 return m_metadata.crbegin();
1387 return m_metadata.rend();
1391 return m_metadata.rend();
1395 return m_metadata.crend();
1399template <
typename T>
1402 const T& initial_value,
1403 std::optional<std::reference_wrapper<const MetaData>> metadata,
1410 if (metadata.has_value()) {
1411 merged_metadata = metadata.value();
1413 auto shape = TypeHandler::GetShape(initial_value);
1414 merged_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1415 merged_metadata[
"shape"] = shape;
1417 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1422 using TempBufferType =
typename TypeHandler::TempBufferType;
1424 auto temp_buffer = std::make_shared<TempBufferType>();
1425 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, shape);
1426 if (not buffer_resized) {
1427 throw CII_MAKE_EXCEPTION(
1429 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1430 boost::core::demangle(
typeid(TempBufferType).name())));
1433 TypeHandler::CopyToTempBuffer(initial_value, temp_buffer, 0, count);
1434 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1438 auto cb = [temp_buffer, callback](
const DataPointPath& path)
mutable {
1439 temp_buffer.reset();
1445 using ElementType =
typename TempBufferHandler::ElementType;
1447 path, std::move(span), std::move(merged_metadata), std::move(cb)});
1451 auto span = TypeHandler::MakeSpan(initial_value);
1452 using ElementType =
typename TypeHandler::ElementType;
1454 path, std::move(span), std::move(merged_metadata), callback});
1458template <
typename T>
1462 std::optional<std::reference_wrapper<MetaData>> metadata,
1471 ReadDataPointImpl(path, buffer, metadata, callback);
1474template <
typename T>
1475void RepositoryIf::BatchRequest::ReadDataPointImpl(
1478 std::optional<std::reference_wrapper<MetaData>> metadata,
1480 static_assert(not std::is_same_v<T, std::string_view>,
1481 "It is not possible to read data from a datapoint into a read-only string_view.");
1484 using DataPointType =
typename TypeHandler::DataPointType;
1488 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1489 using TempBufferType =
typename TypeHandler::TempBufferType;
1491 auto temp_buffer = std::make_shared<TempBufferType>();
1501 auto prepare_buffer = [&, temp_buffer](
const MetaData& md) {
1503 assert((md.Contains(
"type")) && (
"Adapter must provide the type in the metadata."));
1505 assert((md.Contains(
"shape")) && (
"Adapter must provide the shape in the metadata."));
1506 if (md[
"type"].Cast<const std::type_info&>() !=
typeid(DataPointType)) {
1510 TypeHandler::ResizeBuffer(buffer, shape);
1511 TempBufferHandler::ResizeBuffer(*temp_buffer, shape);
1514 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1515 CheckSpanSize(span, md);
1522 auto cb = [&, temp_buffer, callback](
const DataPointPath& path)
mutable {
1523 auto shape = TempBufferHandler::GetShape(*temp_buffer);
1525 TypeHandler::CopyFromTempBuffer(buffer, temp_buffer, 0, count);
1526 temp_buffer.reset();
1532 using ElementType =
typename TempBufferHandler::ElementType;
1533 m_requests.push_back(detail::ReadRequest<ElementType>{
1534 path, std::move(prepare_buffer), metadata, std::move(cb)});
1536 auto prepare_buffer = [&](
const MetaData& md) {
1538 assert((md.Contains(
"type")) && (
"Adapter must provide the type in the metadata."));
1540 assert((md.Contains(
"shape")) && (
"Adapter must provide the shape in the metadata."));
1541 if (md[
"type"].Cast<const std::type_info&>() !=
typeid(DataPointType)) {
1542 throw CII_MAKE_EXCEPTION(IncompatibleType,
"Datapoint type mismatch.");
1544 TypeHandler::ResizeBuffer(buffer, md[
"shape"].Cast<RtcVectorUInt64>());
1545 auto span = TypeHandler::MakeSpan(buffer);
1546 CheckSpanSize(span, md);
1550 using ElementType =
typename TypeHandler::ElementType;
1551 m_requests.push_back(
1552 detail::ReadRequest<ElementType>{path, std::move(prepare_buffer), metadata, callback});
1556template <
typename T>
1560 std::optional<std::reference_wrapper<MetaData>> metadata,
1567 if (metadata.has_value()) {
1568 merged_metadata = metadata.value();
1570 auto shape = TypeHandler::GetShape(buffer);
1571 merged_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1572 merged_metadata[
"shape"] = shape;
1574 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1579 using TempBufferType =
typename TypeHandler::TempBufferType;
1581 auto temp_buffer = std::make_shared<TempBufferType>();
1582 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, shape);
1583 if (not buffer_resized) {
1584 throw CII_MAKE_EXCEPTION(
1586 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1587 boost::core::demangle(
typeid(TempBufferType).name())));
1590 TypeHandler::CopyToTempBuffer(buffer, temp_buffer, 0, count);
1591 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1595 auto cb = [temp_buffer, callback](
const DataPointPath& path)
mutable {
1596 temp_buffer.reset();
1602 using ElementType =
typename TempBufferHandler::ElementType;
1604 path, std::move(span), std::move(merged_metadata), metadata, std::move(cb)});
1606 auto span = TypeHandler::MakeSpan(buffer);
1607 using ElementType =
typename TypeHandler::ElementType;
1609 path, std::move(span), std::move(merged_metadata), metadata, callback});
1613template <
typename T>
1620 std::optional<std::reference_wrapper<MetaData>> metadata,
1623 PartialReadDataPointImpl(path, buffer, first, last, d_first, metadata, callback);
1626template <
typename T>
1627void RepositoryIf::BatchRequest::PartialReadDataPointImpl(
1633 std::optional<std::reference_wrapper<MetaData>> metadata,
1639 auto shape = TypeHandler::GetShape(buffer);
1641 size_t expected_size = d_first + last - first;
1642 if (first > last or expected_size > buffer_size) {
1646 "Make sure first <= last and d_first + last - first <= number of "
1647 "elements in the output buffer.");
1650 input_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1651 input_metadata[
"shape"] = shape;
1653 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1661 using TempBufferType =
typename TypeHandler::TempBufferType;
1663 auto temp_buffer = std::make_shared<TempBufferType>();
1664 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, {last - first});
1665 if (not buffer_resized) {
1666 throw CII_MAKE_EXCEPTION(
1667 RepositoryIf::ServiceFailure,
1668 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1669 boost::core::demangle(
typeid(TempBufferType).name())));
1671 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1672 assert((span.size() >= last - first) &&
1674 (
"The temporary buffer was not resized correctly."));
1681 [&, temp_buffer, callback, first, last, d_first](
const DataPointPath& path)
mutable {
1682 TypeHandler::CopyFromTempBuffer(buffer, temp_buffer, d_first, last - first);
1683 temp_buffer.reset();
1689 using ElementType =
typename TempBufferHandler::ElementType;
1690 m_requests.push_back(detail::PartialReadRequest<ElementType>{
1691 path, span, input_metadata, metadata, first, std::move(cb)});
1693 auto span = TypeHandler::MakeSpan(buffer);
1694 using ElementType =
typename TypeHandler::ElementType;
1695 m_requests.push_back(detail::PartialReadRequest<ElementType>{
1696 path, span.subspan(d_first, last - first), input_metadata, metadata, first, callback});
1700template <
typename T>
1707 std::optional<std::reference_wrapper<MetaData>> metadata,
1713 auto shape = TypeHandler::GetShape(buffer);
1715 if (first > last or last > buffer_size) {
1716 throw CII_MAKE_EXCEPTION(
1720 "Make sure first <= last <= number of elements in the input buffer.");
1724 if (metadata.has_value()) {
1725 merged_metadata = metadata.value();
1727 merged_metadata[
"type"] =
typeid(
typename TypeHandler::DataPointType);
1728 merged_metadata[
"shape"] = shape;
1730 if constexpr (TypeHandler::USES_TEMP_BUFFER) {
1737 using TempBufferType =
typename TypeHandler::TempBufferType;
1739 auto temp_buffer = std::make_shared<TempBufferType>();
1740 bool buffer_resized = TempBufferHandler::ResizeBuffer(*temp_buffer, {last - first});
1741 if (not buffer_resized) {
1742 throw CII_MAKE_EXCEPTION(
1744 fmt::format(
"Resizing of a '{}' buffer should have succeeded.",
1745 boost::core::demangle(
typeid(TempBufferType).name())));
1747 TypeHandler::CopyToTempBuffer(buffer, temp_buffer, 0, last - first);
1748 auto span = TempBufferHandler::MakeSpan(*temp_buffer);
1749 assert((span.size() >= last - first) &&
1751 (
"The temporary buffer was not resized correctly."));
1755 auto cb = [temp_buffer, callback](
const DataPointPath& path)
mutable {
1756 temp_buffer.reset();
1762 using ElementType =
typename TempBufferHandler::ElementType;
1764 path, span, std::move(merged_metadata), d_first, metadata, std::move(cb)});
1766 auto span = TypeHandler::MakeSpan(buffer);
1767 using ElementType =
typename TypeHandler::ElementType;
1770 span.subspan(first, last - first),
1771 std::move(merged_metadata),
1783 const std::any& initial_value,
1784 std::optional<std::reference_wrapper<const MetaData>> metadata,
1788void RepositoryIf::BatchRequest::ReadDataPointImpl(
1791 std::optional<std::reference_wrapper<MetaData>> metadata,
1797 const std::any& buffer,
1798 std::optional<std::reference_wrapper<MetaData>> metadata,
1802void RepositoryIf::BatchRequest::PartialReadDataPointImpl(
1808 std::optional<std::reference_wrapper<MetaData>> metadata,
1814 const std::any& buffer,
1818 std::optional<std::reference_wrapper<MetaData>> metadata,
1821template <
typename Rep,
typename Period>
1827 auto maxtime = Clock::now();
1828 maxtime += std::chrono::duration_cast<Clock::duration>(timeout);
1832template <
typename Clk,
typename Duration>
1836 if (response.wait_until(timeout) != std::future_status::ready) {
1846template <
typename T>
1848 static_assert(not std::is_same_v<T, std::any>,
1849 "Cannot create a datapoint using an empty std::any. Datapoint type is unknown.");
1856template <
typename T>
1863template <
typename T>
1869 if constexpr (std::is_same_v<T, std::any>) {
1881template <
typename T>
1886 return std::nullopt;
1889template <
typename T>
1896template <
typename T>
1900 if constexpr (std::is_same_v<T, std::any>) {
1901 if (not buffer.has_value()) {
1914template <
typename T>
1921template <
typename... T>
1923 std::optional<std::reference_wrapper<const DataPointPath>> path_ref;
1927 if constexpr (std::is_same_v<
const DataPointPath&,
decltype(args)>) {
1937template <
typename... T>
1939 std::optional<std::reference_wrapper<const DataPointPath>> path_ref;
1943 if constexpr ((std::is_same_v<T, std::any> or ...)) {
1944 using Entry = std::pair<std::reference_wrapper<std::any>,
MetaData>;
1945 std::vector<Entry> any_buffers;
1948 any_buffers.reserve(
sizeof...(T));
1952 if constexpr (std::is_same_v<
DataPointPath&,
decltype(args)>) {
1954 }
else if constexpr (std::is_same_v<std::any&,
decltype(args)>) {
1955 if (not args.has_value()) {
1956 auto& metadata = any_buffers.emplace_back(Entry(args,
MetaData{})).second;
1957 meta_req.
ReadMetaData(path_ref.value().get(), metadata);
1962 if (not any_buffers.empty()) {
1964 for (
const auto& [buffer, metadata] : any_buffers) {
1973 if constexpr (std::is_same_v<
DataPointPath&,
decltype(args)>) {
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:76
bool IsAbsolutePath() const
Checks whether the path is an absolute path.
Definition dataPointPath.cpp:144
A buffer class representing 2D matrix data.
Definition matrixBuffer.hpp:27
size_type GetNcols() const
Definition matrixBuffer.hpp:88
size_type GetNrows() const
Definition matrixBuffer.hpp:84
constexpr void resize(size_type n, size_type m)
Definition matrixBuffer.hpp:59
A span referencing a 2D matrix buffer.
Definition matrixSpan.hpp:35
size_type GetNrows() const
Definition matrixSpan.hpp:155
size_type GetNcols() const
Definition matrixSpan.hpp:159
An object representing one or more asynchronous I/O requests to a repository.
Definition repositoryIf.hpp:638
RequestList m_requests
Definition repositoryIf.hpp:928
void WriteDataPoint(const DataPointPath &path, const T &buffer, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)
Add request to write a datapoint.
Definition repositoryIf.ipp:1557
void ReadDataPoint(const DataPointPath &path, T &buffer, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr) const
Definition repositoryIf.ipp:1459
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
Add request to partially read a datapoint.
Definition repositoryIf.ipp:1614
void ReadMetaData(const DataPointPath &path, MetaData &metadata, const CallbackType &callback=nullptr) const
Definition repositoryIf.cpp:372
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)
Add request to partially write a datapoint.
Definition repositoryIf.ipp:1701
void CreateDataPoint(const DataPointPath &path, const T &initial_value, std::optional< std::reference_wrapper< const MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)
Add a request to create a new datapoint.
Definition repositoryIf.ipp:1400
void Wait()
Definition repositoryIf.cpp:650
ResponseList m_responses
Definition repositoryIf.hpp:963
bool WaitFor(const std::chrono::duration< Rep, Period > &timeout)
Definition repositoryIf.ipp:1822
bool WaitUntil(const std::chrono::time_point< Clk, Duration > &timeout)
Definition repositoryIf.ipp:1833
Definition repositoryIf.hpp:89
Definition repositoryIf.hpp:77
Definition repositoryIf.hpp:73
Definition repositoryIf.hpp:65
std::optional< T > TryGetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition repositoryIf.ipp:1882
Clock::time_point Timestamp
Definition repositoryIf.hpp:57
void WriteDataPoints(const T &... args)
Definition repositoryIf.ipp:1922
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition repositoryIf.ipp:1864
void ReadDataPoints(T &... args) const
Definition repositoryIf.ipp:1938
void CreateDataPoint(const DataPointPath &path)
Creates a new empty datapoint in the repository.
Definition repositoryIf.ipp:1847
static std::any MakeAnyBuffer(const MetaData &metadata)
Helper method to create an std::any buffer compatible with a specific datapoint.
Definition repositoryIf.cpp:902
void SetDataPoint(const DataPointPath &path, const T &value)
Sets a datapoint in the repository.
Definition repositoryIf.ipp:1890
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition repositoryIf.ipp:1915
BatchResponse SendRequest(const BatchRequest &request)
Definition repositoryIf.cpp:674
void ReadDataPoint(const DataPointPath &path, T &buffer) const
Reads a datapoint from the repository.
Definition repositoryIf.ipp:1897
std::function< void(const DataPointPath &)> CallbackType
Signature of the callback functions that can be registered with the repository requests.
Definition repositoryIf.hpp:60
bool DataPointExists(const DataPointPath &path) const
Checks for the existence of a datapoint in the repository.
Definition repositoryIf.cpp:771
Definition measurable.hpp:25
RtcUInt64 GetNumOfElements(const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:135
void EnsureAbsolutePath(const DataPointPath &path)
Definition repositoryIf.ipp:144
Definition commandReplier.cpp:21
RepositoryIf::MetaData MetaData
Definition oldbAdapter.cpp:57
void to_json(JsonPayload &j, const DataPointPath &v)
Definition dataPointPath.cpp:217
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:24
std::int64_t RtcInt64
Definition basicTypes.hpp:40
std::int16_t RtcInt16
Definition basicTypes.hpp:38
std::uint16_t RtcUInt16
Definition basicTypes.hpp:42
float RtcFloat
Definition basicTypes.hpp:45
std::int32_t RtcInt32
Definition basicTypes.hpp:39
componentFramework::MatrixBuffer< T > RtcMatrix
Definition basicTypes.hpp:34
std::int8_t RtcInt8
Definition basicTypes.hpp:37
std::string RtcString
Definition basicTypes.hpp:47
std::vector< T > RtcVector
Definition basicTypes.hpp:28
bool RtcBool
Definition basicTypes.hpp:36
std::uint32_t RtcUInt32
Definition basicTypes.hpp:43
RtcMatrix< RtcBool > RtcMatrixBool
Definition basicTypes.hpp:61
std::uint8_t RtcUInt8
Definition basicTypes.hpp:41
RtcVector< RtcBool > RtcVectorBool
Definition basicTypes.hpp:49
RtcVector< RtcUInt64 > RtcVectorUInt64
Definition basicTypes.hpp:57
std::uint64_t RtcUInt64
Definition basicTypes.hpp:44
double RtcDouble
Definition basicTypes.hpp:46
Definition ddsSub.hpp:155
Definition repositoryIf.ipp:39
gsl::span< const T > data
Definition repositoryIf.ipp:42
DataPointPath path
Definition repositoryIf.ipp:41
T ElementType
Definition repositoryIf.ipp:40
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:44
RepositoryIf::MetaData metadata
Definition repositoryIf.ipp:43
Definition repositoryIf.ipp:123
DataPointPath link_path
Definition repositoryIf.ipp:125
DataPointPath path
Definition repositoryIf.ipp:124
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:126
Definition repositoryIf.ipp:47
DataPointPath path
Definition repositoryIf.ipp:48
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:49
Definition repositoryIf.ipp:52
DataPointPath path
Definition repositoryIf.ipp:53
bool & result
Definition repositoryIf.ipp:54
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:55
Definition repositoryIf.ipp:58
bool recurse
Definition repositoryIf.ipp:60
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:62
std::pair< RepositoryIf::PathList, RepositoryIf::PathList > & result
Definition repositoryIf.ipp:61
DataPointPath path
Definition repositoryIf.ipp:59
Definition repositoryIf.ipp:90
DataPointPath path
Definition repositoryIf.ipp:92
gsl::span< T > data
Definition repositoryIf.ipp:93
T ElementType
Definition repositoryIf.ipp:91
RepositoryIf::MetaData input_metadata
Definition repositoryIf.ipp:94
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:97
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > output_metadata
Definition repositoryIf.ipp:95
size_t offset
Definition repositoryIf.ipp:96
Definition repositoryIf.ipp:101
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:108
DataPointPath path
Definition repositoryIf.ipp:103
RepositoryIf::MetaData metadata
Definition repositoryIf.ipp:105
gsl::span< const T > data
Definition repositoryIf.ipp:104
size_t offset
Definition repositoryIf.ipp:106
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > output_metadata
Definition repositoryIf.ipp:107
T ElementType
Definition repositoryIf.ipp:102
Definition repositoryIf.ipp:66
T ElementType
Definition repositoryIf.ipp:67
std::function< gsl::span< T >(const RepositoryIf::MetaData &)> PrepareFunctionType
Definition repositoryIf.ipp:68
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > metadata
Definition repositoryIf.ipp:75
PrepareFunctionType prepare_buffer
Definition repositoryIf.ipp:74
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:76
DataPointPath path
Definition repositoryIf.ipp:69
Definition repositoryIf.ipp:129
DataPointPath path
Definition repositoryIf.ipp:130
DataPointPath link_path
Definition repositoryIf.ipp:131
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:132
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:551
MatrixBuffer< T, A > BufferType
Definition repositoryIf.ipp:550
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:556
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:572
void TempBufferType
Definition repositoryIf.ipp:554
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:552
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:576
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:553
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:568
RtcMatrixBool DataPointType
Definition repositoryIf.ipp:590
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:591
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:608
static gsl::span< ElementType > MakeSpan(BufferType &buffer)=delete
Span not constructable from a MatrixBuffer<bool> type.
boost::container::vector< bool > TempBufferType
Definition repositoryIf.ipp:592
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:617
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:589
static void CopyFromTempBuffer(BufferType &buffer, const std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:628
MatrixBuffer< bool, A > BufferType
Definition repositoryIf.ipp:588
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:594
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:648
void TempBufferType
Definition repositoryIf.ipp:646
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:660
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:668
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:643
MatrixSpan< T > BufferType
Definition repositoryIf.ipp:642
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:645
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:664
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:644
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:872
void TempBufferType
Definition repositoryIf.ipp:873
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:892
std::remove_cv_t< T > ElementType
Definition repositoryIf.ipp:870
T[N][M] BufferType
Definition repositoryIf.ipp:869
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:875
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:897
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:871
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:887
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:820
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:800
T[N] BufferType
Definition repositoryIf.ipp:797
void TempBufferType
Definition repositoryIf.ipp:801
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:799
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:803
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:824
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:816
std::remove_cv_t< T > ElementType
Definition repositoryIf.ipp:798
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:445
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:424
void TempBufferType
Definition repositoryIf.ipp:426
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:449
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:423
boost::container::vector< T, A > BufferType
Definition repositoryIf.ipp:422
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:428
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:441
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:425
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:850
RtcString DataPointType
Definition repositoryIf.ipp:838
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:846
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:854
void TempBufferType
Definition repositoryIf.ipp:840
char ElementType
Definition repositoryIf.ipp:837
char[N] BufferType
Definition repositoryIf.ipp:836
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:839
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:842
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:484
void TempBufferType
Definition repositoryIf.ipp:465
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:467
gsl::span< T, N > BufferType
Definition repositoryIf.ipp:461
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:462
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:463
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:488
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:480
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:464
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:501
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:514
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:510
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:518
gsl::span< char, N > BufferType
Definition repositoryIf.ipp:500
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:503
void TempBufferType
Definition repositoryIf.ipp:504
RtcString DataPointType
Definition repositoryIf.ipp:502
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:506
void TempBufferType
Definition repositoryIf.ipp:529
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:539
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:543
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:526
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:528
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:535
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:531
RtcString DataPointType
Definition repositoryIf.ipp:527
gsl::span< const char, N > BufferType
Definition repositoryIf.ipp:525
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:683
std::array< T, N > BufferType
Definition repositoryIf.ipp:680
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:707
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:703
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:682
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:699
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:686
void TempBufferType
Definition repositoryIf.ipp:684
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:681
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:725
void TempBufferType
Definition repositoryIf.ipp:723
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:722
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:737
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:733
std::array< char, N > BufferType
Definition repositoryIf.ipp:719
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:720
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:729
RtcString DataPointType
Definition repositoryIf.ipp:721
RtcMatrix< ElementType > DataPointType
Definition repositoryIf.ipp:751
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:767
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:755
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:779
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:752
std::remove_cv_t< T > ElementType
Definition repositoryIf.ipp:750
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:773
void TempBufferType
Definition repositoryIf.ipp:753
std::array< std::array< T, M >, N > BufferType
Definition repositoryIf.ipp:749
std::string BufferType
Definition repositoryIf.ipp:267
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:273
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:277
void TempBufferType
Definition repositoryIf.ipp:271
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:270
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:285
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:281
RtcString DataPointType
Definition repositoryIf.ipp:269
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:268
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:303
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:317
RtcString DataPointType
Definition repositoryIf.ipp:299
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:300
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:301
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:312
std::string_view BufferType
Definition repositoryIf.ipp:297
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:298
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:330
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:335
static gsl::span< ElementType > MakeSpan(BufferType &buffer)
Definition repositoryIf.ipp:348
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:332
RtcVector< ElementType > DataPointType
Definition repositoryIf.ipp:331
std::vector< T, A > BufferType
Definition repositoryIf.ipp:329
void TempBufferType
Definition repositoryIf.ipp:333
static gsl::span< const ElementType > MakeSpan(const BufferType &buffer)
Definition repositoryIf.ipp:352
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:356
static const bool USES_TEMP_BUFFER
Definition repositoryIf.ipp:371
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:372
static void CopyFromTempBuffer(BufferType &buffer, const std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:408
RtcVectorBool DataPointType
Definition repositoryIf.ipp:370
std::remove_cv_t< typename BufferType::value_type > ElementType
Definition repositoryIf.ipp:369
std::vector< bool, A > BufferType
Definition repositoryIf.ipp:368
static RtcVectorUInt64 GetShape(const BufferType &buffer)
Definition repositoryIf.ipp:374
static void CopyToTempBuffer(const BufferType &buffer, std::shared_ptr< TempBufferType > &temp_buffer, size_t offset, size_t count)
Definition repositoryIf.ipp:397
static bool ResizeBuffer(BufferType &buffer, const RtcVectorUInt64 &shape)
Definition repositoryIf.ipp:388
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:219
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:80
RepositoryIf::MetaData metadata
Definition repositoryIf.ipp:84
DataPointPath path
Definition repositoryIf.ipp:82
gsl::span< const T > data
Definition repositoryIf.ipp:83
std::optional< std::reference_wrapper< RepositoryIf::MetaData > > output_metadata
Definition repositoryIf.ipp:85
T ElementType
Definition repositoryIf.ipp:81
RepositoryIf::CallbackType callback
Definition repositoryIf.ipp:86
Provides useful mechanisms to test various type traits.