-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
bool Engines_Parallel_Component_i::_isMultiInstance = false;
//=============================================================================
-/*!
+/*!
* Standard Constructor for generic Component, used in derived class
* Connection to Registry and Notification
* \param orb Object Request broker given by Container
//=============================================================================
Engines_Parallel_Component_i::Engines_Parallel_Component_i(CORBA::ORB_ptr orb, char * ior, int rank,
- PortableServer::POA_ptr poa,
- PortableServer::ObjectId * contId,
+ PortableServer::POA_ptr poa,
+ PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName,
bool notif,
bool regist) :
- InterfaceParallel_impl(orb,ior,rank),
+ InterfaceParallel_impl(orb,ior,rank),
Engines::EngineComponent_serv(orb,ior,rank),
Engines::EngineComponent_base_serv(orb,ior,rank),
Engines::Parallel_Component_serv(orb,ior,rank),
}
//=============================================================================
-/*!
+/*!
* Destructor: call Container for decrement of instances count.
* When instances count falls to 0, the container tries to remove the
* component library (dlclose)
}
//=============================================================================
-/*!
+/*!
* CORBA method: return name of the instance, unique in this Container
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* CORBA method: return name of the component class
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* CORBA method: Test if instance is alive and responds
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* CORBA method: Deactivate this instance. CORBA object is deactivated (do not
* respond any more to CORBA calls), the connection to Regsitry is removed
* (Registry informed of deactivation), internal server reference counter on
}
//=============================================================================
-/*!
+/*!
* CORBA method: return CORBA reference of the Container
*
*/
}
//=============================================================================
-/*!
- * CORBA method:
- * Gives a sequence of (key=string,value=any) to the component.
+/*!
+ * CORBA method:
+ * Gives a sequence of (key=string,value=any) to the component.
* Base class component stores the sequence in a map.
* The map is cleared before.
- * This map is for use by derived classes.
+ * This map is for use by derived classes.
* \param dico sequence of (key=string,value=any)
*/
//=============================================================================
}
//=============================================================================
-/*!
- * CORBA method:
+/*!
+ * CORBA method:
* returns a previously stored map (key=string,value=any) as a sequence.
* (see setProperties)
*/
}
//=============================================================================
-/*!
+/*!
* CORBA method: used by Supervision to give names to this instance
*/
//=============================================================================
{
_graphName = graphName;
_nodeName = nodeName;
- MESSAGE("Engines_Parallel_Component_i::Names( '" << _graphName << "' , '"
+ MESSAGE("Engines_Parallel_Component_i::Names( '" << _graphName << "' , '"
<< _nodeName << "' )");
}
//=============================================================================
-/*!
+/*!
* CORBA method: used in Supervision
*/
//=============================================================================
-bool Engines_Parallel_Component_i::Kill_impl()
+bool Engines_Parallel_Component_i::Kill_impl()
{
// MESSAGE("Engines_Parallel_Component_i::Kill_i() pthread_t "<< pthread_self()
// << " pid " << getpid() << " instanceName "
}
//=============================================================================
-/*!
+/*!
* CORBA method: used in Supervision
*/
//=============================================================================
<< " machineName " << Kernel_Utils::GetHostname().c_str()<< " _id " << hex << _id
<< dec << " _ThreadId " << _ThreadId );
#endif
-
+
bool RetVal = false ;
#ifndef WIN32
}
//=============================================================================
-/*!
+/*!
* CORBA method: used in Supervision
*/
//=============================================================================
{
return false ;
}
- else
+ else
{
#ifndef WIN32
RetVal = Killer( _ThreadId ,SIGINT ) ;
}
//=============================================================================
-/*!
+/*!
* CORBA method: used in Supervision
*/
//=============================================================================
if ( _ThreadId > 0 && pthread_self().p != _ThreadId->p )
#endif
{
- if ( _Sleeping )
+ if ( _Sleeping )
{
_Sleeping = false ;
RetVal = true ;
}
//=============================================================================
-/*!
- * CORBA method:
+/*!
+ * CORBA method:
*/
//=============================================================================
// << _serviceName << " " << cpu << std::endl ;
}
}
- else
+ else
{
cpu = _ThreadCpuUsed ;
// std::cout << pthread_self() << " Engines_Parallel_Component_i::CpuUsed_impl "
//=============================================================================
-/*!
+/*!
* C++ method: return Container Servant
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* C++ method: return CORBA instance id, the id is set in derived class
* constructor, when instance is activated.
*/
}
//=============================================================================
-/*!
+/*!
* C++ method: used by derived classes for supervision
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* C++ method: used by derived classes for supervision
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* C++ method: -- CHECK IF USED --
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* C++ method: -- CHECK IF USED --
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* C++ method: used in Supervision (see kill_impl)
*/
//=============================================================================
perror("Killer pthread_kill error") ;
return false ;
}
- else
+ else
{
#ifndef WIN32
MESSAGE(pthread_self() << "Killer : ThreadId " << ThreadId
}
//=============================================================================
-/*!
+/*!
* C++ method:
- */
+ */
//=============================================================================
void SetCpuUsed()
}
//=============================================================================
-/*!
+/*!
* C++ method:
*/
//=============================================================================
void Engines_Parallel_Component_i::SetCurCpu()
{
_ThreadCpuUsed = CpuUsed() ;
- // MESSAGE(pthread_self() <<
+ // MESSAGE(pthread_self() <<
// " Engines_Parallel_Component_i::SetCurCpu() _ThreadCpuUsed " << _ThreadCpuUsed) ;
}
//=============================================================================
-/*!
+/*!
* C++ method:
*/
//=============================================================================
else
{
// std::cout << pthread_self() << "Engines_Parallel_Component_i::CpuUsed _ThreadId "
- // << _ThreadId << " " << _serviceName<< " _StartUsed "
+ // << _ThreadId << " " << _serviceName<< " _StartUsed "
// << _StartUsed << std::endl ;
}
#else
}
//=============================================================================
-/*!
+/*!
* C++ method: Send message to event channel
*/
//=============================================================================
}
//=============================================================================
-/*!
+/*!
* C++ method: return standard library name built on component name
*/
//=============================================================================
#else
std::string ret=componentName;
ret+="Engine.dll";
-#endif
+#endif
return ret;
}
//=============================================================================
-/*!
+/*!
* C++ method: DumpPython default implementation
*/
//=============================================================================
strcpy(aBuffer, aScript);
CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
int aBufferSize = strlen(aBuffer)+1;
- Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
+ Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aBufferSize, aBufferSize, anOctetBuf, 1);
isValidScript = true;
- return aStreamFile._retn();
+ return aStreamFile._retn();
}
-Engines::Salome_file_ptr
-Engines_Parallel_Component_i::setInputFileToService(const char* service_name,
- const char* Salome_file_name)
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::setInputFileToService(const char* service_name,
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Input_Service_file_map.find(service_name);
_t_Salome_file_map * _map = _Input_Service_file_map[service_name];
_t_Proxy_Salome_file_map * _proxy_map = _Proxy_Input_Service_file_map[service_name];
_t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = _IOR_Proxy_Input_Service_file_map[service_name];
-
+
pthread_mutex_lock(deploy_mutex);
std::string proxy_ior;
if (getMyRank() == 0) {
proxy = new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb),
new paco_omni_fabrique());
- proxy->copyGlobalContext(this);
+ proxy->copyGlobalContext(this);
PaCO::PacoTopology_t serveur_topo;
serveur_topo.total = getTotalNode();
proxy->setTopology(serveur_topo);
- // We register the CORBA objet into the POA
+ // We register the CORBA object into the POA
CORBA::Object_ptr proxy_ref = proxy->_this();
// We send the reference to all the nodes...
- Engines::Parallel_Component_var component_proxy =
+ Engines::Parallel_Component_var component_proxy =
Engines::Parallel_Component::_narrow(InterfaceParallel_impl::_proxy);
component_proxy->send_parallel_proxy_object(proxy_ref);
// into the proxy.
for (int i = 0; i < getTotalNode(); i++) {
if (i == getMyRank()) {
- Parallel_Salome_file_i * servant =
- new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb),
+ Parallel_Salome_file_i * servant =
+ new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb),
proxy_ior.c_str(),
i);
- servant->copyGlobalContext(this);
-
- // We register the CORBA objet into the POA
+ servant->copyGlobalContext(this);
+
+ // We register the CORBA object into the POA
servant->POA_PaCO::InterfaceParallel::_this();
// Register the servant
return Engines::Salome_file::_narrow(proxy_ref);
}
-Engines::Salome_file_ptr
-Engines_Parallel_Component_i::setOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::setOutputFileToService(const char* service_name,
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we add it.
_Service_file_map_it = _Output_Service_file_map.find(service_name);
_t_Salome_file_map * _map = _Output_Service_file_map[service_name];
_t_Proxy_Salome_file_map * _proxy_map = _Proxy_Output_Service_file_map[service_name];
_t_IOR_Proxy_Salome_file_map * _IOR_proxy_map = _IOR_Proxy_Output_Service_file_map[service_name];
-
+
pthread_mutex_lock(deploy_mutex);
std::string proxy_ior;
if (getMyRank() == 0) {
proxy = new Engines::Parallel_Salome_file_proxy_impl(CORBA::ORB::_duplicate(_orb),
new paco_omni_fabrique());
- proxy->copyGlobalContext(this);
+ proxy->copyGlobalContext(this);
PaCO::PacoTopology_t serveur_topo;
serveur_topo.total = getTotalNode();
proxy->setTopology(serveur_topo);
- // We register the CORBA objet into the POA
+ // We register the CORBA object into the POA
CORBA::Object_ptr proxy_ref = proxy->_this();
// We send the reference to all the nodes...
- Engines::Parallel_Component_var component_proxy =
+ Engines::Parallel_Component_var component_proxy =
Engines::Parallel_Component::_narrow(InterfaceParallel_impl::_proxy);
component_proxy->send_parallel_proxy_object(proxy_ref);
// into the proxy.
for (int i = 0; i < getTotalNode(); i++) {
if (i == getMyRank()) {
- Parallel_Salome_file_i * servant =
- new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb),
+ Parallel_Salome_file_i * servant =
+ new Parallel_Salome_file_i(CORBA::ORB::_duplicate(_orb),
proxy_ior.c_str(),
i);
- servant->copyGlobalContext(this);
-
- // We register the CORBA objet into the POA
+ servant->copyGlobalContext(this);
+
+ // We register the CORBA object into the POA
servant->POA_PaCO::InterfaceParallel::_this();
// Register the servant
return Engines::Salome_file::_narrow(proxy_ref);
}
-Engines::Salome_file_ptr
-Engines_Parallel_Component_i::getInputFileToService(const char* service_name,
- const char* Salome_file_name)
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::getInputFileToService(const char* service_name,
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Proxy_Service_file_map_it = _Proxy_Input_Service_file_map.find(service_name);
return Sfile->_this();
}
-Engines::Salome_file_ptr
-Engines_Parallel_Component_i::getOutputFileToService(const char* service_name,
- const char* Salome_file_name)
+Engines::Salome_file_ptr
+Engines_Parallel_Component_i::getOutputFileToService(const char* service_name,
+ const char* Salome_file_name)
{
// Try to find the service, if it doesn't exist, we throw an exception.
_Proxy_Service_file_map_it = _Proxy_Output_Service_file_map.find(service_name);
}
-void
-Engines_Parallel_Component_i::checkInputFilesToService(const char* service_name)
+void
+Engines_Parallel_Component_i::checkInputFilesToService(const char* service_name)
{
// Try to find the service, if it doesn't exist, nothing to do.
_Proxy_Service_file_map_it = _Proxy_Input_Service_file_map.find(service_name);
}
}
-void
-Engines_Parallel_Component_i::checkOutputFilesToService(const char* service_name)
+void
+Engines_Parallel_Component_i::checkOutputFilesToService(const char* service_name)
{
// Try to find the service, if it doesn't exist, nothing to do.
_Proxy_Service_file_map_it = _Proxy_Output_Service_file_map.find(service_name);
}
//=============================================================================
-/*!
+/*!
* C++ method: Used by the Parallel Component to deploy a Parallel Salome_file
- */
+ */
//=============================================================================
-void
+void
Engines_Parallel_Component_i::send_parallel_proxy_object(CORBA::Object_ptr proxy_ref) {
_proxy = _orb->object_to_string(proxy_ref);
}
//=============================================================================
-/*!
+/*!
* C++ method: Used by the Parallel Component to deploy a Parallel Salome_file
- */
+ */
//=============================================================================
-void
+void
Engines_Parallel_Component_i::wait_parallel_object_proxy() {
char * proxy = NULL;
proxy = get_parallel_proxy_object();
}
//=============================================================================
-/*!
+/*!
* C++ method: Used by the Parallel Component to deploy a Parallel Salome_file
- */
+ */
//=============================================================================
-char *
+char *
Engines_Parallel_Component_i::get_parallel_proxy_object() {
return _proxy;
}
//=============================================================================
-/*!
+/*!
* C++ method: used to configure the Salome_file into the runtime.
* \param service_name name of the service that use this Salome_file
* \param file_port_name name of the Salome_file
void
Engines_Parallel_Component_i::configureSalome_file(std::string service_name,
std::string file_port_name,
- Engines::Parallel_Salome_file_proxy_impl * file)
+ Engines::Parallel_Salome_file_proxy_impl * file)
{
// By default this method does nothing
}