RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
repositoryIf.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
14#define RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
15
20#include <rtctk/config.hpp>
21
22#include <taiclock/taiClock.hpp>
23
24// FIXME: Add back when we start using CiiMatrix2D.
25// #include <common/datatypes/ciiMatrix2D.hpp>
26
27#include <gsl/span>
28
29#include <any>
30#include <chrono>
31#include <cstdint>
32#include <exception>
33#include <functional>
34#include <future>
35#include <initializer_list>
36#include <map>
37#include <memory>
38#include <optional>
39#include <type_traits>
40#include <vector>
41
42namespace rtctk {
43
44template <typename T>
45using RtcVector = std::vector<T>;
46
47// FIXME: Switch to using CII type for the matrix when we have ported to DevEnv 6.
48// template <typename T>
49// using RtcMatrix = elt::common::datatypes::CiiMatrix2D<T>;
50template <typename T>
52
53using RtcBool = bool;
54using RtcInt8 = int8_t;
55using RtcInt16 = int16_t;
56using RtcInt32 = int32_t;
57using RtcInt64 = int64_t;
58using RtcUInt8 = uint8_t;
59using RtcUInt16 = uint16_t;
60using RtcUInt32 = uint32_t;
61using RtcUInt64 = uint64_t;
62using RtcFloat = float;
63using RtcDouble = double;
64using RtcString = std::string;
65using RtcBinary = std::vector<std::byte>;
90
91} // namespace rtctk
92
94
105protected:
106 using RequestList = std::vector<std::any>;
107
108public:
109 using PathList = std::vector<DataPointPath>;
110 using Clock = taiclock::TaiClock;
111 using Timestamp = Clock::time_point;
112
114 using CallbackType = std::function<void(const DataPointPath&)>;
115
116 RepositoryIf() = default;
117 virtual ~RepositoryIf() = default;
118
120 using RtctkException::RtctkException;
121 };
122
124 using UnsupportedTypeException::UnsupportedTypeException;
125 };
126
128 using RtctkException::RtctkException;
129 };
130
132 using RtctkException::RtctkException;
133 };
134
136 using RtctkException::RtctkException;
137 };
138
143
145 using RtctkException::RtctkException;
146 };
147
149 using RtctkException::RtctkException;
150 };
151
153 public:
154 enum class Status : uint8_t { Success, Failed, Skipped };
155
156 struct Info {
158 std::exception_ptr exception;
159 };
160
161 MultipleRequestsFailed(const std::vector<Info>& info);
162 const std::vector<Info>& GetInfo() const;
163
164 private:
165 static RTCTK_LOCAL std::string InfoToString(const std::vector<Info>& info);
166 // Note that using shared_ptr makes the exception's copy constructor noexcept.
167 std::shared_ptr<std::vector<Info>> m_info;
168 };
169
195 class RTCTK_API MetaData final {
196 public:
204 public:
205 ConstValueProxy() = delete;
206 ConstValueProxy(const ConstValueProxy& rhs) = default;
208 ~ConstValueProxy() = default;
209
215 inline bool HasValue() const noexcept;
216
221 const std::type_info& GetValueType() const noexcept;
222
227 inline operator const std::any&() const;
228
236 template <typename T>
237 const T& Cast() const;
238
239 private:
240 friend MetaData;
241
242 RTCTK_LOCAL inline ConstValueProxy(const std::string& key, const std::any& value);
243
245 const std::string& m_key;
246
248 const std::any& m_value;
249 };
250
257 class RTCTK_API ValueProxy final {
258 public:
259 ValueProxy() = delete;
260 ValueProxy(const ValueProxy& rhs) = default;
261 ValueProxy(ValueProxy&& rhs) = default;
262 ~ValueProxy() = default;
263
269 inline bool HasValue() const noexcept;
270
275 const std::type_info& GetValueType() const noexcept;
276
281 inline operator const std::any&() const;
282
290 template <typename T>
291 T& Cast();
292
300 template <typename T>
301 const T& Cast() const;
302
310 ValueProxy& operator=(const ValueProxy& rhs);
311
322 template <typename T>
323 ValueProxy& operator=(T&& rhs);
324
330 inline void Reset() noexcept;
331
332 private:
333 friend MetaData;
334
335 RTCTK_LOCAL inline ValueProxy(const std::string& key, std::any& value);
336
338 const std::string& m_key;
339
341 std::any& m_value;
342 };
343
344 private:
345 using MapType = std::map<std::string, std::any>;
346
354 template <typename MapIterType, typename ProxyType>
355 class RTCTK_LOCAL IteratorImpl {
356 public:
357 using iterator_concept = std::bidirectional_iterator_tag;
358 using iterator_category = std::bidirectional_iterator_tag;
359 using value_type = std::pair<const MapType::key_type&, ProxyType>;
360 using difference_type = MapType::difference_type;
361 using pointer = void;
362 using reference = std::conditional_t<std::is_same_v<ProxyType, ConstValueProxy>,
363 const value_type&,
364 value_type&>;
365
366 IteratorImpl() = default;
367 IteratorImpl(const IteratorImpl& rhs) = default;
368 IteratorImpl(IteratorImpl&& rhs) noexcept = default;
369 ~IteratorImpl() = default;
370 IteratorImpl& operator=(const IteratorImpl& rhs) = default;
371 IteratorImpl& operator=(IteratorImpl&& rhs) noexcept = default;
372 value_type& operator*();
373 value_type operator*() const;
374 value_type* operator->();
375 const value_type* operator->() const;
376 IteratorImpl& operator++();
377 IteratorImpl operator++(int);
378 IteratorImpl& operator--();
379 IteratorImpl operator--(int);
380 bool operator==(const IteratorImpl& rhs) const;
381 bool operator!=(const IteratorImpl& rhs) const;
382
383 protected:
384 RTCTK_LOCAL IteratorImpl(MapIterType&& iter);
385
386 MapIterType m_iterator; // The underlying map iterator.
387
392 std::optional<value_type> m_pair;
393 };
394
395 public:
399 class RTCTK_API Iterator final : public IteratorImpl<MapType::iterator, ValueProxy> {
400 private:
401 friend MetaData;
402 RTCTK_LOCAL inline Iterator(MapType::iterator&& iter);
403 };
404
410 : public IteratorImpl<MapType::const_iterator, ConstValueProxy> {
411 private:
412 friend MetaData;
413 RTCTK_LOCAL inline ConstIterator(MapType::const_iterator&& iter);
414 };
415
420 : public IteratorImpl<MapType::reverse_iterator, ValueProxy> {
421 private:
422 friend MetaData;
423 RTCTK_LOCAL inline ReverseIterator(MapType::reverse_iterator&& iter);
424 };
425
431 : public IteratorImpl<MapType::const_reverse_iterator, ConstValueProxy> {
432 private:
433 friend MetaData;
434 RTCTK_LOCAL inline ConstReverseIterator(MapType::const_reverse_iterator&& iter);
435 };
436
441 public:
442 explicit KeyDoesNotExist(const std::string& key);
443 const std::string& GetKey() const;
444
445 private:
446 std::shared_ptr<std::string> m_key;
447 };
448
453 public:
454 explicit KeyAlreadyExists(const std::string& key);
455 const std::string& GetKey() const;
456
457 private:
458 std::shared_ptr<std::string> m_key;
459 };
460
466 public:
467 explicit TypeMismatch(const std::string& key,
468 const std::type_info& type_used,
469 const std::type_info& type_expected);
470 const std::string& GetKey() const;
471 const std::type_info& GetTypeUsed() const;
472 const std::type_info& GetTypeExpected() const;
473
474 private:
475 struct RTCTK_LOCAL Attributes {
476 inline Attributes(const std::string& key,
477 const std::type_info& type_used,
478 const std::type_info& type_expected);
479 std::string m_key;
480 std::reference_wrapper<const std::type_info> m_type_used;
481 std::reference_wrapper<const std::type_info> m_type_expected;
482 };
483 // Note that using shared_ptr makes the exception's copy constructor noexcept.
484 std::shared_ptr<Attributes> m_attribs;
485 };
486
491 public:
492 using UnsupportedTypeException::UnsupportedTypeException;
493 };
494
495 MetaData() = default;
496 MetaData(const MetaData& rhs) = default;
497 MetaData(MetaData&& rhs) = default;
498 MetaData(std::initializer_list<std::pair<std::string, std::any>> init_list);
499 ~MetaData() = default;
500 MetaData& operator=(const MetaData& rhs) = default;
501 MetaData& operator=(MetaData&& rhs) = default;
502
507 inline bool Empty() const;
508
513 inline size_t GetSize() const noexcept;
514
520 inline bool Contains(const std::string& key) const;
521
528 ValueProxy Insert(const std::string& key);
529
536 ValueProxy Insert(std::string&& key);
537
546 template <typename T>
547 auto& Insert(const std::string& key, T&& value);
548
557 template <typename T>
558 auto& Insert(std::string&& key, T&& value);
559
565 bool Remove(const std::string& key);
566
572 ValueProxy operator[](const std::string& key);
573
579 ValueProxy operator[](std::string&& key);
580
587 ConstValueProxy operator[](const std::string& key) const;
588
593 void Merge(const MetaData& source);
594
604 void Merge(MetaData&& source);
605
606 // The following methods are for STL compatibility and therefore must use lower case.
607 // NOLINTBEGIN(readability-identifier-naming)
611 inline Iterator begin();
612
616 inline ConstIterator begin() const;
617
621 inline ConstIterator cbegin() const noexcept;
622
626 inline Iterator end();
627
631 inline ConstIterator end() const;
632
636 inline ConstIterator cend() const noexcept;
637
641 inline ReverseIterator rbegin();
642
646 inline ConstReverseIterator rbegin() const;
647
651 inline ConstReverseIterator crbegin() const noexcept;
652
656 inline ReverseIterator rend();
657
661 inline ConstReverseIterator rend() const;
662
666 inline ConstReverseIterator crend() const noexcept;
667 // NOLINTEND(readability-identifier-naming)
668
669 private:
670 friend RepositoryIf;
671
672 // We are using an std::map because it is often faster to copy/manipulate for a small number
673 // of keys compared to std::unordered_map.
674 MapType m_metadata;
675 };
676
684 public:
685 virtual ~BatchRequest() = default;
686
711 template <typename T>
712 void CreateDataPoint(
713 const DataPointPath& path,
714 const T& initial_value,
715 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
716 const CallbackType& callback = nullptr);
717
721 template <typename T>
723 const DataPointPath& path,
724 const T&& initial_value,
725 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
726 const CallbackType& callback = nullptr) = delete;
727
728 void DeleteDataPoint(const DataPointPath& path, const CallbackType& callback = nullptr);
729
730 void DataPointExists(const DataPointPath& path,
731 bool& result,
732 const CallbackType& callback = nullptr) const;
733
765 void GetChildren(const DataPointPath& path,
766 std::pair<PathList, PathList>& result,
767 bool recurse = false,
768 const CallbackType& callback = nullptr) const;
769
773 void GetChildren(const DataPointPath& path,
774 std::pair<PathList, PathList>&& result,
775 bool recurse = false,
776 const CallbackType& callback = nullptr) const = delete;
777
778 template <typename T>
779 void ReadDataPoint(const DataPointPath& path,
780 T& buffer,
781 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
782 const CallbackType& callback = nullptr) const;
783
787 template <typename T>
788 void ReadDataPoint(const DataPointPath& path,
789 T&& buffer,
790 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
791 const CallbackType& callback = nullptr) const = delete;
792
793 template <typename T>
794 void WriteDataPoint(
795 const DataPointPath& path,
796 const T& buffer,
797 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
798 const CallbackType& callback = nullptr);
799
803 template <typename T>
805 const DataPointPath& path,
806 const T&& buffer,
807 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
808 const CallbackType& callback = nullptr) = delete;
809
846 template <typename T>
847 void PartialReadDataPoint(
848 const DataPointPath& path,
849 T& buffer,
850 size_t first,
851 size_t last,
852 size_t d_first,
853 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
854 const CallbackType& callback = nullptr) const;
855
859 template <typename T>
861 const DataPointPath& path,
862 T&& buffer,
863 size_t first,
864 size_t last,
865 size_t d_first,
866 std::optional<std::reference_wrapper<MetaData>> metadata = std::nullopt,
867 const CallbackType& callback = nullptr) const = delete;
868
869 template <typename T>
870 void PartialWriteDataPoint(
871 const DataPointPath& path,
872 const T& buffer,
873 size_t first,
874 size_t last,
875 size_t d_first,
876 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
877 const CallbackType& callback = nullptr);
878
882 template <typename T>
884 const DataPointPath& path,
885 const T&& buffer,
886 size_t first,
887 size_t last,
888 size_t d_first,
889 std::optional<std::reference_wrapper<const MetaData>> metadata = std::nullopt,
890 const CallbackType& callback = nullptr) = delete;
891
892 void ReadMetaData(const DataPointPath& path,
893 MetaData& metadata,
894 const CallbackType& callback = nullptr) const;
895
899 void ReadMetaData(const DataPointPath& path,
900 MetaData&& metadata,
901 const CallbackType& callback = nullptr) const = delete;
902
903 void WriteMetaData(const DataPointPath& path,
904 const MetaData& metadata,
905 const CallbackType& callback = nullptr);
906
907 void CreateSymlink(const DataPointPath& dp,
908 const DataPointPath& link,
909 const CallbackType& callback = nullptr);
910
911 void UpdateSymlink(const DataPointPath& dp,
912 const DataPointPath& link,
913 const CallbackType& callback = nullptr);
914
915 protected:
918 };
919
921 public:
922 using ResponseList = std::vector<std::future<void>>;
923
925
926 // await all
927 void Wait();
928
929 template <typename Rep, typename Period>
930 bool WaitFor(const std::chrono::duration<Rep, Period>& timeout);
931
932 template <typename Clk, typename Duration>
933 bool WaitUntil(const std::chrono::time_point<Clk, Duration>& timeout);
934
935 protected:
937 };
938
939 BatchResponse SendRequest(const BatchRequest& request);
940 BatchResponse SendRequest(const BatchRequest& request) const;
941
942 // The following are synchronous convenience methods.
943
956 template <typename T>
957 void CreateDataPoint(const DataPointPath& path);
971 template <typename T>
972 void CreateDataPoint(const DataPointPath& path, const T& initial_value);
973
974 void CreateDataPoint(const DataPointPath& path, const char* initial_value);
975
985 void DeleteDataPoint(const DataPointPath& path, bool recurse = false);
986
1000 const std::type_info& GetDataPointType(const DataPointPath& path) const;
1001
1023 size_t GetDataPointSize(const DataPointPath& path) const;
1024
1049 RtcVectorUInt64 GetDataPointShape(const DataPointPath& path) const;
1050
1060 bool DataPointExists(const DataPointPath& path) const;
1061
1090 std::pair<PathList, PathList>
1091 GetChildren(const DataPointPath& path, bool recurse = false) const;
1092
1107 template <typename T>
1108 T GetDataPoint(const DataPointPath& path) const;
1109
1124 template <typename T>
1125 void SetDataPoint(const DataPointPath& path, const T& value);
1126
1127 void SetDataPoint(const DataPointPath& path, const char* value);
1128
1144 template <typename T>
1145 void ReadDataPoint(const DataPointPath& path, T& buffer) const;
1146
1165 template <typename T>
1166 void WriteDataPoint(const DataPointPath& path, const T& buffer);
1167
1168 void WriteDataPoint(const DataPointPath& path, const char* buffer);
1169
1170 template <typename... T>
1171 void WriteDataPoints(const T&... args);
1172
1173 template <typename... T>
1174 void ReadDataPoints(T&... args) const;
1175
1183 static const std::type_info& StringToType(const std::string& arg);
1184
1192 static std::string TypeToString(const std::type_info& arg);
1193
1194protected:
1195 virtual BatchResponse ProcessRequests(const RequestList& requests) = 0;
1196
1197#pragma GCC diagnostic push
1198#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
1199
1201 // The following is part of the legacy API:
1202
1203public:
1213 class [[deprecated("Use BatchRequest instead.")]] ReadRequest {
1214 public:
1219 class [[deprecated]] Parameters {
1220 public:
1221 Parameters() = default;
1222
1230 explicit Parameters(const DataPointPath& path,
1231 void* buffer,
1232 const std::type_info& type,
1233 const std::function<void()>& callback)
1234 : m_path(path), m_buffer(buffer), m_type(&type), m_callback(callback) {
1235 }
1236
1237 [[deprecated]] inline const DataPointPath& GetPath() const {
1238 return m_path;
1239 };
1240 [[deprecated]] inline void* GetBuffer() const {
1241 return m_buffer;
1242 };
1243 [[deprecated]] inline const std::type_info& GetType() const {
1244 return *m_type;
1245 };
1246 [[deprecated]] inline const std::function<void()>& GetCallback() const {
1247 return m_callback;
1248 };
1249
1250 private:
1253
1255 void* m_buffer;
1256
1258 const std::type_info* m_type;
1259
1261 std::function<void()> m_callback;
1262 };
1263
1264 template <typename T>
1265 [[deprecated("Use BatchRequest instead.")]] void Add(const DataPointPath& path, T& buffer);
1266 template <typename T, typename F>
1267 [[deprecated("Use BatchRequest instead.")]] void
1268 Add(const DataPointPath& path, T& buffer, F handler);
1269 [[deprecated("Use BatchRequest instead.")]] inline const std::vector<Parameters>&
1270 GetParams() const {
1271 return m_params;
1272 };
1273 [[deprecated("Use BatchRequest instead.")]] inline std::vector<Parameters>& GetParams() {
1274 return m_params;
1275 };
1276
1277 private:
1278 std::vector<Parameters> m_params;
1279 };
1280
1290 class [[deprecated("Use BatchRequest instead.")]] WriteRequest {
1291 public:
1296 class [[deprecated]] Parameters {
1297 public:
1298 Parameters() = default;
1299
1307 explicit Parameters(const DataPointPath& path,
1308 const void* buffer,
1309 const std::type_info& type,
1310 const std::function<void()>& callback)
1311 : m_path(path), m_buffer(buffer), m_type(&type), m_callback(callback) {
1312 }
1313
1314 [[deprecated]] inline const DataPointPath& GetPath() const {
1315 return m_path;
1316 };
1317 [[deprecated]] inline const void* GetBuffer() const {
1318 return m_buffer;
1319 };
1320 [[deprecated]] inline const std::type_info& GetType() const {
1321 return *m_type;
1322 };
1323 [[deprecated]] inline const std::function<void()>& GetCallback() const {
1324 return m_callback;
1325 };
1326
1327 private:
1330
1332 const void* m_buffer;
1333
1335 const std::type_info* m_type;
1336
1338 std::function<void()> m_callback;
1339 };
1340
1341 template <typename T>
1342 [[deprecated("Use BatchRequest instead.")]] void
1343 Add(const DataPointPath& path, const T& buffer);
1344 template <typename T, typename F>
1345 [[deprecated("Use BatchRequest instead.")]] void
1346 Add(const DataPointPath& path, const T& buffer, F handler);
1347 [[deprecated("Use BatchRequest instead.")]] inline const std::vector<Parameters>&
1348 GetParams() const {
1349 return m_params;
1350 };
1351 [[deprecated("Use BatchRequest instead.")]] inline std::vector<Parameters>& GetParams() {
1352 return m_params;
1353 };
1354
1355 private:
1356 std::vector<Parameters> m_params;
1357 };
1358
1370 class [[deprecated("Use BatchResponse instead.")]] Response {
1371 public:
1372 explicit Response(std::future<void>&& future) noexcept;
1373 Response(Response&& other) noexcept;
1374 Response& operator=(Response&& other) noexcept;
1375
1384 [[deprecated("Use BatchResponse instead.")]] void Wait();
1385
1401 [[deprecated("Use BatchResponse instead.")]] bool
1402 Wait(const std::chrono::microseconds& timeout);
1403
1404 private:
1405 Response(const Response& other) = delete;
1406 Response& operator=(const Response& other) = delete;
1407
1408 std::future<void> m_future;
1409 };
1410
1444 [[deprecated("Use version that takes a default value instead.")]] virtual void
1445 CreateDataPoint(const DataPointPath& path, const std::type_info& type);
1446
1447protected:
1458 [[deprecated("Use DeleteDataPoint instead.")]] virtual void
1459 DeleteDataPointLegacy(const DataPointPath& path);
1460
1474 [[deprecated("Use GetDataPointType instead.")]] virtual const std::type_info&
1475 GetDataPointTypeLegacy(const DataPointPath& path) const;
1476
1498 [[deprecated("Use GetDataPointSize instead.")]] virtual size_t
1499 GetDataPointSizeLegacy(const DataPointPath& path) const;
1500
1512 [[deprecated("Use DataPointExists instead.")]] virtual bool
1513 DataPointExistsLegacy(const DataPointPath& path) const;
1514
1538 [[deprecated("Use GetChildren instead.")]] virtual std::pair<PathList, PathList>
1539 GetChildrenLegacy(const DataPointPath& path) const;
1540
1541public:
1568 [[deprecated("Use SendRequest instead.")]] virtual Response
1569 SendReadRequest(const ReadRequest& request) const;
1570
1599 [[deprecated("Use SendRequest instead.")]] virtual Response
1600 SendWriteRequest(const WriteRequest& request);
1601
1602#pragma GCC diagnostic pop
1603};
1604
1605} // namespace rtctk::componentFramework
1606
1608
1609#endif // RTCTK_COMPONENTFRAMEWORK_REPOSITORYIF_HPP
The BufferTooSmall is thrown when an API call fails because the provided buffer is not big enough to ...
Definition exceptions.hpp:264
BufferTooSmall(const std::size_t actual, const std::size_t expected)
Construct exception object.
Definition exceptions.cpp:160
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
A buffer class representing 2D matrix data.
Definition matrixBuffer.hpp:28
An object representing one or more asynchronous I/O requests to a repository.
Definition repositoryIf.hpp:683
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.
void PartialWriteDataPoint(const DataPointPath &path, const T &&buffer, size_t first, size_t last, size_t d_first, std::optional< std::reference_wrapper< const MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)=delete
Writing to a datapoint from an rvalue reference is not allowed.
RequestList m_requests
Definition repositoryIf.hpp:917
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 GetChildren(const DataPointPath &path, std::pair< PathList, PathList > &result, bool recurse=false, const CallbackType &callback=nullptr) const
Add request to query the child datapoints and paths for a given parent path.
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 WriteDataPoint(const DataPointPath &path, const T &&buffer, std::optional< std::reference_wrapper< const MetaData > > metadata=std::nullopt, const CallbackType &callback=nullptr)=delete
Writing to a datapoint from an rvalue reference is not allowed.
void ReadMetaData(const DataPointPath &path, MetaData &&metadata, const CallbackType &callback=nullptr) const =delete
Reading metadata into an rvalue reference is not allowed.
friend RepositoryIf
Definition repositoryIf.hpp:916
std::vector< std::future< void > > ResponseList
Definition repositoryIf.hpp:922
ResponseList m_responses
Definition repositoryIf.hpp:936
Constant version of the bidirectional forward iterator returned by the cbegin/cend methods.
Definition repositoryIf.hpp:410
Constant version of the bidirectional reverse iterator returned by the crbegin/crend methods.
Definition repositoryIf.hpp:431
A read-only interface class to an underlying metadata value.
Definition repositoryIf.hpp:203
Bidirectional forward iterator returned by the begin/end methods.
Definition repositoryIf.hpp:399
Exception indicating that the metadata already contains the given key.
Definition repositoryIf.hpp:452
Exception indicating that the given key does not exist in the metadata.
Definition repositoryIf.hpp:440
Bidirectional reverse iterator returned by the rbegin/rend methods.
Definition repositoryIf.hpp:420
Exception indicating that a value with the wrong type was being assigned to a reserved key.
Definition repositoryIf.hpp:465
Exception indicating that an unsupported type was used for the metadata value.
Definition repositoryIf.hpp:490
Interface class to an underlying metadata value.
Definition repositoryIf.hpp:257
Class for passing/receiving metadata to/from the repository.
Definition repositoryIf.hpp:195
MetaData & operator=(const MetaData &rhs)=default
MetaData & operator=(MetaData &&rhs)=default
A structure to hold the arguments passed with one of the Add methods.
Definition repositoryIf.hpp:1219
const DataPointPath & GetPath() const
Definition repositoryIf.hpp:1237
const std::function< void()> & GetCallback() const
Definition repositoryIf.hpp:1246
Parameters(const DataPointPath &path, void *buffer, const std::type_info &type, const std::function< void()> &callback)
Allows to explicitly construct a complete parameters structure.
Definition repositoryIf.hpp:1230
const std::type_info & GetType() const
Definition repositoryIf.hpp:1243
void * GetBuffer() const
Definition repositoryIf.hpp:1240
A request object to pass information about datapoints that should be read from the repository.
Definition repositoryIf.hpp:1213
std::vector< Parameters > & GetParams()
Definition repositoryIf.hpp:1273
const std::vector< Parameters > & GetParams() const
Definition repositoryIf.hpp:1270
An object used to wait for a request to complete.
Definition repositoryIf.hpp:1370
A structure to hold the arguments passed with one of the Add methods.
Definition repositoryIf.hpp:1296
const void * GetBuffer() const
Definition repositoryIf.hpp:1317
const std::type_info & GetType() const
Definition repositoryIf.hpp:1320
const DataPointPath & GetPath() const
Definition repositoryIf.hpp:1314
const std::function< void()> & GetCallback() const
Definition repositoryIf.hpp:1323
Parameters(const DataPointPath &path, const void *buffer, const std::type_info &type, const std::function< void()> &callback)
Allows to explicitly construct a complete parameters structure.
Definition repositoryIf.hpp:1307
A request object to pass information about datapoints that should be written to the repository.
Definition repositoryIf.hpp:1290
std::vector< Parameters > & GetParams()
Definition repositoryIf.hpp:1351
const std::vector< Parameters > & GetParams() const
Definition repositoryIf.hpp:1348
Abstract interface providing basic read and write facilities to a repository.
Definition repositoryIf.hpp:104
virtual BatchResponse ProcessRequests(const RequestList &requests)=0
Clock::time_point Timestamp
Definition repositoryIf.hpp:111
taiclock::TaiClock Clock
Definition repositoryIf.hpp:110
std::vector< std::any > RequestList
Definition repositoryIf.hpp:106
std::vector< DataPointPath > PathList
Definition repositoryIf.hpp:109
std::function< void(const DataPointPath &)> CallbackType
Signature of the callback functions that can be registered with the repository requests.
Definition repositoryIf.hpp:114
The RtctkException class is the base class for all Rtctk exceptions.
Definition exceptions.hpp:211
The UnsupportedTypeException is thrown whenever an attempt is made to use an unsupported type in the ...
Definition exceptions.hpp:239
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
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:129
bool operator==(const DataPointPath &lhs, const char *rhs) noexcept
Definition dataPointPath.hpp:358
Definition commandReplier.cpp:22
uint64_t RtcUInt64
Definition repositoryIf.hpp:61
uint8_t RtcUInt8
Definition repositoryIf.hpp:58
int64_t RtcInt64
Definition repositoryIf.hpp:57
float RtcFloat
Definition repositoryIf.hpp:62
RtcVector< RtcUInt32 > RtcVectorUInt32
Definition repositoryIf.hpp:73
RtcVector< RtcDouble > RtcVectorDouble
Definition repositoryIf.hpp:76
std::string RtcString
Definition repositoryIf.hpp:64
int8_t RtcInt8
Definition repositoryIf.hpp:54
std::vector< T > RtcVector
Definition repositoryIf.hpp:45
uint32_t RtcUInt32
Definition repositoryIf.hpp:60
bool RtcBool
Definition repositoryIf.hpp:53
int16_t RtcInt16
Definition repositoryIf.hpp:55
RtcVector< RtcUInt16 > RtcVectorUInt16
Definition repositoryIf.hpp:72
RtcVector< RtcInt16 > RtcVectorInt16
Definition repositoryIf.hpp:68
RtcVector< RtcFloat > RtcVectorFloat
Definition repositoryIf.hpp:75
RtcVector< RtcInt8 > RtcVectorInt8
Definition repositoryIf.hpp:67
uint16_t RtcUInt16
Definition repositoryIf.hpp:59
RtcVector< RtcBool > RtcVectorBool
Definition repositoryIf.hpp:66
int32_t RtcInt32
Definition repositoryIf.hpp:56
RtcVector< RtcUInt64 > RtcVectorUInt64
Definition repositoryIf.hpp:74
RtcVector< RtcString > RtcVectorString
Definition repositoryIf.hpp:77
RtcVector< RtcInt32 > RtcVectorInt32
Definition repositoryIf.hpp:69
std::vector< std::byte > RtcBinary
Definition repositoryIf.hpp:65
RtcVector< RtcUInt8 > RtcVectorUInt8
Definition repositoryIf.hpp:71
RtcVector< RtcInt64 > RtcVectorInt64
Definition repositoryIf.hpp:70
double RtcDouble
Definition repositoryIf.hpp:63
rtctk::componentFramework::RepositoryIf::Response Response
Definition oldbAdapterLegacy.cpp:57
DataPointPath m_path
Definition populateConfig.cpp:168
Implementation file for RepositoryIf template methods and related classes.
std::exception_ptr exception
Definition repositoryIf.hpp:158