|
| FileOldbAdapter ()=delete |
| Do not allow construction with no arguments. More...
|
|
| FileOldbAdapter (const FileOldbAdapter &)=delete |
| This class cannot be copy constructed. More...
|
|
FileOldbAdapter & | operator= (const FileOldbAdapter &)=delete |
| This class cannot be copy assigned. More...
|
|
| FileOldbAdapter (FileOldbAdapter &&)=default |
| The move constructor. More...
|
|
FileOldbAdapter & | operator= (FileOldbAdapter &&)=default |
| The move assignment operator. More...
|
|
| FileOldbAdapter (const elt::mal::Uri &datauri) |
| Constructs a file based OLDB. More...
|
|
virtual | ~FileOldbAdapter () |
| Destroys the file based OLDB. More...
|
|
RepositoryIf::Response | SendSubscribeRequest (const SubscribeRequest &request) const override |
| This is called to asynchronously send a subscription request for datapoints. More...
|
|
RepositoryIf::Response | SendUnsubscribeRequest (const UnsubscribeRequest &request) const override |
| This is called to asynchronously send a request to unsubscribe from various notifications. More...
|
|
| FileRepository ()=delete |
|
| FileRepository (const FileRepository &)=delete |
|
FileRepository & | operator= (const FileRepository &)=delete |
|
| FileRepository (const elt::mal::Uri &datauri, const int dirdepth) |
|
virtual | ~FileRepository () noexcept=default |
|
void | CreateDataPoint (const DataPointPath &path, const std::type_info &type) override |
| Creates a new datapoint in the repository with a specified type. More...
|
|
void | DeleteDataPoint (const DataPointPath &path) override |
| Deletes a datapoint. More...
|
|
const std::type_info & | GetDataPointType (const DataPointPath &path) const override |
| Fetches the type of the datapoint. More...
|
|
size_t | GetDataPointSize (const DataPointPath &path) const override |
| Fetches the size of the datapoint's data. More...
|
|
bool | DataPointExists (const DataPointPath &path) const override |
| Checks for the existence of a datapoint in the repository. More...
|
|
std::pair< StringList, StringList > | GetChildren (const DataPointPath &path) const override |
| Queries the datapoints and child paths for a given path. More...
|
|
Response | SendReadRequest (const Request &request) const override |
| Sends a request to read data from the repository. More...
|
|
Response | SendWriteRequest (const Request &request) override |
| Sends a request to write data to the repository. More...
|
|
size_t | GetFitsWriteThreshold () const |
|
void | SetFitsWriteThreshold (size_t value) |
| Sets the threshold for storing numerical matrices and vectors in FITS files rather than the YAML file. More...
|
|
virtual void | CreateDataPoint (const DataPointPath &path, const std::type_info &type)=0 |
| Creates a new datapoint in the repository with a specified type. More...
|
|
template<typename T > |
void | CreateDataPoint (const DataPointPath &path) |
| Creates a new datapoint in the repository. More...
|
|
template<typename T > |
void | CreateDataPoint (const DataPointPath &path, const T default_value) |
| Creates a new datapoint in the repository and sets a default value. More...
|
|
template<> |
void | CreateDataPoint (const DataPointPath &path, const char *default_value) |
|
virtual | ~RepositoryIf () |
|
template<typename T > |
void | CreateDataPoint (const DataPointPath &path) |
| Creates a new datapoint in the repository. More...
|
|
template<typename T > |
void | CreateDataPoint (const DataPointPath &path, const T default_value) |
| Creates a new datapoint in the repository and sets a default value. More...
|
|
template<typename T > |
T | GetDataPoint (const DataPointPath &path) const |
| Fetches a datapoint from the repository. More...
|
|
template<typename T > |
void | SetDataPoint (const DataPointPath &path, const T value) |
| Sets a datapoint in the repository. More...
|
|
template<typename T > |
void | ReadDataPoint (const DataPointPath &path, T &buffer) const |
| Reads a datapoint from the repository. More...
|
|
template<typename T > |
void | WriteDataPoint (const DataPointPath &path, const T &buffer) |
| Writes a datapoint to the repository. More...
|
|
void | WriteDataPoint (const DataPointPath &path, const char *buffer) |
|
template<> |
void | CreateDataPoint (const DataPointPath &path, const char *default_value) |
|
template<> |
void | SetDataPoint (const DataPointPath &path, const char *value) |
|
virtual | ~OldbIf ()=default |
|
virtual | ~RepositorySubscriberIf () |
|
template<typename T , typename F > |
void | Subscribe (const DataPointPath &path, T &buffer, F handler) const |
| A convenience template function that will register a callback to receive new datapoint values in a synchronous manner. More...
|
|
void | Unsubscribe (const DataPointPath &path) const |
| A simple convenience function that will deregister all callbacks for receiving new datapoint values. More...
|
|
A file based OLDB adapter that simulates OLDB with a local YAML file.
This class is used to simulate access to OLDB when it is not feasible to provide a full working OLDB and access it through OldbAdapter
. Its use should be restricted to development and certain integration testing, since it is not written with scalability and performance in mind.
The data is stored to and read from a local YAML file, who's location is given as a file scheme URI. The YAML file format uses nested dictionaries to represent the hierarchical tree structure that corresponds to the datapoint paths. For example, if we have 3 datapoints, an integer with a path of "topdir/subdir/dp1", a floating point with a path of "topdir/subdir/dp2" and a string with a path of "topdir/dp3", this would correspond to the following YAML:
topdir:
subdir:
dp1:
type: RtcInt32
value: 123
dp2:
type: RtcFloat
value: 4.5
dp3:
type: RtcString
value: "somevalue"
As can be seen in the above example YAML, each datapoint has the fundamental data type stored under the type
field and its value is found under the value
field.
The allowed values for type
are one of the following:
- RtcBool - A boolean type corresponding to
bool
, i.e. can store true
or false
.
- RtcInt32 - A 32 bit signed integer corresponding to
int32_t
.
- RtcInt64 - A 64 bit signed integer corresponding to
int64_t
.
- RtcFloat - A 32 bit floating-point number corresponding to
float
.
- RtcDouble - A 64 bit floating-point number corresponding to
double
.
- RtcString - An ASCII character string corresponding to
std::string
.
- RtcVectorBool - A vector of boolean values corresponding to
std::vector<bool>
.
- RtcVectorInt32 - A vector of 32 bit signed integers corresponding to
std::vector<int32_t>
.
- RtcVectorInt64 - A vector of 64 bit signed integers corresponding to
std::vector<int64_t>
.
- RtcVectorFloat - A vector of 32 bit floating-point numbers corresponding to
std::vector<float>
.
- RtcVectorDouble - A vector of 64 bit floating-point numbers corresponding to
std::vector<double>
.
- RtcVectorString - A vector of ASCII character strings corresponding to
std::vector<std::string>
.
- RtcMatrixBool - A matrix of boolean values corresponding to
MatrixBuffer<bool>
.
- RtcMatrixInt32 - A matrix of 32 bit signed integers corresponding to
MatrixBuffer<int32_t>
.
- RtcMatrixInt64 - A matrix of 64 bit signed integers corresponding to
MatrixBuffer<int64_t>
.
- RtcMatrixFloat - A matrix of 32 bit floating-point numbers corresponding to
MatrixBuffer<float>
.
- RtcMatrixDouble - A matrix of 64 bit floating-point numbers corresponding to
MatrixBuffer<double>
.
- RtcMatrixString - A matrix of ASCII character strings corresponding to
MatrixBuffer<std::string>
.
Note that vectors and matrices are both stored as lists in the YAML format. However, matrices will have the additional fields nrows
and ncols
set. For example:
topdir:
matrix_datapoint:
type: RtcMatrixFloat
nrows: 2
ncols: 3
value: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
- Thread Safety
- thread-safe – File based locking is used to make all read/write methods synchronous between all processes and threads, in addition to mutex locking to protect the structures of this class.