Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_FILEREPOSITORY_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_FILEREPOSITORY_HPP
20 #include <boost/filesystem.hpp>
21 #include <mal/utility/Uri.hpp>
73 explicit FileRepository(
const elt::mal::Uri& datauri,
const int dirdepth);
95 std::scoped_lock lck(m_mutex);
96 return m_fits_write_threshold;
110 std::scoped_lock lck(m_mutex);
111 m_fits_write_threshold = value;
131 template <
typename R,
typename F>
132 Response ProcessRequest(
const R& request, F selector)
const;
142 template <
typename T>
143 void ReadData(
const DataPointPath& path, T& buffer,
const std::string& typestr)
const;
153 template <
typename T>
154 void WriteData(
const DataPointPath& path,
const T& buffer,
const std::string& typestr)
const;
157 struct IoFunctionMapEntry {
160 using WriteFunction =
163 ReadFunction m_read_function;
164 WriteFunction m_write_function;
168 using IoFunctionMap = std::map<std::type_index, IoFunctionMapEntry>;
178 template <
typename T>
179 static auto MakeMapEntry(
const std::string& typestr);
187 mutable std::mutex m_mutex;
188 boost::filesystem::path m_datapath;
189 std::string m_defaultfile;
191 size_t m_fits_write_threshold;
194 static const IoFunctionMap S_IO_FUNCTIONS;
199 #endif // RTCTK_COMPONENTFRAMEWORK_FILEREPOSITORY_HPP
void DeleteDataPoint(const DataPointPath &path) override
Deletes a datapoint.
Definition: fileRepository.cpp:900
Provides macros and utilities for exception handling.
InvalidUriInFileError(const boost::filesystem::path &filepath, const std::string &uri)
Definition: fileRepository.cpp:802
DirCreationError(const boost::filesystem::path &path)
Definition: fileRepository.cpp:809
Definition: fileRepository.hpp:28
A request object to pass information about datapoints that should be read from the repository.
Definition: repositoryIf.hpp:44
FileRepository(const FileRepository &)=delete
Implements a file based repository that stores datapoints in local YAML and FITS files.
Definition: fileRepository.hpp:68
Definition: commandReplier.cpp:20
PathMissingException(const std::string &path)
Definition: fileRepository.cpp:794
The RtctkException class is the base class for all Rtctk exceptions.
Definition: exceptions.hpp:207
std::pair< PathList, PathList > GetChildren(const DataPointPath &path) const override
Queries the datapoints and child paths for a given path.
Definition: fileRepository.cpp:1083
FileRepository & operator=(const FileRepository &)=delete
size_t GetFitsWriteThreshold() const
Definition: fileRepository.hpp:94
const std::type_info & GetDataPointType(const DataPointPath &path) const override
Fetches the type of the datapoint.
Definition: fileRepository.cpp:944
Header file for RepositoryIf and related base classes.
A request object to pass information about datapoints that should be written to the repository.
Definition: repositoryIf.hpp:115
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
Response SendWriteRequest(const WriteRequest &request) override
Sends a request to write data to the repository.
Definition: fileRepository.cpp:1150
void SetFitsWriteThreshold(size_t value)
Sets the threshold for storing numerical matrices and vectors in FITS files rather than the YAML file...
Definition: fileRepository.hpp:109
Abstract interface providing basic read and write facilities to a repository.
Definition: repositoryIf.hpp:34
Response SendReadRequest(const ReadRequest &request) const override
Sends a request to read data from the repository.
Definition: fileRepository.cpp:1146
Definition: fileRepository.hpp:43
size_t GetDataPointSize(const DataPointPath &path) const override
Fetches the size of the datapoint's data.
Definition: fileRepository.cpp:976
virtual ~FileRepository() noexcept=default
Definition: mudpiProcessingError.hpp:119
std::vector< DataPointPath > PathList
Definition: repositoryIf.hpp:36
This class provides a wrapper for a data point path.
Definition: dataPointPath.hpp:65
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:188
bool DataPointExists(const DataPointPath &path) const override
Checks for the existence of a datapoint in the repository.
Definition: fileRepository.cpp:1062
Definition: fileRepository.hpp:38