13#ifndef RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
14#define RTCTK_COMPONENTFRAMEWORK_PERSISTENTREPOADAPTER_HPP
22#include <unordered_map>
24#include <mal/utility/Uri.hpp>
73 const elt::mal::Uri& uri,
74 const std::string& message);
142 return m_fits_write_threshold;
150 m_fits_write_threshold = value;
171 template <
typename R,
typename F>
172 Response ProcessRequest(
const R& request, F dispatch)
const;
187 template <
typename T>
188 static void CheckBufferAndDataPointTypesMatch(
const std::type_info& type,
const T* node);
195 virtual ~IoFunctions() =
default;
200 void* buffer)
const = 0;
203 const void* buffer)
const = 0;
218 template <
typename T>
219 class IoFunctionsImpl :
public IoFunctions {
221 IoFunctionsImpl(
const std::string& yaml_type) : m_yaml_type(yaml_type){};
222 virtual ~IoFunctionsImpl() =
default;
224 const DataPointPath& path)
const override;
226 const DataPointPath& path,
227 void* buffer)
const override;
229 const DataPointPath& path,
230 const void* buffer)
const override;
233 std::string m_yaml_type;
236 using IoFunctionMap = std::unordered_map<std::type_index, std::shared_ptr<IoFunctions>>;
243 template <
typename T>
244 static auto MakeMapEntry(
const std::string& yaml_type);
246 log4cplus::Logger& m_logger;
252 mutable std::mutex m_mutex;
255 PathMapper m_path_mapper;
261 std::atomic<std::uint64_t> m_fits_write_threshold;
263 using TypeMap = std::unordered_map<std::string, const std::type_info&>;
266 static const TypeMap S_TYPE_MAP;
272 static const IoFunctionMap S_IO_FUNCTIONS;
This class provides a wrapper for a data point path.
Definition: dataPointPath.hpp:73
const elt::mal::Uri & GetBaseUri() const
Definition: pathMapper.hpp:67
Exception indicating that validation checks of a CII configuration document failed.
Definition: persistentRepoAdapter.hpp:69
Exception indicating a datapoint path does not exist.
Definition: persistentRepoAdapter.hpp:80
Exception indicating a general CII configuration service error.
Definition: persistentRepoAdapter.hpp:61
Implements the Persistent Configuration Repository adapter that uses the CII configuration service as...
Definition: persistentRepoAdapter.hpp:52
std::pair< PathList, PathList > GetChildren(const DataPointPath &path) const override
Queries the datapoints and child paths for a given path.
Definition: persistentRepoAdapter.cpp:847
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.
const std::type_info & GetDataPointType(const DataPointPath &path) const override
Fetches the type of the datapoint.
Definition: persistentRepoAdapter.cpp:699
Response SendReadRequest(const ReadRequest &request) const override
Sends a request to read data from the repository.
Definition: persistentRepoAdapter.cpp:901
PersistentRepoAdapter & operator=(const PersistentRepoAdapter &)=delete
This class cannot be copy assigned.
void SetFitsWriteThreshold(std::uint64_t value)
Set the number of elements above which matrices and vectors are written to FITS files.
Definition: persistentRepoAdapter.hpp:149
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:119
void CreateDataPoint(const DataPointPath &path, const std::type_info &type) override
Creates a new datapoint in the repository with a specified type.
Definition: persistentRepoAdapter.cpp:581
PersistentRepoAdapter(PersistentRepoAdapter &&)=default
Objects of this class can be moved.
static const std::string SUPPORTED_URI_SCHEME
Definition: persistentRepoAdapter.hpp:54
void DeleteDataPoint(const DataPointPath &path) override
Deletes a datapoint.
Definition: persistentRepoAdapter.cpp:596
Response SendWriteRequest(const WriteRequest &request) override
Sends a request to write data to the repository.
Definition: persistentRepoAdapter.cpp:908
virtual ~PersistentRepoAdapter()=default
std::size_t GetDataPointSize(const DataPointPath &path) const override
Fetches the size of the datapoint's data.
Definition: persistentRepoAdapter.cpp:731
std::uint64_t GetFitsWriteThreshold() const
Return the number of elements above which matrices and vectors are written to FITS files.
Definition: persistentRepoAdapter.hpp:141
bool DataPointExists(const DataPointPath &path) const override
Checks for the existence of a datapoint in the repository.
Definition: persistentRepoAdapter.cpp:825
Base interface for all Persistent Configuration Repository adapters.
Definition: persistentRepoIf.hpp:25
A request object to pass information about datapoints that should be read from the repository.
Definition: repositoryIf.hpp:49
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:197
A request object to pass information about datapoints that should be written to the repository.
Definition: repositoryIf.hpp:122
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
The RtctkException class is the base class for all Rtctk exceptions.
Definition: exceptions.hpp:237
Provides macros and utilities for exception handling.
Declaration of FileRepository that provides a simple file based repository.
Logging Support Library based on log4cplus.
Definition: commandReplier.cpp:22
Header file declaring PathMapper.
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.