57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "ddkit/base/ThreadSync.hpp"
|
|
#include "ddkit/access/TopicPoolWrite.hpp"
|
|
#include "ddkit/access/TopicPoolRead.hpp"
|
|
#include "ddkit/idls/ActorInfo.hpp"
|
|
#include "ddkit/actors/ActorInfo.hpp"
|
|
#include "ddkit/actors/ILocalServices.hpp"
|
|
|
|
|
|
namespace ddkit {
|
|
namespace actors {
|
|
|
|
/// @brief DDS-Database for all ddkit_intern::ActorInfo on the network.
|
|
/// The data is added/removed by the ActorInfoDbCaretaker.
|
|
class ActorInfoDb {
|
|
|
|
public:
|
|
ActorInfoDb(ILocalServices& localServices);
|
|
~ActorInfoDb();
|
|
|
|
void updateActorInfo(ddkit_intern::ActorInfo actorInfo, int domainId);
|
|
void removeActorInfo(ddkit_intern::ActorInfo actorInfo, int domainId);
|
|
|
|
// for "find()"
|
|
std::vector<ActorInfo> findActorInfo(const std::string& module, bool isService, int domain);
|
|
std::vector<ActorInfo> findActorInfo(
|
|
const std::string& module, bool isService, int domain, const std::string& serviceName);
|
|
std::vector<ActorInfo> findActorInfo(ActorConfiguration config);
|
|
std::vector<ActorInfo> findActorInfo(const std::string& actorId);
|
|
|
|
// for "isRunning()"
|
|
bool hasService(const std::string& module, int domain, const std::string& serviceName);
|
|
|
|
// for "wait()"
|
|
void waitForService(const std::string& module, int domain, const std::string& serviceName);
|
|
|
|
// access meta-infos for callbackInfo
|
|
std::string clientActorId2clientName(const std::string& clientActorId);
|
|
|
|
private:
|
|
std::recursive_mutex m_mutex;
|
|
std::condition_variable_any m_dbChanged;
|
|
ILocalServices& m_localServices;
|
|
|
|
std::vector<ddkit_intern::ActorInfo> m_actorInfos;
|
|
std::map<std::string, std::string> m_discardedActorIdToClientName;
|
|
|
|
// no copying
|
|
ActorInfoDb(ActorInfoDb const&) = delete;
|
|
ActorInfoDb(ActorInfoDb&&) = delete;
|
|
void operator=(ActorInfoDb const&) = delete;
|
|
};
|
|
|
|
} // namespace actors
|
|
} // namespace ddkit
|