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;
130 template <
typename F>
141 template <
typename T>
142 void ReadData(
const DataPointPath& path, T& buffer,
const std::string& typestr)
const;
152 template <
typename T>
153 void WriteData(
const DataPointPath& path,
const T& buffer,
const std::string& typestr)
const;
156 struct IoFunctionMapEntry {
159 using WriteFunction =
162 ReadFunction m_read_function;
163 WriteFunction m_write_function;
167 using IoFunctionMap = std::map<std::type_index, IoFunctionMapEntry>;
177 template <
typename T>
178 static auto MakeMapEntry(
const std::string& typestr);
186 mutable std::mutex m_mutex;
187 boost::filesystem::path m_datapath;
188 std::string m_defaultfile;
190 size_t m_fits_write_threshold;
193 static const IoFunctionMap S_IO_FUNCTIONS;
198 #endif // RTCTK_COMPONENTFRAMEWORK_FILEREPOSITORY_HPP
void DeleteDataPoint(const DataPointPath &path) override
Deletes a datapoint.
Definition: fileRepository.cpp:869
Provides macros and utilities for exception handling.
InvalidUriInFileError(const boost::filesystem::path &filepath, const std::string &uri)
Definition: fileRepository.cpp:771
DirCreationError(const boost::filesystem::path &path)
Definition: fileRepository.cpp:778
Definition: fileRepository.hpp:28
FileRepository(const FileRepository &)=delete
A request object to pass information about datapoints that should be read (written) from (to) the rep...
Definition: repositoryIf.hpp:45
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:763
The RtctkException class is the base class for all Rtctk exceptions.
Definition: exceptions.hpp:207
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:913
Header file for RepositoryIf and related base classes.
virtual void CreateDataPoint(const DataPointPath &path, const std::type_info &type)=0
Creates a new datapoint in the repository with a specified type.
std::vector< std::string > StringList
Definition: repositoryIf.hpp:37
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:35
Response SendReadRequest(const Request &request) const override
Sends a request to read data from the repository.
Definition: fileRepository.cpp:1075
Definition: fileRepository.hpp:43
size_t GetDataPointSize(const DataPointPath &path) const override
Fetches the size of the datapoint's data.
Definition: fileRepository.cpp:945
virtual ~FileRepository() noexcept=default
Definition: mudpiProcessingError.hpp:119
This class provides a wraper for DataPoint paths which ensures that they only contain valid character...
Definition: dataPointPath.hpp:34
An object used to wait for a request to complete.
Definition: repositoryIf.hpp:106
bool DataPointExists(const DataPointPath &path) const override
Checks for the existence of a datapoint in the repository.
Definition: fileRepository.cpp:991
Definition: fileRepository.hpp:38
std::pair< StringList, StringList > GetChildren(const DataPointPath &path) const override
Queries the datapoints and child paths for a given path.
Definition: fileRepository.cpp:1012
Response SendWriteRequest(const Request &request) override
Sends a request to write data to the repository.
Definition: fileRepository.cpp:1079