RTC Toolkit 6.0.0
Loading...
Searching...
No Matches
persistentRepoAdapter.hpp
Go to the documentation of this file.
1
11
12#ifndef RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
13#define RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
14
15#include <atomic>
16#include <string>
17#include <typeindex>
18#include <typeinfo>
19#include <utility>
20
21#include <mal/utility/Uri.hpp>
22
29
31
51public:
52 inline static const std::string SUPPORTED_URI_SCHEME = "cii.config";
53
56
59
62
65
68
79 explicit PersistentRepoAdapter(const elt::mal::Uri& baseuri, bool simple_layout = false);
80
81 elt::mal::Uri GetUri() const override {
82 return m_path_mapper.GetBaseUri();
83 }
84
85 ~PersistentRepoAdapter() override = default;
86
92 uint64_t GetFitsWriteThreshold() const {
93 return m_fits_write_threshold;
94 }
95
100 void SetFitsWriteThreshold(uint64_t value) {
101 m_fits_write_threshold = value;
102 }
103
104private:
105 template <typename T>
106 void CreateImpl(detail::CreateRequest<T>& request);
107
108 template <typename T>
109 void ReadImpl(detail::ReadRequest<T>& request);
110
111 template <typename T>
112 void WriteImpl(detail::WriteRequest<T>& request);
113
114 template <typename T>
115 void PartialReadImpl(detail::PartialReadRequest<T>& request);
116
117 template <typename T>
118 void PartialWriteImpl(detail::PartialWriteRequest<T>& request);
119
120 void ReadMetaDataImpl(detail::ReadMetaDataRequest& request);
121 void WriteMetaDataImpl(detail::WriteMetaDataRequest& request);
122 void DeleteImpl(detail::DeleteRequest& request);
123 void ExistsImpl(detail::ExistsRequest& request);
124 void GetChildrenImpl(detail::GetChildrenRequest& request);
125 void CreateLinkImpl(detail::CreateSymlinkRequest& request);
126 void UpdateLinkImpl(detail::UpdateSymlinkRequest& request);
127
128 BatchResponse ProcessRequests(const RequestList& requests) override;
129
130 void GetChildren(const DataPointPath& path, PathList& datapoints, PathList& childpaths) const;
131
137 void FillExtraMetadata(MetaData& metadata, const DataPointPath& path);
138
152 template <typename T>
153 static void CheckBufferAndDataPointTypesMatch(const std::type_info& type, const T* node);
154
155 log4cplus::Logger& m_logger;
156
161 std::atomic<uint64_t> m_fits_write_threshold;
162
164 PathMapper m_path_mapper;
165
167 DynamicThreadPool m_thread_pool{"psr_worker"};
168
169 RTCTK_LOCAL static const std::type_info& LookupCppType(const std::string& tag);
170 RTCTK_LOCAL static std::string LookupYamlTag(const MetaData& metadata);
171
172 RTCTK_LOCAL static std::tuple<std::string, std::string, bool>
173 LookupYamlTags(const MetaData& metadata);
174
175 using TagToTypeMap = std::unordered_map<std::string, const std::type_info&>;
176 using TypeToTagMap = std::unordered_map<std::type_index, std::pair<std::string, std::string>>;
177
179 static const TagToTypeMap S_TAG_TO_TYPE;
180
182 static const TypeToTagMap S_TYPE_TO_TAG;
183
184 template <typename T>
185 static RequestDispatcher<PersistentRepoAdapter>::TableEntries BindTypeHandlers();
186
187 static const RequestDispatcher<PersistentRepoAdapter> S_REQUEST_DISPATCHER;
188};
189
190} // namespace rtctk::componentFramework
191
192#endif // RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:76
The DynamicThreadPool allows creating multiple threads which are garbage collected.
Definition dynamicThreadPool.hpp:36
Used to calculate URIs from datapoint paths.
Definition pathMapper.hpp:32
PersistentRepoAdapter()=delete
Do not allow construction with no arguments.
PersistentRepoAdapter & operator=(PersistentRepoAdapter &&)=default
Objects of this class can be moved with the move assignment operator.
PersistentRepoAdapter & operator=(const PersistentRepoAdapter &)=delete
This class cannot be copy assigned.
PersistentRepoAdapter(const PersistentRepoAdapter &)=delete
This class cannot be copy constructed.
uint64_t GetFitsWriteThreshold() const
Return the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:92
PersistentRepoAdapter(PersistentRepoAdapter &&)=default
Objects of this class can be moved.
static const std::string SUPPORTED_URI_SCHEME
Definition persistentRepoAdapter.hpp:52
void SetFitsWriteThreshold(uint64_t value)
Set the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:100
elt::mal::Uri GetUri() const override
Get the URI used when creating this adapter object.
Definition persistentRepoAdapter.hpp:81
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:24
#define RTCTK_LOCAL
Helper to hide a class or function from the public symbol table.
Definition config.hpp:59
#define RTCTK_API
Helper to indicate that a class or function must be exported in the public symbol table.
Definition config.hpp:32
Header file for a dynamic resizing thread pool.
Provides macros and utilities for exception handling.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:21
RepositoryIf::MetaData MetaData
Definition oldbAdapter.cpp:57
RepositoryIf::PathList PathList
Definition persistentRepoAdapter.cpp:95
Header file declaring PathMapper.
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
Header file for the RequestDispatcher utility class.