Adds further ext deps as-is binaries copies from customers env.
Qt6 Migration CI / migrate (push) Canceled after 0s
Qt6 Migration CI / migrate (push) Canceled after 0s
This commit is contained in:
3700 files changed
+2132394
No files matched your search
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
#include "ddkit/base/Config.hpp"
|
||||
#include "ddkit/access/TopicPoolRead.hpp"
|
||||
#include "ddkit/access/TopicPoolWrite.hpp"
|
||||
|
||||
namespace ddkit {
|
||||
namespace access {
|
||||
|
||||
class ModelMonitor final {
|
||||
public:
|
||||
ModelMonitor(
|
||||
base::Config& config,
|
||||
bool isWrite,
|
||||
bool isRmodel,
|
||||
const std::string& header,
|
||||
int domain,
|
||||
const IQosStrategyPtr& qosStrategy,
|
||||
const ITopicStrategyPtr& topicStrategy);
|
||||
|
||||
// start current module for addition
|
||||
void startModule(const std::string& moduleName);
|
||||
|
||||
// ... for current module
|
||||
template <typename T>
|
||||
void addTopic();
|
||||
|
||||
// listen forever
|
||||
void doRun();
|
||||
|
||||
private:
|
||||
base::Config& m_config;
|
||||
bool m_isWrite;
|
||||
bool m_isRmodel;
|
||||
std::string m_header;
|
||||
int m_domain;
|
||||
std::shared_ptr<Dispatcher> m_dispatcher;
|
||||
Participant m_participant;
|
||||
TopicPoolWrite m_topicPoolWrite;
|
||||
TopicPoolRead m_topicPoolRead;
|
||||
|
||||
std::string m_moduleCurrent;
|
||||
int m_ctCurrent;
|
||||
int m_ctTotal;
|
||||
std::map<std::string, int> m_module2ct;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void ModelMonitor::addTopic() {
|
||||
DDKIT_LOG_TRACE;
|
||||
|
||||
std::string typeName = dds::topic::topic_type_name<T>::value();
|
||||
if (m_isRmodel) {
|
||||
ddkit::utils::string::removePrefix(typeName, "VendorData::");
|
||||
}
|
||||
|
||||
std::string partFirst = typeName.substr(0, typeName.find("::"));
|
||||
std::string partLast = typeName.substr(typeName.rfind("::") + 2);
|
||||
std::string moduleName = partFirst;
|
||||
std::string topicName = partLast;
|
||||
|
||||
ddkit::log::trace() << DDKIT_LOG_VAR_VALUE(moduleName);
|
||||
ddkit::log::trace() << DDKIT_LOG_VAR_VALUE(m_moduleCurrent);
|
||||
|
||||
if(moduleName != m_moduleCurrent){
|
||||
ddkit::log::error() << "ModelMonitor::addTopic: mismatch in module name: \"" << m_moduleCurrent << "\" in class and \"" << moduleName << "\" in topic_type_name.";
|
||||
return;
|
||||
}
|
||||
|
||||
// bei isRmodel muss das config-format anders werden IService.ConfigAbc ...
|
||||
std::string key = "module." + moduleName + "." + topicName;
|
||||
bool isOn = m_config.hasKey(key) && m_config.getBoolValue(key);
|
||||
ddkit::log::trace() << key;
|
||||
if (isOn) {
|
||||
++m_ctCurrent;
|
||||
if (m_isWrite) {
|
||||
std::ostringstream deadEnd; deadEnd << "not implemented yet"; // todo
|
||||
ddkit::log::fatal() << deadEnd.str();
|
||||
throw std::logic_error(deadEnd.str());
|
||||
// m_topicPoolWrite.createTopicWrite<T>();
|
||||
} else {
|
||||
m_topicPoolRead.createTopicRead<T>(
|
||||
[=](T const& val) { std::cout << m_header << typeName << ": " << val << std::endl; });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace access
|
||||
} // namespace ddkit
|
||||
Reference in new issue
Block a user