RTC Toolkit 6.0.0-pre2
Loading...
Searching...
No Matches
repositoryIf.hpp
Go to the documentation of this file.
1
12
13#ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
14#define RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
15
16#include <any>
17#include <chrono>
18#include <exception>
19#include <functional>
20#include <future>
21#include <initializer_list>
22#include <map>
23#include <memory>
24#include <optional>
25#include <type_traits>
26#include <vector>
27
28#include <gsl/span>
29
30#include <taiclock/taiClock.hpp>
31
32#include <rtctk/basicTypes.hpp>
33#include <rtctk/config.hpp>
34
39
41
52protected:
53 using RequestList = std::vector<std::any>;
54
55public:
56 using PathList = std::vector<DataPointPath>;
57 using Clock = taiclock::TaiClock;
58 using Timestamp = Clock::time_point;
59
61 using CallbackType = std::function<void(const DataPointPath&)>;
62
63 RepositoryIf() = default;
64 virtual ~RepositoryIf() = default;
65
66 class RTCTK_API ServiceFailure : public RtctkException {
68 };
69
70 class RTCTK_API UnsupportedType : public UnsupportedTypeException {
72 };
73
74 class RTCTK_API IncompatibleType : public RtctkException {
76 };
77
78 class RTCTK_API DataPointPathNotAbsolute : public RtctkException {
80 };
81
82 class RTCTK_API DataPointDoesNotExist : public RtctkException {
84 };
85
86 class RTCTK_API DataPointAlreadyExists : public RtctkException {
88 };
89
94
95 class RTCTK_API AccessOutOfBounds : public RtctkException {
97 };
98
99 class RTCTK_API OperationNotAllowed : public RtctkException {
101 };
102
104 public:
105 enum class Status : uint8_t { Success, Failed, Skipped };
106
107 struct Info {
109 std::exception_ptr exception;
110 };
111
112 MultipleRequestsFailed(const std::vector<Info>& info);
113 const std::vector<Info>& GetInfo() const;
114
115 private:
116 static RTCTK_LOCAL std::string InfoToString(const std::vector<Info>& info);
117 // Note that using shared_ptr makes the exception's copy constructor noexcept.
118 std::shared_ptr<std::vector<Info>> m_info;
119 };
120
146 class RTCTK_API MetaData final {
147 public:
155 public:
156 ConstValueProxy() = delete;
157 ConstValueProxy(const ConstValueProxy& rhs) = default;
159 ~ConstValueProxy() = default;
160
166 inline bool HasValue() const noexcept;
167
172 const std::type_info& GetValueType() const noexcept;
173
178 inline operator const std::any&() const;
179
187 template <typename T>
188 const T& Cast() const;
189
190 private:
191 friend MetaData;
192
193 RTCTK_LOCAL inline ConstValueProxy(const std::string& key, const std::any& value);
194
196 const std::string& m_key;
197
199 const std::any& m_value;
200 };
201
208 class RTCTK_API ValueProxy final {
209 public:
210 ValueProxy() = delete;
211 ValueProxy(const ValueProxy& rhs) = default;
212 ValueProxy(ValueProxy&& rhs) = default;
213 ~ValueProxy() = default;
214
220 inline bool HasValue() const noexcept;
221
226 const std::type_info& GetValueType() const noexcept;
227
232 inline operator const std::any&() const;
233
241 template <typename T>
242 T& Cast();
243
251 template <typename T>
252 const T& Cast() const;
253
261 ValueProxy& operator=(const ValueProxy& rhs);
262
273 template <typename T>
274 ValueProxy& operator=(T&& rhs);
275
281 inline void Reset() noexcept;
282
283 private:
284 friend MetaData;
285
286 RTCTK_LOCAL inline ValueProxy(const std::string& key, std::any& value);
287
289 const std::string& m_key;
290
292 std::any& m_value;
293 };
294
295 private:
296 using MapType = std::map<std::string, std::any>;
297
305 template <typename MapIterType, typename ProxyType>
306 class RTCTK_LOCAL IteratorImpl {
307 public:
308 using iterator_concept = std::bidirectional_iterator_tag;
309 using iterator_category = std::bidirectional_iterator_tag;
310 using value_type = std::pair<const MapType::key_type&, ProxyType>;
311 using difference_type = MapType::difference_type;
312 using pointer = void;
313 using reference = std::conditional_t<std::is_same_v<ProxyType, ConstValueProxy>,
314 const value_type&,
315 value_type&>;
316
317 IteratorImpl() = default;
318 IteratorImpl(const IteratorImpl& rhs) = default;
319 IteratorImpl(IteratorImpl&& rhs) noexcept = default;
320 ~IteratorImpl() = default;
321 IteratorImpl& operator=(const IteratorImpl& rhs) = default;
322 IteratorImpl& operator=(IteratorImpl&& rhs) noexcept = default;
323 value_type& operator*();
324 value_type operator*() const;
325 value_type* operator->();
326 const value_type* operator->() const;
327 IteratorImpl& operator++();
328 IteratorImpl operator++(int);
329 IteratorImpl& operator--();
330 IteratorImpl operator--(int);
331 bool operator==(const IteratorImpl& rhs) const;
332 bool operator!=(const IteratorImpl& rhs) const;
333
334 protected:
335 RTCTK_LOCAL IteratorImpl(MapIterType&& iter);
336
337 MapIterType m_iterator; // The underlying map iterator.
338
343 std::optional<value_type> m_pair;
344 };
345
346 public:
350 class RTCTK_API Iterator final : public IteratorImpl<MapType::iterator, ValueProxy> {
351 private:
352 friend MetaData;
353 RTCTK_LOCAL inline Iterator(MapType::iterator&& iter);
354 };
355
360 class RTCTK_API ConstIterator final
361 : public IteratorImpl<MapType::const_iterator, ConstValueProxy> {
362 private:
363 friend MetaData;
364 RTCTK_LOCAL inline ConstIterator(MapType::const_iterator&& iter);
365 };
366
370 class RTCTK_API ReverseIterator final
371 : public IteratorImpl<MapType::reverse_iterator, ValueProxy> {
372 private:
373 friend MetaData;
374 RTCTK_LOCAL inline ReverseIterator(MapType::reverse_iterator&& iter);
375 };
376
381 class RTCTK_API ConstReverseIterator final
382 : public IteratorImpl<MapType::const_reverse_iterator, ConstValueProxy> {
383 private:
384 friend MetaData;
385 RTCTK_LOCAL inline ConstReverseIterator(MapType::const_reverse_iterator&& iter);
386 };
387
392 public:
393 explicit KeyDoesNotExist(const std::string& key);
394 const std::string& GetKey() const;
395
396 private:
397 std::shared_ptr<std::string> m_key;
398 };
399
404 public:
405 explicit KeyAlreadyExists(const std::string& key);
406 const std::string& GetKey() const;
407
408 private:
409 std::shared_ptr<std::string> m_key;
410 };
411
417 public:
418 explicit TypeMismatch(const std::string& key,
419 const std::type_info& type_used,
420 const std::type_info& type_expected);
421 const std::string& GetKey() const;
422 const std::type_info& GetTypeUsed() const;
423 const std::type_info& GetTypeExpected() const;
424
425 private:
426 struct RTCTK_LOCAL Attributes {
427 inline Attributes(const std::string& key,
428 const std::type_info& type_used,
429 const std::type_info& type_expected);
430 std::string m_key;
431 std::reference_wrapper<const std::type_info> m_type_used;
432 std::reference_wrapper<const std::type_info> m_type_expected;
433 };
434 // Note that using shared_ptr makes the exception's copy constructor noexcept.
435 std::shared_ptr<Attributes> m_attribs;
436 };
437
445
446 MetaData() = default;
447 MetaData(const MetaData& rhs) = default;
448 MetaData(MetaData&& rhs) = default;
449 MetaData(std::initializer_list<std::pair<std::string, std::any>> init_list);
450 ~MetaData() = default;
451 MetaData& operator=(const MetaData& rhs) = default;
452 MetaData& operator=(MetaData&& rhs) = default;
453
458 inline bool Empty() const;
459
464 inline size_t GetSize() const noexcept;
465
471 inline bool Contains(const std::string& key) const;
472
479 ValueProxy Insert(const std::string& key);
480
487 ValueProxy Insert(std::string&& key);
488
497 template <typename T>
498 auto& Insert(const std::string& key, T&& value);
499
508 template <typename T>
509 auto& Insert(std::string&& key, T&& value);
510
516 bool Remove(const std::string& key);
517
523 ValueProxy operator[](const std::string& key);
524
530 ValueProxy operator[](std::string&& key);
531
538 ConstValueProxy operator[](const std::string& key) const;
539
544 void Merge(const MetaData& source);
545
555 void Merge(MetaData&& source);
556
557 // The following methods are for STL compatibility and therefore must use lower case.
558 // NOLINTBEGIN(readability-identifier-naming)
562 inline Iterator begin();
563
567 inline ConstIterator begin() const;
568
572 inline ConstIterator cbegin() const noexcept;
573
577 inline Iterator end();
578
582 inline ConstIterator end() const;
583
587 inline ConstIterator cend() const noexcept;
588
592 inline ReverseIterator rbegin();
593
597 inline ConstReverseIterator rbegin() const;
598
602 inline ConstReverseIterator crbegin() const noexcept;
603
607 inline ReverseIterator rend();
608
612 inline ConstReverseIterator rend() const;
613
617 inline ConstReverseIterator crend() const noexcept;
618 // NOLINTEND(readability-identifier-naming)
619
620 private:
621 friend RepositoryIf;
622
623 // We are using an std::map because it is often faster to copy/manipulate for a small number
624 // of keys compared to std::unordered_map.
625 MapType m_metadata;
626 };
627
635 public:
636 virtual ~BatchRequest() = default;
637
662 template <typename T>
663 void CreateDataPoint(
664 const DataPointPath& path,
665 const T& initial_value,
666 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
667 const CallbackType& callback = nullptr);
668
672 template <typename T>
674 const DataPointPath& path,
675 const T&& initial_value,
676 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
677 const CallbackType& callback = nullptr) = delete;
678
679 void DeleteDataPoint(const DataPointPath& path, const CallbackType& callback = nullptr);
680
681 void DataPointExists(const DataPointPath& path,
682 bool& result,
683 const CallbackType& callback = nullptr) const;
684
716 void GetChildren(const DataPointPath& path,
717 std::pair<PathList, PathList>& result,
718 bool recurse = false,
719 const CallbackType& callback = nullptr) const;
720
724 void GetChildren(const DataPointPath& path,
725 std::pair<PathList, PathList>&& result,
726 bool recurse = false,
727 const CallbackType& callback = nullptr) const = delete;
728
729 template <typename T>
730 void ReadDataPoint(const DataPointPath& path,
731 T& buffer,
732 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
733 const CallbackType& callback = nullptr) const;
734
738 template <typename T>
739 void ReadDataPoint(const DataPointPath& path,
740 T&& buffer,
741 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
742 const CallbackType& callback = nullptr) const = delete;
743
767 template <typename T>
768 void WriteDataPoint(const DataPointPath& path,
769 const T& buffer,
770 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
771 const CallbackType& callback = nullptr);
772
776 template <typename T>
778 const T&& buffer,
779 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
780 const CallbackType& callback = nullptr) = delete;
781
818 template <typename T>
820 const DataPointPath& path,
821 T& buffer,
822 size_t first,
823 size_t last,
824 size_t d_first,
825 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
826 const CallbackType& callback = nullptr) const;
827
831 template <typename T>
833 const DataPointPath& path,
834 T&& buffer,
835 size_t first,
836 size_t last,
837 size_t d_first,
838 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
839 const CallbackType& callback = nullptr) const = delete;
840
874 template <typename T>
876 const DataPointPath& path,
877 const T& buffer,
878 size_t first,
879 size_t last,
880 size_t d_first,
881 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
882 const CallbackType& callback = nullptr);
883
887 template <typename T>
889 const DataPointPath& path,
890 const T&& buffer,
891 size_t first,
892 size_t last,
893 size_t d_first,
894 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
895 const CallbackType& callback = nullptr) = delete;
896
897 void ReadMetaData(const DataPointPath& path,
898 MetaData& metadata,
899 const CallbackType& callback = nullptr) const;
900
904 void ReadMetaData(const DataPointPath& path,
905 MetaData&& metadata,
906 const CallbackType& callback = nullptr) const = delete;
907
908 void WriteMetaData(const DataPointPath& path,
909 const MetaData& metadata,
910 const CallbackType& callback = nullptr);
911
912 void CreateSymlink(const DataPointPath& dp,
913 const DataPointPath& link,
914 const CallbackType& callback = nullptr);
915
916 void UpdateSymlink(const DataPointPath& dp,
917 const DataPointPath& link,
918 const CallbackType& callback = nullptr);
919
920 protected:
923
924 private:
925 template <typename T>
926 void ReadDataPointImpl(const DataPointPath& path,
927 T& buffer,
928 std::optional<std::reference_wrapper<MetaData>> metadata,
929 const CallbackType& callback) const;
930
931 template <typename T>
932 void PartialReadDataPointImpl(const DataPointPath& path,
933 T& buffer,
934 size_t first,
935 size_t last,
936 size_t d_first,
937 std::optional<std::reference_wrapper<MetaData>> metadata,
938 const CallbackType& callback) const;
939 };
940
942 public:
943 using ResponseList = std::vector<std::future<void>>;
944
946
947 // await all
948 void Wait();
949
950 template <typename Rep, typename Period>
951 bool WaitFor(const std::chrono::duration<Rep, Period>& timeout);
952
953 template <typename Clk, typename Duration>
954 bool WaitUntil(const std::chrono::time_point<Clk, Duration>& timeout);
955
956 protected:
958 };
959
960 BatchResponse SendRequest(const BatchRequest& request);
961 BatchResponse SendRequest(const BatchRequest& request) const;
962
963 // The following are synchronous convenience methods.
964
977 template <typename T>
978 void CreateDataPoint(const DataPointPath& path);
979
993 template <typename T>
994 void CreateDataPoint(const DataPointPath& path, const T& initial_value);
995
996 void CreateDataPoint(const DataPointPath& path, const char* initial_value);
997
1007 void DeleteDataPoint(const DataPointPath& path, bool recurse = false);
1008
1022 const std::type_info& GetDataPointType(const DataPointPath& path) const;
1023
1045 size_t GetDataPointSize(const DataPointPath& path) const;
1046
1072
1082 bool DataPointExists(const DataPointPath& path) const;
1083
1112 std::pair<PathList, PathList>
1113 GetChildren(const DataPointPath& path, bool recurse = false) const;
1114
1129 template <typename T>
1130 T GetDataPoint(const DataPointPath& path) const;
1131
1146 template <typename T>
1147 std::optional<T> TryGetDataPoint(const DataPointPath& path) const;
1148
1163 template <typename T>
1164 void SetDataPoint(const DataPointPath& path, const T& value);
1165
1166 void SetDataPoint(const DataPointPath& path, const char* value);
1167
1183 template <typename T>
1184 void ReadDataPoint(const DataPointPath& path, T& buffer) const;
1185
1204 template <typename T>
1205 void WriteDataPoint(const DataPointPath& path, const T& buffer);
1206
1207 void WriteDataPoint(const DataPointPath& path, const char* buffer);
1208
1209 template <typename... T>
1210 void WriteDataPoints(const T&... args);
1211
1212 template <typename... T>
1213 void ReadDataPoints(T&... args) const;
1214
1222 static const std::type_info& StringToType(const std::string& arg);
1223
1231 static std::string TypeToString(const std::type_info& arg);
1232
1242 static std::any MakeAnyBuffer(const MetaData& metadata);
1243
1244protected:
1245 virtual BatchResponse ProcessRequests(const RequestList& requests) = 0;
1246};
1247
1248} // namespace rtctk::componentFramework
1249
1251
1252#endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
Header file for basic type aliases.
The BufferTooSmall is thrown when an API call fails because the provided buffer is not big enough to ...
Definition exceptions.hpp:266
BufferTooSmall(const std::size_t actual, const std::size_t expected)
Construct exception object.
Definition exceptions.cpp:159
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:77
An object representing one or more asynchronous I/O requests to a repository.
Definition repositoryIf.hpp:634
void DataPointExists(const DataPointPath &path, bool &result, const CallbackType &callback=nullptr) const
Definition repositoryIf.cpp:349
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 =delete
Reading from a datapoint into an rvalue reference is not allowed.
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 GetChildren(const DataPointPath &path, std::pair< PathList, PathList > &&result, bool recurse=false, const CallbackType &callback=nullptr) const =delete
Querying children with an rvalue reference for the result is not allowed.
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)=delete
Writing to a datapoint from an rvalue reference is not allowed.
void DeleteDataPoint(const DataPointPath &path, const CallbackType &callback=nullptr)
Definition repositoryIf.cpp:343
void WriteDataPoint(const DataPointPath &path, const T &&buffer, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)=delete
Writing to a datapoint from an rvalue reference is not allowed.
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 GetChildren(const DataPointPath &path, std::pair< PathList, PathList > &result, bool recurse=false, const CallbackType &callback=nullptr) const
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 CreateDataPoint(const DataPointPath &path, const T &&initial_value, std::optional< std::reference_wrapper< const MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)=delete
Creation of datapoints from an rvalue reference is not allowed.
void ReadDataPoint(const DataPointPath &path, T &&buffer, std::optional< std::reference_wrapper< MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr) const =delete
Reading from a datapoint into an rvalue reference is not allowed.
void ReadMetaData(const DataPointPath &path, MetaData &metadata, const CallbackType &callback=nullptr) const
Definition repositoryIf.cpp:367
void CreateSymlink(const DataPointPath &dp, const DataPointPath &link, const CallbackType &callback=nullptr)
Definition repositoryIf.cpp:383
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 ReadMetaData(const DataPointPath &path, MetaData &&metadata, const CallbackType &callback=nullptr) const =delete
Reading metadata into an rvalue reference is not allowed.
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
friend RepositoryIf
Definition repositoryIf.hpp:921
void UpdateSymlink(const DataPointPath &dp, const DataPointPath &link, const CallbackType &callback=nullptr)
Definition repositoryIf.cpp:392
void WriteMetaData(const DataPointPath &path, const MetaData &metadata, const CallbackType &callback=nullptr)
Definition repositoryIf.cpp:375
std::vector< std::future< void > > ResponseList
Definition repositoryIf.hpp:943
void Wait()
Definition repositoryIf.cpp:645
ResponseList m_responses
Definition repositoryIf.hpp:957
BatchResponse(ResponseList futures)
Definition repositoryIf.cpp:641
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
BufferTooSmall(const std::size_t actual, const std::size_t expected)
Construct exception object.
Definition exceptions.cpp:159
Constant version of the bidirectional forward iterator returned by the cbegin/cend methods.
Definition repositoryIf.hpp:361
Constant version of the bidirectional reverse iterator returned by the crbegin/crend methods.
Definition repositoryIf.hpp:382
A read-only interface class to an underlying metadata value.
Definition repositoryIf.hpp:154
bool HasValue() const noexcept
Check if a value was assigned to the metadata value.
Definition repositoryIf.ipp:1077
const std::type_info & GetValueType() const noexcept
Get the type of the metadata value stored.
Definition repositoryIf.cpp:212
const T & Cast() const
Cast the value to the given C++ type.
Definition repositoryIf.ipp:1086
Bidirectional forward iterator returned by the begin/end methods.
Definition repositoryIf.hpp:350
KeyAlreadyExists(const std::string &key)
Definition repositoryIf.cpp:180
const std::string & GetKey() const
Definition repositoryIf.cpp:185
const std::string & GetKey() const
Definition repositoryIf.cpp:176
KeyDoesNotExist(const std::string &key)
Definition repositoryIf.cpp:171
Bidirectional reverse iterator returned by the rbegin/rend methods.
Definition repositoryIf.hpp:371
TypeMismatch(const std::string &key, const std::type_info &type_used, const std::type_info &type_expected)
Definition repositoryIf.cpp:189
const std::type_info & GetTypeExpected() const
Definition repositoryIf.cpp:208
const std::type_info & GetTypeUsed() const
Definition repositoryIf.cpp:204
const std::string & GetKey() const
Definition repositoryIf.cpp:200
Exception indicating that an unsupported type was used for the metadata value.
Definition repositoryIf.hpp:441
UnsupportedTypeException(const std::string &type)
Definition exceptions.cpp:131
Interface class to an underlying metadata value.
Definition repositoryIf.hpp:208
ValueProxy & operator=(const ValueProxy &rhs)
Assign a new value to this object from an existing metadata value.
Definition repositoryIf.cpp:229
bool HasValue() const noexcept
Check if a value was assigned to the metadata value.
Definition repositoryIf.ipp:1100
void Reset() noexcept
Delete the value assigned to this metadata value.
Definition repositoryIf.ipp:1170
T & Cast()
Cast the value to the given C++ type.
Definition repositoryIf.ipp:1109
const std::type_info & GetValueType() const noexcept
Get the type of the metadata value stored.
Definition repositoryIf.cpp:220
Class for passing/receiving metadata to/from the repository.
Definition repositoryIf.hpp:146
ConstIterator cbegin() const noexcept
Return a read-only forward iterator to the beginning of the metadata entries.
Definition repositoryIf.ipp:1342
MetaData & operator=(const MetaData &rhs)=default
ValueProxy Insert(const std::string &key)
Add a new metadata key.
Definition repositoryIf.cpp:244
MetaData & operator=(MetaData &&rhs)=default
size_t GetSize() const noexcept
Get the number of entries in the metadata.
Definition repositoryIf.ipp:1288
Iterator end()
Return a forward iterator to the end of the metadata entries.
Definition repositoryIf.ipp:1346
ReverseIterator rbegin()
Return a reverse iterator to the beginning of the metadata entries.
Definition repositoryIf.ipp:1358
Iterator begin()
Return a forward iterator to the beginning of the metadata entries.
Definition repositoryIf.ipp:1334
ConstReverseIterator crend() const noexcept
Return a read-only reverse iterator to the end of the metadata entries.
Definition repositoryIf.ipp:1379
bool Remove(const std::string &key)
Remove a metadata key.
Definition repositoryIf.cpp:262
ConstReverseIterator crbegin() const noexcept
Return a read-only reverse iterator to the beginning of the metadata entries.
Definition repositoryIf.ipp:1367
bool Empty() const
Check if the metadata contains any values.
Definition repositoryIf.ipp:1284
ReverseIterator rend()
Return a reverse iterator to the end of the metadata entries.
Definition repositoryIf.ipp:1371
bool Contains(const std::string &key) const
Check if the metadata contains a specific key.
Definition repositoryIf.ipp:1292
ConstIterator cend() const noexcept
Return a read-only forward iterator to the end of the metadata entries.
Definition repositoryIf.ipp:1354
void Merge(const MetaData &source)
Merge entries from the source metadata object into this one.
Definition repositoryIf.cpp:294
const std::vector< Info > & GetInfo() const
Definition repositoryIf.cpp:140
MultipleRequestsFailed(const std::vector< Info > &info)
Definition repositoryIf.cpp:135
static const std::type_info & StringToType(const std::string &arg)
Converts an RTC datapoint type string to a type_info.
Definition repositoryIf.cpp:881
virtual BatchResponse ProcessRequests(const RequestList &requests)=0
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
static std::string TypeToString(const std::type_info &arg)
Converts a type_info to an RTC datapoint type string.
Definition repositoryIf.cpp:889
void ReadDataPoints(T &... args) const
Definition repositoryIf.ipp:1917
size_t GetDataPointSize(const DataPointPath &path) const
Fetches the size of the datapoint's data.
Definition repositoryIf.cpp:702
void CreateDataPoint(const DataPointPath &path)
Creates a new empty datapoint in the repository.
Definition repositoryIf.ipp:1826
std::pair< PathList, PathList > GetChildren(const DataPointPath &path, bool recurse=false) const
Queries the child datapoints and paths for a given parent path.
Definition repositoryIf.cpp:775
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
taiclock::TaiClock Clock
Definition repositoryIf.hpp:57
RtcVectorUInt64 GetDataPointShape(const DataPointPath &path) const
Fetches the shape of the datapoint's data.
Definition repositoryIf.cpp:757
std::vector< std::any > RequestList
Definition repositoryIf.hpp:53
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition repositoryIf.ipp:1894
std::vector< DataPointPath > PathList
Definition repositoryIf.hpp:56
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
const std::type_info & GetDataPointType(const DataPointPath &path) const
Fetches the type of the datapoint.
Definition repositoryIf.cpp:693
void DeleteDataPoint(const DataPointPath &path, bool recurse=false)
Deletes a datapoint.
Definition repositoryIf.cpp:678
bool DataPointExists(const DataPointPath &path) const
Checks for the existence of a datapoint in the repository.
Definition repositoryIf.cpp:766
RtctkException() noexcept
Definition exceptions.cpp:113
UnsupportedTypeException(const std::string &type)
Definition exceptions.cpp:131
Project-wide configuration header.
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:60
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:33
Header file for DataPointPath.
Provides macros and utilities for exception handling.
Declaration of the MatrixBuffer template class used in APIs.
Declaration of the MatrixSpan template class used in APIs.
Definition commandReplier.cpp:22
bool operator==(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:368
constexpr bool operator!=(const MatrixBuffer< T, A > &lhs, const MatrixBuffer< T, A > &rhs) noexcept
Compares two MatrixBuffer objects and returns true if they do not have the same shape or the elements...
Definition matrixBuffer.hpp:117
RtcVector< RtcUInt64 > RtcVectorUInt64
Definition basicTypes.hpp:58
Definition ddsSub.hpp:156
Implementation file for RepositoryIf template methods and related classes.
std::exception_ptr exception
Definition repositoryIf.hpp:109