WriterManager operates on references

This commit is contained in:
2018-02-05 18:34:09 +01:00
parent 3542a78f49
commit 7cc3c0f0bb
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -5,7 +5,7 @@
using namespace std;
WriterManager::WriterManager(const map<string, DATA_TYPE>* parameters_type, uint64_t n_frames):
WriterManager::WriterManager(const map<string, DATA_TYPE>& parameters_type, uint64_t n_frames):
parameters_type(parameters_type), n_frames(n_frames), running_flag(true), killed_flag(false),
n_received_frames(0), n_written_frames(0), n_lost_frames(0)
{
@@ -89,7 +89,7 @@ void WriterManager::set_parameters(const map<string, boost::any>& new_parameters
#endif
}
const map<string, DATA_TYPE>* WriterManager::get_parameters_type()
const map<string, DATA_TYPE>& WriterManager::get_parameters_type()
{
return parameters_type;
}
@@ -128,7 +128,7 @@ bool WriterManager::are_all_parameters_set()
{
lock_guard<mutex> lock(parameters_mutex);
for (const auto& parameter : *parameters_type) {
for (const auto& parameter : parameters_type) {
const auto& parameter_name = parameter.first;
if (parameters.count(parameter_name) == 0) {
+3 -3
View File
@@ -16,7 +16,7 @@ class WriterManager
std::mutex parameters_mutex;
// Initialize in constructor.
const std::map<std::string, DATA_TYPE>* parameters_type;
const std::map<std::string, DATA_TYPE>& parameters_type;
size_t n_frames;
std::atomic_bool running_flag;
std::atomic_bool killed_flag;
@@ -25,7 +25,7 @@ class WriterManager
std::atomic<uint64_t> n_lost_frames;
public:
WriterManager(const std::map<std::string, DATA_TYPE>* parameters_type, uint64_t n_frames=0);
WriterManager(const std::map<std::string, DATA_TYPE>& parameters_type, uint64_t n_frames=0);
void stop();
void kill();
bool is_running();
@@ -33,7 +33,7 @@ class WriterManager
std::string get_status();
bool are_all_parameters_set();
const std::map<std::string, DATA_TYPE>* get_parameters_type();
const std::map<std::string, DATA_TYPE>& get_parameters_type();
std::map<std::string, boost::any> get_parameters();
void set_parameters(const std::map<std::string, boost::any>& new_parameters);