Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] feature/id-based-descgate #1708

Merged
merged 7 commits into from
Aug 19, 2024
Merged
62 changes: 58 additions & 4 deletions ecal/core/include/ecal/ecal_registration.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ namespace eCAL
using TopicId = std::uint64_t;
struct SQualityTopicInfo
{
TopicId id = 0;
SDataTypeInformation info;
DescQualityFlags quality = DescQualityFlags::NO_QUALITY;

bool operator<(const SQualityTopicInfo& other) const
{
return std::tie(quality, id) < std::tie(other.quality, other.id);
return std::tie(quality, info) < std::tie(other.quality, info);
}
};
using QualityTopicInfoMultiMap = std::multimap<std::string, SQualityTopicInfo>;
Expand All @@ -73,14 +72,13 @@ namespace eCAL
using ServiceId = std::uint64_t;
struct SQualityServiceInfo
{
ServiceId id = 0;
SServiceMethodInformation info;
DescQualityFlags request_quality = DescQualityFlags::NO_QUALITY;
DescQualityFlags response_quality = DescQualityFlags::NO_QUALITY;

bool operator<(const SQualityServiceInfo& other) const
{
return std::tie(request_quality, response_quality, id) < std::tie(other.request_quality, other.response_quality, other.id);
return std::tie(request_quality, response_quality) < std::tie(other.request_quality, other.response_quality);
}
};
struct SServiceMethod
Expand All @@ -96,6 +94,62 @@ namespace eCAL
using QualityServiceInfoMultimap = std::multimap<SServiceMethod, SQualityServiceInfo>;
using SQualityServiceInfoSet = std::set<SQualityServiceInfo>;

/**
* @brief Get complete snapshot of all known publisher.
*
* @return Set of topic id's.
**/
ECAL_API std::set<STopicId> GetPublisherIDs();

/**
* @brief Get data type information with quality for specific publisher.
*
* @return True if information could be queried.
**/
ECAL_API bool GetPublisherInfo(const STopicId& id_, SQualityTopicInfo& topic_info_);

/**
* @brief Get complete snapshot of all known subscriber.
*
* @return Set of topic id's.
**/
ECAL_API std::set<STopicId> GetSubscriberIDs();

/**
* @brief Get data type information with quality for specific subscriber.
*
* @return True if information could be queried.
**/
ECAL_API bool GetSubscriberInfo(const STopicId& id_, SQualityTopicInfo& topic_info_);

/**
* @brief Get complete snapshot of all known services.
*
* @return Set of service id's.
**/
ECAL_API std::set<SServiceId> GetServiceIDs();

/**
* @brief Get service method information with quality for specific service.
*
* @return True if information could be queried.
**/
ECAL_API bool GetServiceInfo(const SServiceId& id_, SQualityServiceInfo& service_info_);

/**
* @brief Get complete snapshot of all known clients.
*
* @return Set of service id's.
**/
ECAL_API std::set<SServiceId> GetClientIDs();

/**
* @brief Get service method information with quality for specific client.
*
* @return True if information could be queried.
**/
ECAL_API bool GetClientInfo(const SServiceId& id_, SQualityServiceInfo& service_info_);

/**
* @brief Get complete snapshot of data type information with quality and topic id for all known publisher.
*
Expand Down
45 changes: 45 additions & 0 deletions ecal/core/include/ecal/ecal_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,49 @@ namespace eCAL
}
//!< @endcond
};

namespace Registration
{
struct SampleIdentifier
{
std::string entity_id; // unique id within that process
int32_t process_id = 0; // process id which produced the sample
std::string host_name; // host which produced the sample

bool operator==(const SampleIdentifier& other) const {
return entity_id == other.entity_id &&
process_id == other.process_id &&
host_name == other.host_name;
}

bool operator<(const SampleIdentifier& other) const
{
return std::tie(process_id, entity_id, host_name)
< std::tie(other.process_id, other.entity_id, other.host_name);
}
};

struct STopicId
{
Registration::SampleIdentifier topic_id;
std::string topic_name;

bool operator<(const STopicId& other) const
{
return std::tie(topic_id, topic_name) < std::tie(other.topic_id, other.topic_name);
}
};

struct SServiceId
{
Registration::SampleIdentifier service_id;
std::string service_name;
std::string method_name;

bool operator<(const SServiceId& other) const
{
return std::tie(service_id, service_name, method_name) < std::tie(other.service_id, other.service_name, other.method_name);
}
};
}
}
Loading
Loading