RTC Toolkit 6.0.0-pre2
Loading...
Searching...
No Matches
persistentRepoAdapter.hpp
Go to the documentation of this file.
1
12
13#ifndef RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
15
16#include <atomic>
17#include <string>
18#include <typeindex>
19#include <typeinfo>
20#include <utility>
21
22#include <mal/utility/Uri.hpp>
23
30
32
52public:
53 inline static const std::string SUPPORTED_URI_SCHEME = "cii.config";
54
57
60
63
66
69
80 explicit PersistentRepoAdapter(const elt::mal::Uri& baseuri, bool simple_layout = false);
81
82 elt::mal::Uri GetUri() const override {
83 return m_path_mapper.GetBaseUri();
84 }
85
86 ~PersistentRepoAdapter() override = default;
87
93 uint64_t GetFitsWriteThreshold() const {
94 return m_fits_write_threshold;
95 }
96
101 void SetFitsWriteThreshold(uint64_t value) {
102 m_fits_write_threshold = value;
103 }
104
105private:
106 template <typename T>
107 void CreateImpl(detail::CreateRequest<T>& request);
108
109 template <typename T>
110 void ReadImpl(detail::ReadRequest<T>& request);
111
112 template <typename T>
113 void WriteImpl(detail::WriteRequest<T>& request);
114
115 template <typename T>
116 void PartialReadImpl(detail::PartialReadRequest<T>& request);
117
118 template <typename T>
119 void PartialWriteImpl(detail::PartialWriteRequest<T>& request);
120
121 void ReadMetaDataImpl(detail::ReadMetaDataRequest& request);
122 void WriteMetaDataImpl(detail::WriteMetaDataRequest& request);
123 void DeleteImpl(detail::DeleteRequest& request);
124 void ExistsImpl(detail::ExistsRequest& request);
125 void GetChildrenImpl(detail::GetChildrenRequest& request);
126 void CreateLinkImpl(detail::CreateSymlinkRequest& request);
127 void UpdateLinkImpl(detail::UpdateSymlinkRequest& request);
128
129 BatchResponse ProcessRequests(const RequestList& requests) override;
130
131 void GetChildren(const DataPointPath& path, PathList& datapoints, PathList& childpaths) const;
132
138 void FillExtraMetadata(MetaData& metadata, const DataPointPath& path);
139
153 template <typename T>
154 static void CheckBufferAndDataPointTypesMatch(const std::type_info& type, const T* node);
155
156 log4cplus::Logger& m_logger;
157
162 std::atomic<uint64_t> m_fits_write_threshold;
163
165 PathMapper m_path_mapper;
166
168 DynamicThreadPool m_thread_pool{"psr_worker"};
169
170 RTCTK_LOCAL static const std::type_info& LookupCppType(const std::string& tag);
171 RTCTK_LOCAL static std::string LookupYamlTag(const MetaData& metadata);
172
173 RTCTK_LOCAL static std::tuple<std::string, std::string, bool>
174 LookupYamlTags(const MetaData& metadata);
175
176 using TagToTypeMap = std::unordered_map<std::string, const std::type_info&>;
177 using TypeToTagMap = std::unordered_map<std::type_index, std::pair<std::string, std::string>>;
178
180 static const TagToTypeMap S_TAG_TO_TYPE;
181
183 static const TypeToTagMap S_TYPE_TO_TAG;
184
185 template <typename T>
186 static RequestDispatcher<PersistentRepoAdapter>::TableEntries BindTypeHandlers();
187
188 static const RequestDispatcher<PersistentRepoAdapter> S_REQUEST_DISPATCHER;
189};
190
191} // namespace rtctk::componentFramework
192
193#endif // RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:77
The DynamicThreadPool allows creating multiple threads which are garbage collected.
Definition dynamicThreadPool.hpp:37
Used to calculate URIs from datapoint paths.
Definition pathMapper.hpp:33
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:93
PersistentRepoAdapter(PersistentRepoAdapter &&)=default
Objects of this class can be moved.
static const std::string SUPPORTED_URI_SCHEME
Definition persistentRepoAdapter.hpp:53
void SetFitsWriteThreshold(uint64_t value)
Set the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:101
elt::mal::Uri GetUri() const override
Get the URI used when creating this adapter object.
Definition persistentRepoAdapter.hpp:82
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:25
#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 a dynamic resizing thread pool.
Provides macros and utilities for exception handling.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:22
RepositoryIf::MetaData MetaData
Definition oldbAdapter.cpp:55
RepositoryIf::PathList PathList
Definition persistentRepoAdapter.cpp:96
Header file declaring PathMapper.
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
Header file for the RequestDispatcher utility class.