-// Copyright (C) 2006-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2006-2014 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//Components
#include "CORBAComponent.hxx"
#include "SalomeComponent.hxx"
+#include "SalomeHPComponent.hxx"
#include "SalomePythonComponent.hxx"
#include "CppComponent.hxx"
#include "SalomeContainer.hxx"
#include "CppContainer.hxx"
+#include "SalomeHPContainer.hxx"
//Nodes
#include "PythonNode.hxx"
using namespace std;
using namespace YACS::ENGINE;
-void RuntimeSALOME::setRuntime(long flags) // singleton creation (not thread safe!)
+void RuntimeSALOME::setRuntime(long flags, int argc, char* argv[]) // singleton creation (not thread safe!)
{
if (! Runtime::_singleton)
{
- RuntimeSALOME* r=new RuntimeSALOME(flags);
+ RuntimeSALOME* r=new RuntimeSALOME(flags, argc, argv);
Runtime::_singleton = r;
r->initBuiltins();
}
typeMap["dataref"]= t;
}
-RuntimeSALOME::RuntimeSALOME(long flags)
+RuntimeSALOME::RuntimeSALOME(long flags, int argc, char* argv[])
{
// If all flags (apart the IsPyExt flags) are unset, force them to true
if ((flags - flags & RuntimeSALOME::IsPyExt) == 0)
if (_usePython) _setOfImplementation.insert(PythonNode::IMPL_NAME);
if (_useCorba) _setOfImplementation.insert(CORBANode::IMPL_NAME);
if (_useXml) _setOfImplementation.insert(XmlNode::IMPL_NAME);
- init(flags);
+ init(flags, argc, argv);
}
RuntimeSALOME::~RuntimeSALOME()
* bit1 (UseXml) true if python nodes are needed
* bit1 (UseCpp) true if C++ nodes are needed
* bit1 (UseSalome) true if Salome nodes are needed
+ * \param argc number of command line arguments (used to initialize the Python interpreter)
+ * \param argv command line arguments (used to initialize the Python interpreter)
*
*/
-void RuntimeSALOME::init(long flags)
+void RuntimeSALOME::init(long flags, int argc, char* argv[])
{
bool ispyext = flags & RuntimeSALOME::IsPyExt;
if (_useCorba)
#else
Py_InitializeEx(0); // do not install signal handlers
#endif
+ if (argc > 0 && argv != NULL)
+ PySys_SetArgv(argc, argv);
+ else
+ {
+ int pyArgc = 1;
+ char* pyArgv[1];
+ char defaultName[] = "SALOME_YACS_RUNTIME";
+ pyArgv[0] = defaultName;
+ PySys_SetArgv(pyArgc, pyArgv);
+ }
PyEval_InitThreads(); /* Create (and acquire) the interpreter lock (for threads)*/
PyEval_SaveThread(); /* Release the thread state */
//here we do not have the Global Interpreter Lock
return new SalomePythonComponent(name);
else if (kind == CppComponent::KIND)
return new CppComponent(name);
+ else if (kind == SalomeHPComponent::KIND)
+ return new SalomeHPComponent(name);
std::string msg="Component Instance kind ("+kind+") unknown";
throw Exception(msg);
}
Container *RuntimeSALOME::createContainer(const std::string& kind)
{
- if(kind == "" || kind == SalomeComponent::KIND)
+ if(kind == "" || kind == SalomeContainer::KIND)
return new SalomeContainer;
- else if (kind == CppComponent::KIND)
+ if(kind==SalomeHPContainer::KIND)
+ return new SalomeHPContainer;
+ else if (kind == CppContainer::KIND)
return new CppContainer;
std::string msg="Container kind ("+kind+") unknown";
throw Exception(msg);