Skip to content

Commit

Permalink
sync-with-eclipse-ecal-2024-08-02
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Aug 6, 2024
1 parent 15cd47f commit 2e072d8
Show file tree
Hide file tree
Showing 19 changed files with 510 additions and 365 deletions.
16 changes: 8 additions & 8 deletions ecal/core/src/ecal_descgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ namespace eCAL
response_type.name = method.resp_type;
response_type.descriptor = method.resp_desc;

ApplyServiceDescription(m_service_info_map, sample_.service.sname, method.mname, std::stoull(sample_.service.sid), request_type, response_type, GetDataTypeInfoQuality(request_type, true), GetDataTypeInfoQuality(response_type, true));
ApplyServiceDescription(m_service_info_map, sample_.service.sname, method.mname, std::stoull(sample_.identifier.entity_id), request_type, response_type, GetDataTypeInfoQuality(request_type, true), GetDataTypeInfoQuality(response_type, true));
}
}
break;
case bct_unreg_service:
RemServiceDescription(m_service_info_map, sample_.service.sname, std::stoull(sample_.service.sid));
RemServiceDescription(m_service_info_map, sample_.service.sname, std::stoull(sample_.identifier.entity_id));
break;
case bct_reg_client:
for (const auto& method : sample_.client.methods)
Expand All @@ -143,23 +143,23 @@ namespace eCAL
response_type.name = method.resp_type;
response_type.descriptor = method.resp_desc;

ApplyServiceDescription(m_client_info_map, sample_.client.sname, method.mname, std::stoull(sample_.client.sid), request_type, response_type, GetDataTypeInfoQuality(request_type, false), GetDataTypeInfoQuality(response_type, false));
ApplyServiceDescription(m_client_info_map, sample_.client.sname, method.mname, std::stoull(sample_.identifier.entity_id), request_type, response_type, GetDataTypeInfoQuality(request_type, false), GetDataTypeInfoQuality(response_type, false));
}
break;
case bct_unreg_client:
RemServiceDescription(m_client_info_map, sample_.client.sname, std::stoull(sample_.client.sid));
RemServiceDescription(m_client_info_map, sample_.client.sname, std::stoull(sample_.identifier.entity_id));
break;
case bct_reg_publisher:
ApplyTopicDescription(m_publisher_info_map, sample_.topic.tname, std::stoull(sample_.topic.tid), sample_.topic.tdatatype, GetDataTypeInfoQuality(sample_.topic.tdatatype, true));
ApplyTopicDescription(m_publisher_info_map, sample_.topic.tname, std::stoull(sample_.identifier.entity_id), sample_.topic.tdatatype, GetDataTypeInfoQuality(sample_.topic.tdatatype, true));
break;
case bct_unreg_publisher:
RemTopicDescription(m_publisher_info_map, sample_.topic.tname, std::stoull(sample_.topic.tid));
RemTopicDescription(m_publisher_info_map, sample_.topic.tname, std::stoull(sample_.identifier.entity_id));
break;
case bct_reg_subscriber:
ApplyTopicDescription(m_subscriber_info_map, sample_.topic.tname, std::stoull(sample_.topic.tid), sample_.topic.tdatatype, GetDataTypeInfoQuality(sample_.topic.tdatatype, false));
ApplyTopicDescription(m_subscriber_info_map, sample_.topic.tname, std::stoull(sample_.identifier.entity_id), sample_.topic.tdatatype, GetDataTypeInfoQuality(sample_.topic.tdatatype, false));
break;
case bct_unreg_subscriber:
RemTopicDescription(m_subscriber_info_map, sample_.topic.tname, std::stoull(sample_.topic.tid));
RemTopicDescription(m_subscriber_info_map, sample_.topic.tname, std::stoull(sample_.identifier.entity_id));
break;
default:
{
Expand Down
45 changes: 27 additions & 18 deletions ecal/core/src/monitoring/ecal_monitoring_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ namespace eCAL
bool CMonitoringImpl::RegisterTopic(const Registration::Sample& sample_, enum ePubSub pubsub_type_)
{
const auto& sample_topic = sample_.topic;
const int process_id = sample_topic.pid;
const int process_id = sample_.identifier.process_id;
const std::string& topic_name = sample_topic.tname;
const int32_t topic_size = sample_topic.tsize;
bool topic_tlayer_ecal_udp(false);
Expand Down Expand Up @@ -253,11 +253,11 @@ namespace eCAL
const std::lock_guard<std::mutex> lock(pTopicMap->sync);

// common infos
const std::string& host_name = sample_topic.hname;
const std::string& host_name = sample_.identifier.host_name;
const std::string& host_group_name = sample_topic.hgname;
const std::string& process_name = sample_topic.pname;
const std::string& unit_name = sample_topic.uname;
const std::string& topic_id = sample_topic.tid;
const std::string& topic_id = sample_.identifier.entity_id;
std::string direction;
switch (pubsub_type_)
{
Expand Down Expand Up @@ -338,7 +338,7 @@ namespace eCAL
{
const auto& sample_topic = sample_.topic;
const std::string& topic_name = sample_topic.tname;
const std::string& topic_id = sample_topic.tid;
const std::string& topic_id = sample_.identifier.entity_id;

// unregister from topic map
STopicMonMap* pTopicMap = GetMap(pubsub_type_);
Expand All @@ -358,10 +358,10 @@ namespace eCAL
bool CMonitoringImpl::RegisterProcess(const Registration::Sample& sample_)
{
const auto& sample_process = sample_.process;
const std::string& host_name = sample_process.hname;
const std::string& host_name = sample_.identifier.host_name;
const std::string& host_group_name = sample_process.hgname;
const std::string& process_name = sample_process.pname;
const int process_id = sample_process.pid;
const int process_id = sample_.identifier.process_id;
const std::string& process_param = sample_process.pparam;
const std::string& unit_name = sample_process.uname;
const auto& sample_process_state = sample_process.state;
Expand Down Expand Up @@ -409,7 +409,7 @@ namespace eCAL
{
const auto& sample_process = sample_.process;
const std::string& process_name = sample_process.pname;
const int process_id = sample_process.pid;
const int process_id = sample_.identifier.process_id;

// create map key
const std::string process_name_id = process_name + std::to_string(process_id);
Expand All @@ -425,13 +425,16 @@ namespace eCAL

bool CMonitoringImpl::RegisterServer(const Registration::Sample& sample_)
{
const auto& sample_identifier = sample_.identifier;
const std::string& service_id = sample_identifier.entity_id;
const int32_t process_id = sample_identifier.process_id;
const std::string& host_name = sample_identifier.host_name;

const auto& sample_service = sample_.service;
const std::string& host_name = sample_service.hname;
const std::string& service_name = sample_service.sname;
const std::string& service_id = sample_service.sid;
const std::string& process_name = sample_service.pname;
const std::string& unit_name = sample_service.uname;
const int32_t process_id = sample_service.pid;

const uint32_t tcp_port_v0 = sample_service.tcp_port_v0;
const uint32_t tcp_port_v1 = sample_service.tcp_port_v1;

Expand Down Expand Up @@ -474,10 +477,12 @@ namespace eCAL

bool CMonitoringImpl::UnregisterServer(const Registration::Sample& sample_)
{
const auto& sample_service = sample_.service;
const auto& sample_service = sample_.service;
const auto& sample_identifier = sample_.identifier;

const std::string& service_name = sample_service.sname;
const std::string& service_id = sample_service.sid;
const int process_id = sample_service.pid;
const std::string& service_id = sample_identifier.entity_id;
const int process_id = sample_identifier.process_id;

// create map key
const std::string service_name_id = service_name + service_id + std::to_string(process_id);
Expand All @@ -493,13 +498,15 @@ namespace eCAL

bool CMonitoringImpl::RegisterClient(const Registration::Sample& sample_)
{
const auto& sample_identifier = sample_.identifier;
const std::string& service_id = sample_identifier.entity_id;
const int32_t process_id = sample_identifier.process_id;
const std::string& host_name = sample_identifier.host_name;

const auto& sample_client = sample_.client;
const std::string& host_name = sample_client.hname;
const std::string& service_name = sample_client.sname;
const std::string& service_id = sample_client.sid;
const std::string& process_name = sample_client.pname;
const std::string& unit_name = sample_client.uname;
const int process_id = sample_client.pid;

// create map key
const std::string service_name_id = service_name + service_id + std::to_string(process_id);
Expand Down Expand Up @@ -538,10 +545,12 @@ namespace eCAL

bool CMonitoringImpl::UnregisterClient(const Registration::Sample& sample_)
{
const auto& sample_identifier = sample_.identifier;
const std::string& service_id = sample_identifier.entity_id;
const int32_t process_id = sample_identifier.process_id;

const auto& sample_client = sample_.client;
const std::string& service_name = sample_client.sname;
const std::string& service_id = sample_client.sid;
const int process_id = sample_client.pid;

// create map key
const std::string service_name_id = service_name + service_id + std::to_string(process_id);
Expand Down
14 changes: 8 additions & 6 deletions ecal/core/src/pubsub/ecal_pubgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ namespace eCAL
// check topic name
if (topic_name.empty()) return;

// TODO: Substitute ProducerInfo type
CDataWriter::SSubscriptionInfo subscription_info;
subscription_info.host_name = ecal_topic.hname;
subscription_info.topic_id = ecal_topic.tid;
subscription_info.process_id = ecal_topic.pid;
subscription_info.host_name = ecal_sample_.identifier.host_name;
subscription_info.topic_id = ecal_sample_.identifier.entity_id;
subscription_info.process_id = ecal_sample_.identifier.process_id;
const SDataTypeInformation topic_information = ecal_topic.tdatatype;

CDataWriter::SLayerStates layer_states;
Expand Down Expand Up @@ -180,10 +181,11 @@ namespace eCAL
// check topic name
if (topic_name.empty()) return;

//TODO: Remove the subscription info type
CDataWriter::SSubscriptionInfo subscription_info;
subscription_info.host_name = ecal_topic.hname;
subscription_info.topic_id = ecal_topic.tid;
subscription_info.process_id = ecal_topic.pid;
subscription_info.host_name = ecal_sample_.identifier.host_name;
subscription_info.topic_id = ecal_sample_.identifier.entity_id;
subscription_info.process_id = ecal_sample_.identifier.process_id;

// unregister subscriber
const std::shared_lock<std::shared_timed_mutex> lock(m_topic_name_datawriter_sync);
Expand Down
14 changes: 8 additions & 6 deletions ecal/core/src/pubsub/ecal_subgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ namespace eCAL
// check topic name
if (topic_name.empty()) return;

// TODO: Remove the PublicationInfo type
CDataReader::SPublicationInfo publication_info;
publication_info.host_name = ecal_topic.hname;
publication_info.topic_id = ecal_topic.tid;
publication_info.process_id = ecal_topic.pid;
publication_info.host_name = ecal_sample_.identifier.host_name;
publication_info.topic_id = ecal_sample_.identifier.entity_id;
publication_info.process_id = ecal_sample_.identifier.process_id;
const SDataTypeInformation topic_information = ecal_topic.tdatatype;

CDataReader::SLayerStates layer_states;
Expand Down Expand Up @@ -282,10 +283,11 @@ namespace eCAL
// check topic name
if (topic_name.empty()) return;

// TODO: Remove the SPublicationInfo type!
CDataReader::SPublicationInfo publication_info;
publication_info.host_name = ecal_topic.hname;
publication_info.topic_id = ecal_topic.tid;
publication_info.process_id = ecal_topic.pid;
publication_info.host_name = ecal_sample_.identifier.host_name;
publication_info.topic_id = ecal_sample_.identifier.entity_id;
publication_info.process_id = ecal_sample_.identifier.process_id;

// unregister publisher
const std::shared_lock<std::shared_timed_mutex> lock(m_topic_name_datareader_sync);
Expand Down
16 changes: 10 additions & 6 deletions ecal/core/src/readwrite/ecal_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,14 @@ namespace eCAL
Registration::Sample ecal_reg_sample;
ecal_reg_sample.cmd_type = bct_reg_subscriber;

auto& ecal_reg_sample_identifier = ecal_reg_sample.identifier;
ecal_reg_sample_identifier.process_id = m_pid;
ecal_reg_sample_identifier.entity_id = m_topic_id;
ecal_reg_sample_identifier.host_name = m_host_name;

auto& ecal_reg_sample_topic = ecal_reg_sample.topic;
ecal_reg_sample_topic.hname = m_host_name;
ecal_reg_sample_topic.hgname = m_host_group_name;
ecal_reg_sample_topic.tname = m_topic_name;
ecal_reg_sample_topic.tid = m_topic_id;
// topic_information
{
auto& ecal_reg_sample_tdatatype = ecal_reg_sample_topic.tdatatype;
Expand Down Expand Up @@ -627,7 +630,6 @@ namespace eCAL
}
#endif

ecal_reg_sample_topic.pid = m_pid;
ecal_reg_sample_topic.pname = m_pname;
ecal_reg_sample_topic.uname = Process::GetUnitName();
ecal_reg_sample_topic.dclock = m_clock;
Expand All @@ -647,13 +649,15 @@ namespace eCAL
Registration::Sample ecal_unreg_sample;
ecal_unreg_sample.cmd_type = bct_unreg_subscriber;

auto& ecal_reg_sample_identifier = ecal_unreg_sample.identifier;
ecal_reg_sample_identifier.process_id = m_pid;
ecal_reg_sample_identifier.entity_id = m_topic_id;
ecal_reg_sample_identifier.host_name = m_host_name;

auto& ecal_reg_sample_topic = ecal_unreg_sample.topic;
ecal_reg_sample_topic.hname = m_host_name;
ecal_reg_sample_topic.hgname = m_host_group_name;
ecal_reg_sample_topic.pname = m_pname;
ecal_reg_sample_topic.pid = m_pid;
ecal_reg_sample_topic.tname = m_topic_name;
ecal_reg_sample_topic.tid = m_topic_id;
ecal_reg_sample_topic.uname = Process::GetUnitName();

return ecal_unreg_sample;
Expand Down
17 changes: 11 additions & 6 deletions ecal/core/src/readwrite/ecal_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,15 @@ namespace eCAL
Registration::Sample ecal_reg_sample;
ecal_reg_sample.cmd_type = bct_reg_publisher;

auto& ecal_reg_sample_identifier = ecal_reg_sample.identifier;
ecal_reg_sample_identifier.process_id = m_pid;
ecal_reg_sample_identifier.entity_id = m_topic_id;
ecal_reg_sample_identifier.host_name = m_host_name;

auto& ecal_reg_sample_topic = ecal_reg_sample.topic;
ecal_reg_sample_topic.hname = m_host_name;
ecal_reg_sample_topic.hgname = m_host_group_name;
ecal_reg_sample_topic.tname = m_topic_name;
ecal_reg_sample_topic.tid = m_topic_id;

// topic_information
{
auto& ecal_reg_sample_tdatatype = ecal_reg_sample_topic.tdatatype;
Expand Down Expand Up @@ -679,7 +683,6 @@ namespace eCAL
}
#endif

ecal_reg_sample_topic.pid = m_pid;
ecal_reg_sample_topic.pname = m_pname;
ecal_reg_sample_topic.uname = Process::GetUnitName();
ecal_reg_sample_topic.did = m_id;
Expand Down Expand Up @@ -711,13 +714,15 @@ namespace eCAL
Registration::Sample ecal_unreg_sample;
ecal_unreg_sample.cmd_type = bct_unreg_publisher;

auto& ecal_reg_sample_identifier = ecal_unreg_sample.identifier;
ecal_reg_sample_identifier.process_id = m_pid;
ecal_reg_sample_identifier.entity_id = m_topic_id;
ecal_reg_sample_identifier.host_name = m_host_name;

auto& ecal_reg_sample_topic = ecal_unreg_sample.topic;
ecal_reg_sample_topic.hname = m_host_name;
ecal_reg_sample_topic.hgname = m_host_group_name;
ecal_reg_sample_topic.pname = m_pname;
ecal_reg_sample_topic.pid = m_pid;
ecal_reg_sample_topic.tname = m_topic_name;
ecal_reg_sample_topic.tid = m_topic_id;
ecal_reg_sample_topic.uname = Process::GetUnitName();

return ecal_unreg_sample;
Expand Down
14 changes: 10 additions & 4 deletions ecal/core/src/registration/ecal_process_registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ eCAL::Registration::Sample eCAL::Registration::GetProcessRegisterSample()
{
Registration::Sample process_sample;
process_sample.cmd_type = bct_reg_process;

auto& process_sample_identifier = process_sample.identifier;
process_sample_identifier.host_name = eCAL::Process::GetHostName();
process_sample_identifier.process_id = eCAL::Process::GetProcessID();

auto& process_sample_process = process_sample.process;
process_sample_process.hname = eCAL::Process::GetHostName();
process_sample_process.hgname = eCAL::Process::GetHostGroupName();
process_sample_process.pid = eCAL::Process::GetProcessID();
process_sample_process.pname = eCAL::Process::GetProcessName();
process_sample_process.uname = eCAL::Process::GetUnitName();
process_sample_process.pparam = eCAL::Process::GetProcessParameter();
Expand Down Expand Up @@ -94,9 +97,12 @@ eCAL::Registration::Sample eCAL::Registration::GetProcessUnregisterSample()
{
Registration::Sample process_sample;
process_sample.cmd_type = bct_unreg_process;

auto& process_sample_identifier = process_sample.identifier;
process_sample_identifier.host_name = eCAL::Process::GetHostName();
process_sample_identifier.process_id = eCAL::Process::GetProcessID();

auto& process_sample_process = process_sample.process;
process_sample_process.hname = eCAL::Process::GetHostName();
process_sample_process.pid = eCAL::Process::GetProcessID();
process_sample_process.pname = eCAL::Process::GetProcessName();
process_sample_process.uname = eCAL::Process::GetUnitName();

Expand Down
Loading

0 comments on commit 2e072d8

Please sign in to comment.