CORBA::Object_ptr SALOME_Fake_NamingService::ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc)
{
- std::ostringstream oss;
- oss << SEP << "Containers" << SEP << hostname << SEP << containerName << SEP << componentName << "_inst_";
- std::string entryToFind(oss.str());
+ std::string entryToFind(BuildComponentName(hostname,containerName,componentName,nbproc));
{
std::lock_guard<std::mutex> g(_mutex);
std::vector<std::string> candidates;
return ret;
}
+std::string SALOME_NamingService_Abstract::BuildComponentName(const char* hostname, const char* containerName, const char* componentName, const int /*nbproc*/)
+{
+ std::ostringstream oss;
+ oss << SEP << "Containers" << SEP << hostname << SEP << containerName << SEP << componentName << "_inst_";
+ return oss.str();
+}
+
+std::vector< std::string > SALOME_NamingService_Abstract_Decorator::repr()
+{
+ return std::vector< std::string >();
+}
+
+void SALOME_NamingService_Abstract_Decorator::Destroy_Directory(const char* Path)
+{
+ THROW_SALOME_EXCEPTION("SALOME_NamingService_Abstract_Decorator::Destroy_Directory");
+}
+
+bool SALOME_NamingService_Abstract_Decorator::Change_Directory(const char* Path)
+{//do nothing
+ return true;
+}
+
+std::vector<std::string> SALOME_NamingService_Abstract_Decorator::list_subdirs()
+{
+ THROW_SALOME_EXCEPTION("SALOME_NamingService_Abstract_Decorator::list_subdirs");
+}
+
+std::vector<std::string> SALOME_NamingService_Abstract_Decorator::list_directory()
+{
+ THROW_SALOME_EXCEPTION("SALOME_NamingService_Abstract_Decorator::list_directory");
+}
+
+std::vector<std::string> SALOME_NamingService_Abstract_Decorator::list_directory_recurs()
+{
+ THROW_SALOME_EXCEPTION("SALOME_NamingService_Abstract_Decorator::list_directory_recurs");
+}
+
+CORBA::Object_ptr SALOME_NamingService_Abstract_Decorator::ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc)
+{
+ std::string entryToFind(BuildComponentName(hostname,containerName,componentName,nbproc));
+ return _ns_cont->Resolve(entryToFind.c_str());
+}
static std::string ContainerName(const char *ContainerName);
static std::string BuildContainerNameForNS(const char *ContainerName, const char *hostname);
static std::string BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname);
+ static std::string BuildComponentName(const char* hostname, const char* containerName, const char* componentName, const int nbproc);
};
+
+class SALOME_NamingService_Abstract_Decorator : public SALOME_NamingService_Abstract
+{
+public:
+ SALOME_NamingService_Abstract_Decorator(SALOME_NamingService_Container_Abstract *ns_cont):_ns_cont(ns_cont) { }
+ void init_orb(CORBA::ORB_ptr orb=0) override { _ns_cont->init_orb(orb); }
+ SALOME_NamingService_Container_Abstract *clone() override { return new SALOME_NamingService_Abstract_Decorator(_ns_cont); }
+ void Register(CORBA::Object_ptr ObjRef, const char* Path) override { _ns_cont->Register(ObjRef,Path); }
+ void Destroy_FullDirectory(const char* Path) override { _ns_cont->Destroy_FullDirectory(Path); }
+ void Destroy_Name(const char* Path) override { _ns_cont->Destroy_Name(Path); }
+ CORBA::Object_ptr Resolve(const char* Path) override { return _ns_cont->Resolve(Path); }
+ CORBA::Object_ptr ResolveFirst(const char* Path) override { return _ns_cont->ResolveFirst(Path); }
+ bool IsTrueNS() const override { return _ns_cont->IsTrueNS(); }
+ //
+ std::vector< std::string > repr() override;
+ void Destroy_Directory(const char* Path) override;
+ bool Change_Directory(const char* Path) override;
+ std::vector<std::string> list_subdirs() override;
+ std::vector<std::string> list_directory() override;
+ std::vector<std::string> list_directory_recurs() override;
+ CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) override;
+private:
+ //! take no ownership of decoree
+ SALOME_NamingService_Container_Abstract *_ns_cont = nullptr;
+};
+