RTC Toolkit 6.0.0-pre2
Loading...
Searching...
No Matches
populateConfig.hpp
Go to the documentation of this file.
1
12
13#ifndef RTCTK_COMPONENTFRAMEWORK_POPULATECONFIG_HPP
14#define RTCTK_COMPONENTFRAMEWORK_POPULATECONFIG_HPP
15
16#include <functional>
17#include <map>
18#include <optional>
19#include <typeindex>
20
25
27
47public:
53 public:
54 // using RtctkException::RtctkException;
55
61 explicit RepositoryServiceException(const std::string& repository);
62 };
63
69 public:
75 explicit InvalidConfigException(const std::vector<std::string>& errors);
76 };
77
83 public:
90 explicit InvalidDataPointException(const DataPointPath& path,
91 const std::string& explanation = "");
92 };
93
95 PopulateConfig() = delete;
96
99
102
105
108
123
154 bool IsDisablePopulateFlagSet(const std::string& rtc_supervisor);
155
183 bool IsDisableValidateFlagSet(const std::string& rtc_supervisor);
184
206 void ValidatePersistentRepository() const;
207
214 void ClearConfig();
215
226 void PrePopulateConfig(const std::string& active_deployment_set);
227
240 void PopulateRuntimeRepo(StopToken stop_token,
241 const std::map<std::string, std::string>& requested_modes);
242
277
283 std::multimap<std::string, std::string> GetAvailableModes() const;
284
292 std::map<std::string, std::string> GetDefaultModes() const;
293
301 std::map<std::string, std::string> GetActiveModes();
302
310 void ValidateRequestedModes(const std::map<std::string, std::string>& requested_modes) const;
311
321 void CopyRequestedModes(const std::map<std::string, std::string>& requested_modes,
322 bool allow_non_dynamic_mode_options = false);
323
337 void CopyHierarchy(const DataPointPath& source, const DataPointPath& target);
338
352 void CopyDataPoint(const DataPointPath& source, const DataPointPath& target);
353
366 void ValidateWriteBack(const std::vector<DataPointPath>& datapoints);
367
382 void WriteBack(StopToken stop, const std::vector<DataPointPath>& datapoints);
383
384private:
385 void SetActiveModes(const std::map<std::string, std::string>& active_modes);
386 DataPointPath GetActiveDeploymentPath() const;
387 void CopyDefaults(const DataPointPath& active_deployment_path);
388 void CopyModes(const DataPointPath& active_deployment_path);
389 void DeleteHierarchy(const DataPointPath& path);
390 void ComputeParameterMappings();
391 void WriteBackDataPoint(const DataPointPath& source, const DataPointPath& target);
392 void EnsureModeHierarchyIsDynamic(const DataPointPath&);
393
394 log4cplus::Logger& m_logger;
395
397 PersistentRepoIf& m_persistent_repo;
398
400 RuntimeRepoIf& m_runtime_repo;
401
403 struct IoFunctionMapEntry {
404 using CopyFunction = std::function<void(
406
407 using WriteBackFunction = std::function<void(
409
410 CopyFunction m_copy_function;
411 WriteBackFunction m_writeback_function;
412 };
413
414 std::map<DataPointPath, DataPointPath> m_psr_to_rtr_map;
415 std::map<DataPointPath, DataPointPath> m_rtr_to_psr_map;
416};
417
418} // namespace rtctk::componentFramework
419
420#endif // RTCTK_COMPONENTFRAMEWORK_POPULATECONFIG_HPP
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:77
Base interface for all Persistent Configuration Repository adapters.
Definition persistentRepoIf.hpp:25
RtctkException() noexcept
Definition exceptions.cpp:113
InvalidConfigException(const std::vector< std::string > &errors)
Constructs the exception indicating the configuration is not valid.
Definition populateConfig.cpp:459
InvalidDataPointException(const DataPointPath &path, const std::string &explanation="")
Constructs the exception indicating an invalid datapoint.
Definition populateConfig.cpp:465
RepositoryServiceException(const std::string &repository)
Constructs the exception indicating a problem occurred when accessing the named repository.
Definition populateConfig.cpp:452
void CopyHierarchy(const DataPointPath &source, const DataPointPath &target)
Copy a hierarchy of datapoints from the source to the target repository.
Definition populateConfig.cpp:793
PopulateConfig(const PopulateConfig &)=delete
This class cannot be copy constructed.
PopulateConfig()=delete
Do not allow construction with no arguments.
std::multimap< std::string, std::string > GetAvailableModes() const
Returns available modes for the active deployment set.
Definition populateConfig.cpp:595
void PopulateRuntimeRepo(StopToken stop_token, const std::map< std::string, std::string > &requested_modes)
Populates the Runtime Configuration Repository.
Definition populateConfig.cpp:533
void WriteBack(StopToken stop, const std::vector< DataPointPath > &datapoints)
Performs the a writeback operation.
Definition populateConfig.cpp:911
void ValidateWriteBack(const std::vector< DataPointPath > &datapoints)
Performs additional input validation for the WriteBack method.
Definition populateConfig.cpp:891
PopulateConfig & operator=(PopulateConfig &&)=default
Objects of this class can be moved with the move assignment operator.
void ValidatePersistentRepository() const
Perform various validation tests on the Persistent Configuration Repository.
Definition populateConfig.cpp:476
PopulateConfig(PopulateConfig &&)=default
Objects of this class can be moved.
void ClearConfig()
Wipes the contents of the Runtime Configuration Repository.
Definition populateConfig.cpp:508
PopulateConfig & operator=(const PopulateConfig &)=delete
This class cannot be copy assigned.
void CopyRequestedModes(const std::map< std::string, std::string > &requested_modes, bool allow_non_dynamic_mode_options=false)
Apply requested modes by copying datapoints from source to target repository.
Definition populateConfig.cpp:692
std::map< std::string, std::string > GetActiveModes()
Returns active modes for the active deployment set.
Definition populateConfig.cpp:630
bool IsDisableValidateFlagSet(const std::string &rtc_supervisor)
Checks if the disable_validate flag has been set for the RTC Supervisor.
Definition populateConfig.cpp:565
std::map< std::string, std::string > GetDefaultModes() const
Returns default modes for the active deployment set.
Definition populateConfig.cpp:615
bool IsDisablePopulateFlagSet(const std::string &rtc_supervisor)
Checks if the disable_populate flag has been set for the RTC Supervisor.
Definition populateConfig.cpp:549
void CopyActiveDeploymentSet()
Copies the active Deployment Set to the Runtime Configuration Repository.
Definition populateConfig.cpp:581
void ValidateRequestedModes(const std::map< std::string, std::string > &requested_modes) const
Performs input validation for requested_modes.
Definition populateConfig.cpp:665
void PrePopulateConfig(const std::string &active_deployment_set)
Performs a minimal, partial population of the Runtime Configuration Repository.
Definition populateConfig.cpp:527
void CopyDataPoint(const DataPointPath &source, const DataPointPath &target)
Copy a single datapoint from the source to the target repository.
Definition populateConfig.cpp:805
RtctkException() noexcept
Definition exceptions.cpp:113
Base interface for all Runtime Configuration Repository adapters.
Definition runtimeRepoIf.hpp:27
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:22
rad::StopToken StopToken
Definition stopToken.hpp:20
PopulateConfig::InvalidDataPointException InvalidDataPointException
Definition populateConfig.cpp:34
PopulateConfig::RepositoryServiceException RepositoryServiceException
Definition populateConfig.cpp:32
PopulateConfig::InvalidConfigException InvalidConfigException
Definition populateConfig.cpp:33
Header file for PersistentRepoIf, which defines the API for PersistentRepoAdapter.
Header file for RuntimeRepoIf, which defines the API for RuntimeRepoAdapters.
A simple Stop Token.