mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-23 20:10:44 +02:00
Implement get_parameters
This commit is contained in:
@@ -3,12 +3,15 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
WriterManager::WriterManager(uint64_t n_images):
|
||||
WriterManager::WriterManager(uint64_t n_images, std::string dataset_name):
|
||||
n_images(n_images), running_flag(true), n_received_frames(0), n_written_frames(0)
|
||||
{
|
||||
#ifdef DEBUG_OUTPUT
|
||||
cout << "[WriterManager::WriterManager] Writer manager for n_images " << n_images << endl;
|
||||
cout << "[WriterManager::WriterManager] Using dataset_name " << dataset_name << endl;
|
||||
#endif
|
||||
|
||||
parameters.insert({"dataset_name", dataset_name});
|
||||
}
|
||||
|
||||
void WriterManager::stop()
|
||||
@@ -40,11 +43,9 @@ map<string, uint64_t> WriterManager::get_statistics()
|
||||
return result;
|
||||
}
|
||||
|
||||
map<string, string>& WriterManager::get_parameters()
|
||||
map<string, string> WriterManager::get_parameters()
|
||||
{
|
||||
// TODO: Implement this.
|
||||
map<string, string> result = {};
|
||||
return result;
|
||||
return parameters;
|
||||
}
|
||||
|
||||
void WriterManager::set_parameters(map<string, string>& new_parameters)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
#include "config.hpp"
|
||||
|
||||
class WriterManager
|
||||
{
|
||||
@@ -16,13 +17,12 @@ class WriterManager
|
||||
std::atomic_int n_written_frames;
|
||||
|
||||
public:
|
||||
WriterManager(uint64_t n_images=0);
|
||||
WriterManager(uint64_t n_images=0, std::string dataset_name=config::dataset_name);
|
||||
void stop();
|
||||
std::string get_status();
|
||||
std::map<std::string, uint64_t> get_statistics();
|
||||
std::map<std::string, std::string> get_paramters();
|
||||
std::map<std::string, std::string> get_parameters();
|
||||
void set_parameters(std::map<std::string, std::string> &new_parameters);
|
||||
std::map<std::string, std::string>& get_parameters();
|
||||
bool is_running();
|
||||
void received_frame(size_t frame_index);
|
||||
void written_frame(size_t frame_index);
|
||||
|
||||
@@ -62,9 +62,9 @@ void start_rest_api(WriterManager& writer_manager, uint16_t port)
|
||||
|
||||
if (req.method == "GET"_method) {
|
||||
|
||||
// for (const auto& item : writer_manager.get_paramters()) {
|
||||
// result[item.first] = item.second;
|
||||
// }
|
||||
for (const auto& item : writer_manager.get_parameters()) {
|
||||
result[item.first] = item.second;
|
||||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user