RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
persistentRepoAdapter.hpp
Go to the documentation of this file.
1
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
29
31
51public:
52 inline static const std::string SUPPORTED_URI_SCHEME = "cii.config";
53
60 public:
61 explicit ServiceFailureException(const DataPointPath& path);
62 };
63
68 public:
69 explicit InvalidDocumentException(const DataPointPath& path, const elt::mal::Uri& uri);
70 explicit InvalidDocumentException(const DataPointPath& path,
71 const elt::mal::Uri& uri,
72 const std::string& message);
73 };
74
79 public:
80 explicit PathMissingException(const DataPointPath& path);
81 };
82
85
88
91
94
97
108 explicit PersistentRepoAdapter(const elt::mal::Uri& baseuri, bool simple_layout = false);
109
117 elt::mal::Uri GetBaseUri() const {
118 return m_path_mapper.GetBaseUri();
119 }
120
121 virtual ~PersistentRepoAdapter() = default;
122
128 uint64_t GetFitsWriteThreshold() const {
129 return m_fits_write_threshold;
130 }
131
136 void SetFitsWriteThreshold(uint64_t value) {
137 m_fits_write_threshold = value;
138 }
139
140private:
141 template <typename T>
142 void CreateImpl(detail::CreateRequest<T>& request);
143
144 template <typename T>
145 void ReadImpl(detail::ReadRequest<T>& request);
146
147 template <typename T>
148 void WriteImpl(detail::WriteRequest<T>& request);
149
150 template <typename T>
151 void PartialReadImpl(detail::PartialReadRequest<T>& request);
152
153 template <typename T>
154 void PartialWriteImpl(detail::PartialWriteRequest<T>& request);
155
156 void ReadMetaDataImpl(detail::ReadMetaDataRequest& request);
157 void WriteMetaDataImpl(detail::WriteMetaDataRequest& request);
158 void DeleteImpl(detail::DeleteRequest& request);
159 void ExistsImpl(detail::ExistsRequest& request);
160 void GetChildrenImpl(detail::GetChildrenRequest& request);
161 void CreateLinkImpl(detail::CreateSymlinkRequest& request);
162 void UpdateLinkImpl(detail::UpdateSymlinkRequest& request);
163
164 BatchResponse ProcessRequests(const RequestList& requests) override;
165
166 void GetChildren(const DataPointPath& path, PathList& datapoints, PathList& childpaths) const;
167
173 void FillExtraMetadata(MetaData& metadata, const DataPointPath& path);
174
188 template <typename T>
189 static void CheckBufferAndDataPointTypesMatch(const std::type_info& type, const T* node);
190
191 log4cplus::Logger& m_logger;
192
197 std::atomic<uint64_t> m_fits_write_threshold;
198
200 PathMapper m_path_mapper;
201
202 RTCTK_LOCAL static const std::type_info& LookupCppType(const std::string& tag);
203 RTCTK_LOCAL static std::string LookupYamlTag(const MetaData& metadata);
204
205 RTCTK_LOCAL static std::tuple<std::string, std::string, bool>
206 LookupYamlTags(const MetaData& metadata);
207
208 using TagToTypeMap = std::unordered_map<std::string, const std::type_info&>;
209 using TypeToTagMap = std::unordered_map<std::type_index, std::pair<std::string, std::string>>;
210
212 static const TagToTypeMap S_TAG_TO_TYPE;
213
215 static const TypeToTagMap S_TYPE_TO_TAG;
216
217 template <typename T>
219
220 static const RequestDispatcher<PersistentRepoAdapter> S_REQUEST_DISPATCHER;
221};
222
223} // namespace rtctk::componentFramework
224
225#endif // RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
Used to calculate URIs from datapoint paths.
Definition pathMapper.hpp:33
Exception indicating that validation checks of a CII configuration document failed.
Definition persistentRepoAdapter.hpp:67
Exception indicating a datapoint path does not exist.
Definition persistentRepoAdapter.hpp:78
Exception indicating a general CII configuration service error.
Definition persistentRepoAdapter.hpp:59
Implements the Persistent Configuration Repository adapter that uses the CII configuration service as...
Definition persistentRepoAdapter.hpp:50
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.
elt::mal::Uri GetBaseUri() const
Get the base URI used when creating this adapter object.
Definition persistentRepoAdapter.hpp:117
uint64_t GetFitsWriteThreshold() const
Return the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:128
PersistentRepoAdapter(PersistentRepoAdapter &&)=default
Objects of this class can be moved.
void SetFitsWriteThreshold(uint64_t value)
Set the number of elements above which matrices and vectors are written to FITS files.
Definition persistentRepoAdapter.hpp:136
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:25
Class for passing/receiving metadata to/from the repository.
Definition repositoryIf.hpp:195
Definition requestDispatcher.hpp:31
The RtctkException class is the base class for all Rtctk exceptions.
Definition exceptions.hpp:211
#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
Provides macros and utilities for exception handling.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:22
RepositoryIf::PathList PathList
Definition oldbAdapterLegacy.cpp:325
Header file declaring PathMapper.
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
Header file for the RequestDispatcher utility class.