Files
qt6-migration-pipeline/external/tmsif/include/ddkit/actors/ActorInfo.hpp
T
2026-10-23 16:13:31 +00:00

100 lines
3.0 KiB
C++

#pragma once
#include <random>
#include <string>
#include <set>
#include <ostream>
namespace ddkit {
namespace actors {
struct ActorInfo;
struct ActorConfiguration;
// serviceName must be simple (a-z...)
void checkApiServiceName(const std::string& serviceName);
void checkServiceNameIntern(const std::string& serviceName);
// M_Mount::IService
std::string interfaceNameApi(bool isService, const std::string& module);
// M_Mount::Service
std::string serviceClientNameApi(bool isService, const std::string& module);
std::ostream& operator<<(std::ostream& s, ActorConfiguration const& rhs);
struct ActorConfiguration {
ActorConfiguration(
const std::string& module,
bool isService,
int domain,
const std::string& serviceName);
ActorConfiguration(const ddkit::actors::ActorInfo& actorInfo);
ActorConfiguration() = default;
operator std::string() const {
if (serviceName.empty()) {
return std::string() + "(" + serviceClientNameApi(isService, module) + ", " + std::to_string(domain) + ", <no-servicename>)";
}
return std::string() + "(" + serviceClientNameApi(isService, module) + ", " + std::to_string(domain) + ", \"" + serviceName + "\")";
}
bool operator==(ActorConfiguration const& rhs) const;
bool operator<(ActorConfiguration const& rhs) const;
std::string module;
bool isService;
int domain;
std::string serviceName;
};
/// @brief this is "ServiceInfo" / "ClientInfo" really. Do not mistake this for ddkit_intern::ActorInfo (idl-generated class)
/// for monitoring applications like Listener
/// - do not use in other cases.
struct ActorInfo {
ActorInfo() = default;
ActorConfiguration config;
// also part of config (needed to disambiguate clients (multiple of same config allowed in network), also useful for error-detection of services)
std::string actorId;
int32_t processId;
std::string hostName;
std::string procName;
bool isReading;
std::vector<std::string> openReaders;
bool isWriting;
std::vector<std::string> openWriters;
// todo: maybe implement more informations here about the inherited interfaces? See section 7,
// possible Inspector-improvements
// maybe something like 'std::map<std::string, std::vector<std::string>> m_module2openReadersModule' would be
// fine here, but probably it's only a matter of display. Inspector can show everything without changes here.
std::string clientName; // client-display-Name, on service: filled with "undefined"
// on client: actorId or setName/create/add-given user-value
// bool isMonitor - no, not needed, the monitoring-actorInfos are not sent to the dds ... so true never shows up
// debug
friend std::ostream& operator<<(std::ostream& s, ActorInfo const& rhs);
operator std::string() const;
// set-order
bool operator<(ActorInfo const& rhs) const;
// default copying
};
typedef ActorInfo ServiceInfo;
typedef ActorInfo ClientInfo;
} // namespace actors
} // namespace ddkit