const char *instanceName,
const char *interfaceName);
virtual ~HELLO();
- HELLO_ORB::status hello ( SALOMEDS::Study_ptr study, const char* name );
- HELLO_ORB::status goodbye( SALOMEDS::Study_ptr study, const char* name );
+ HELLO_ORB::status hello ( const char* name );
+ HELLO_ORB::status goodbye( const char* name );
void copyOrMove( const HELLO_ORB::object_list& what,
SALOMEDS::SObject_ptr where,
CORBA::Long row, CORBA::Boolean isCopy );
The definitions of the constructor and the HELLOEngine_factory instantiation function (both normalized!),
hello, goodbye and copyOrMove are given in the source file (HELLO.cxx)::
- HELLO_ORB::status HELLO::hello( SALOMEDS::Study_ptr study, const char* name )
+ HELLO_ORB::status HELLO::hello( const char* name )
{
...
}
- HELLO_ORB::status HELLO::goodbye( SALOMEDS::Study_ptr study, const char* name )
+ HELLO_ORB::status HELLO::goodbye( const char* name )
{
...
}
>>> print hello
<HELLO_ORB._objref_HELLO_Gen instance at 0x8274e94>
- >>> status=hello.hello(salome.myStudy, "Nicolas")
+ >>> status=hello.hello("Nicolas")
>>> print status
OP_OK
If a preliminary check is successfully done, schema run is created and then the user can start its execution in the chosen mode. Schema run
-is exported to an XML file and passed to YACS CORBA engine and executed there. YACS CORBA engine is also given a study ID.
+is exported to an XML file and passed to YACS CORBA engine and executed there.
For visual representation of execution state the following means are provided by YACS module.
compodefs=r"""
class A:
- def createObject( self, study, name ):
+ def createObject( self, name ):
"Create object. "
- builder = study.NewBuilder()
- father = study.FindComponent( "pycompos" )
+ builder = salome.myStudy.NewBuilder()
+ father = salome.myStudy.FindComponent( "pycompos" )
if father is None:
father = builder.NewComponent( "pycompos" )
attr = builder.FindOrCreateAttribute( father, "AttributeName" )
Here is an excerpt from cppgui1 example that shows how to redefine the DumpPython method in a C++ component::
compomethods=r"""
- Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean isPublished,
+ Engines::TMPFile* DumpPython(CORBA::Boolean isPublished,
CORBA::Boolean& isValidScript)
{
- SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
- if(CORBA::is_nil(aStudy))
- return new Engines::TMPFile(0);
- SALOMEDS::SObject_var aSO = aStudy->FindComponent("cppcompos");
+ SALOMEDS::SObject_var aSO = KERNEL::getStudy()->FindComponent("cppcompos");
if(CORBA::is_nil(aSO))
return new Engines::TMPFile(0);
std::string Script = "import cppcompos_ORB\n";
Script += "import salome\n";
Script += "compo = salome.lcc.FindOrLoadComponent('FactoryServer','cppcompos')\n";
- Script += "def RebuildData(theStudy):\n";
- Script += " compo.SetCurrentStudy(theStudy)\n";
const char* aScript=Script.c_str();
char* aBuffer = new char[strlen(aScript)+1];
strcpy(aBuffer, aScript);
SALOME_DriverPy.SALOME_DriverPy_i.__init__(self,"pycompos")
return
- def createObject( self, study, name ):
+ def createObject( self, name ):
"Create object. "
- builder = study.NewBuilder()
- father = study.FindComponent( "pycompos" )
+ builder = salome.myStudy.NewBuilder()
+ father = salome.myStudy.FindComponent( "pycompos" )
if father is None:
father = builder.NewComponent( "pycompos" )
attr = builder.FindOrCreateAttribute( father, "AttributeName" )
interface Idl_A : SALOMEDS::Driver
{
- void createObject(in SALOMEDS::Study theStudy, in string name) raises (SALOME::SALOME_Exception);
+ void createObject(in string name) raises (SALOME::SALOME_Exception);
};
In this simple case, it is also possible to include directly the content of the file with the *interfacedefs* parameter.
SalomeIDLKernel
SalomeNS
SalomeContainer
+ SalomeKernelHelpers
SALOMEBasics
SalomeResourcesManager
OpUtil
#include "SalomeProc.hxx"
#include "SALOME_NamingService.hxx"
+#include "SALOME_KernelServices.hxx"
#include "SALOMEDS.hh"
#include "SALOMEDS_Attributes.hh"
void StudyInNode::execute()
{
DEBTRACE("+++++++ StudyInNode::execute +++++++++++");
- SALOME_NamingService NS(getSALOMERuntime()->getOrb());
- CORBA::Object_var obj=NS.Resolve("/Study");
- if(CORBA::is_nil(obj))
- {
- _errorDetails="Execution problem: no naming service";
- throw Exception(_errorDetails);
- }
-
- SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj);
- if(CORBA::is_nil(myStudy))
- {
- _errorDetails="Execution problem: no study";
- throw Exception(_errorDetails);
- }
std::list<OutputPort *>::const_iterator iter;
for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
OutputStudyPort *outp = dynamic_cast<OutputStudyPort *>(*iter);
try
{
- outp->getDataFromStudy(myStudy);
+ outp->getDataFromStudy();
}
catch(Exception& e)
{
}
/*
-SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS::StudyBuilder_ptr builder,
+SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::StudyBuilder_ptr builder,
SALOMEDS::SObject_ptr sobj, const std::string& name)
{
- SALOMEDS::ChildIterator_var anIterator= study->NewChildIterator(sobj);
+ SALOMEDS::ChildIterator_var anIterator= KERNEL::getStudyServant()->NewChildIterator(sobj);
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var namAttr ;
SALOMEDS::SObject_var result=SALOMEDS::SObject::_nil();
void StudyOutNode::execute()
{
DEBTRACE("+++++++ StudyOutNode::execute +++++++++++");
- SALOME_NamingService NS(getSALOMERuntime()->getOrb());
- CORBA::Object_var obj=NS.Resolve("/Study");
- if(CORBA::is_nil(obj))
- {
- _errorDetails="Execution problem: no naming service";
- throw Exception(_errorDetails);
- }
-
- SALOMEDS::Study_var myStudy = SALOMEDS::Study::_narrow(obj);
- if(CORBA::is_nil(myStudy))
- {
- _errorDetails="Execution problem: no study";
- throw Exception(_errorDetails);
- }
- SALOMEDS::StudyBuilder_var aBuilder =myStudy->NewBuilder() ;
+ SALOMEDS::StudyBuilder_var aBuilder =KERNEL::getStudyServant()->NewBuilder() ;
if(CORBA::is_nil(aBuilder))
{
_errorDetails="Execution problem: can not create StudyBuilder";
for(iter = _setOfInputPort.begin(); iter != _setOfInputPort.end(); iter++)
{
InputStudyPort *inp = dynamic_cast<InputStudyPort *>(*iter);
- inp->putDataInStudy(myStudy,aBuilder);
+ inp->putDataInStudy(aBuilder);
}
// save in file if ref is given
if(_ref != "")
{
- myStudy->SaveAs(_ref.c_str(), false, false);
+ KERNEL::getStudyServant()->SaveAs(_ref.c_str(), false, false);
}
DEBTRACE("+++++++ end StudyOutNode::execute +++++++++++" );
}
#include "RuntimeSALOME.hxx"
#include "SALOMEDS_Attributes.hh"
+#include "SALOME_KernelServices.hxx"
#include <iostream>
#include <iomanip>
return getData();
}
-void OutputStudyPort::getDataFromStudy(SALOMEDS::Study_var myStudy)
+void OutputStudyPort::getDataFromStudy()
{
std::string data = getData();
DEBTRACE("data: " << data );
//try an id
- SALOMEDS::SObject_var aSO = myStudy->FindObjectID(data.c_str());
+ SALOMEDS::SObject_var aSO = KERNEL::getStudyServant()->FindObjectID(data.c_str());
if(CORBA::is_nil(aSO))
{
//try a path
- aSO=myStudy->FindObjectByPath(data.c_str());
+ aSO=KERNEL::getStudyServant()->FindObjectByPath(data.c_str());
if(CORBA::is_nil(aSO))
{
std::stringstream msg;
}
}
- CORBA::String_var path=myStudy->GetObjectPath(aSO);
+ CORBA::String_var path=KERNEL::getStudyServant()->GetObjectPath(aSO);
DEBTRACE(path);
CORBA::String_var id=aSO->GetID();
DEBTRACE(id);
-SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::Study_ptr study, SALOMEDS::StudyBuilder_ptr builder,
+SALOMEDS::SObject_ptr findOrCreateSoWithName(SALOMEDS::StudyBuilder_ptr builder,
SALOMEDS::SObject_ptr sobj, const std::string& name)
{
- SALOMEDS::ChildIterator_var anIterator= study->NewChildIterator(sobj);
+ SALOMEDS::ChildIterator_var anIterator= KERNEL::getStudyServant()->NewChildIterator(sobj);
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var namAttr ;
SALOMEDS::SObject_var result=SALOMEDS::SObject::_nil();
return getData();
}
-void InputStudyPort::putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyBuilder_var aBuilder)
+void InputStudyPort::putDataInStudy(SALOMEDS::StudyBuilder_var aBuilder)
{
SALOMEDS::GenericAttribute_var aGAttr;
SALOMEDS::SObject_var aSO ;
std::string data = getData();
DEBTRACE("data: " << data );
//try to find an existing id (i:j:k...)
- aSO = myStudy->FindObjectID(data.c_str());
+ aSO = KERNEL::getStudyServant()->FindObjectID(data.c_str());
if(CORBA::is_nil(aSO))
{
// the id does not exist. Try to create it by id
- aSO=myStudy->CreateObjectID(data.c_str());
+ aSO=KERNEL::getStudyServant()->CreateObjectID(data.c_str());
if(!CORBA::is_nil(aSO))
{
aGAttr=aBuilder->FindOrCreateAttribute(aSO,"AttributeName");
}
// Does component entry exist ?
- aSO=myStudy->FindObjectByPath(pname.c_str());
+ aSO=KERNEL::getStudyServant()->FindObjectByPath(pname.c_str());
if(CORBA::is_nil(aSO))
{
// We have not been able to publish the object with Salome Driver, make it the light way
aGAttr=aBuilder->FindOrCreateAttribute(aFather,"AttributeName");
anAttr = SALOMEDS::AttributeName::_narrow( aGAttr );
anAttr->SetValue(name.c_str());
- aSO=myStudy->FindObjectByPath(pname.c_str());
+ aSO=KERNEL::getStudyServant()->FindObjectByPath(pname.c_str());
}
begin=data.find_first_not_of("/",pos);
name=data.substr(begin,pos-begin);
else
name=data.substr(begin);
- aSO=findOrCreateSoWithName(myStudy,aBuilder,aSO,name);
+ aSO=findOrCreateSoWithName(aBuilder,aSO,name);
begin=data.find_first_not_of("/",pos);
}
}
virtual std::string getPyObj();
virtual std::string getAsString();
virtual std::string typeName() {return "YACS__ENGINE__OutputStudyPort";}
- virtual void getDataFromStudy(SALOMEDS::Study_var myStudy);
+ virtual void getDataFromStudy();
protected:
std::string _storeData;
};
virtual std::string getPyObj();
virtual std::string getAsString();
virtual std::string typeName() {return "YACS__ENGINE__InputStudyPort";}
- virtual void putDataInStudy(SALOMEDS::Study_var myStudy,SALOMEDS::StudyBuilder_var aBuilder);
+ virtual void putDataInStudy(SALOMEDS::StudyBuilder_var aBuilder);
protected:
std::string _storeData;
};
<component-author>P. RASCLE</component-author>
<component-version>@SALOMEYACS_VERSION@</component-version>
<component-comment>EDF - RD</component-comment>
- <component-multistudy>1</component-multistudy>
<component-icone>ModuleYacs.png</component-icone>
<constraint>'linux' ~ OS</constraint>
<service>
<service-name>GeomGraph</service-name>
<inParameter-list>
-<inParameter>
-<inParameter-type>long</inParameter-type>
- <inParameter-name>SetStudyID__theStudyID</inParameter-name> </inParameter>
<inParameter>
<inParameter-type>double</inParameter-type>
<inParameter-name>MakeBox__theX1</inParameter-name> </inParameter>
<PyFunc><![CDATA[ lcc = LifeCycleCORBA(orb) ]]></PyFunc>
<PyFunc><![CDATA[ # --- create a naming service instance ]]></PyFunc>
<PyFunc><![CDATA[ naming_service = SALOME_NamingServicePy_i(orb) ]]></PyFunc>
- <PyFunc><![CDATA[ # --- get Study reference ]]></PyFunc>
- <PyFunc><![CDATA[ obj = naming_service.Resolve('Study') ]]></PyFunc>
- <PyFunc><![CDATA[ aStudy = obj._narrow(SALOMEDS.Study) ]]></PyFunc>
<PyFunc><![CDATA[ # --- load visu component ]]></PyFunc>
<PyFunc><![CDATA[ aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU") ]]></PyFunc>
- <PyFunc><![CDATA[ aVisu.SetCurrentStudy(aStudy) ]]></PyFunc>
<PyFunc><![CDATA[ print "InitDisplay --> aVisu ", aVisu ]]></PyFunc>
<PyFunc><![CDATA[ time.sleep(2) ]]></PyFunc>
<PyFunc><![CDATA[ aViewManager=aVisu.GetViewManager() ]]></PyFunc>
return module->getNewWindow(scene);
}
-/*!
- * return studyId used in context delete when study is closed.
- */
void SuitWrapper::AssociateViewToWindow(QGraphicsView* gView, QWidget* viewWindow)
{
SalomeWrap_Module* module = dynamic_cast<SalomeWrap_Module*>(_wrapped);
" <component-author>""</component-author>\n"\
" <component-version>1.0</component-version>\n"\
" <component-comment></component-comment>\n"\
- " <component-multistudy>1</component-multistudy>\n"\
" <component-icone>"class_name".png</component-icone>\n"\
" <component-impltype>1</component-impltype>\n"\
" <component-interface-list>" >> catalog_file
echo ""
echo " to run IDLparser:"
echo ""
- echo " $0 -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,multistudy=<component_multistudy>][,remove=component_name] <file.idl> "
+ echo " $0 -Wbcatalog=<my_catalog.xml>[,icon=<pngfile>][,version=<num>][,author=<name>][,name=<component_name>][,remove=component_name] <file.idl> "
echo ""
echo " to have omniidl help:"
echo ""
<code>orb = CORBA.ORB_init([], CORBA.ORB_ID)</code>
<code>lcc = LifeCycleCORBA(orb)</code>
<code>naming_service = SALOME_NamingServicePy_i(orb)</code>
- <code>aStudy = naming_service.Resolve('Study')</code>
<code>aVisu = lcc.FindOrLoadComponent("FactoryServer","VISU")</code>
- <code>aVisu.SetCurrentStudy(aStudy)</code>
<code>aViewManager=aVisu.GetViewManager()</code>
<code>aView=aViewManager.Create3DView()</code>
<code>medFile = os.getenv('DATA_DIR') + '/MedFiles/' + "TimeStamps.med" </code>
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.hello(salome.myStudy, p1)</code>
+ <code> print compo.hello(p1)</code>
<code> print p1</code>
</function>
<load container="A"/>
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.hello(salome.myStudy, p1)</code>
+ <code> print compo.hello(p1)</code>
<code> print p1</code>
</function>
<inport name="p1" type="string"/>
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.hello(salome.myStudy, p1)</code>
+ <code> print compo.hello(p1)</code>
<code> print p1</code>
</function>
<load container="A"/>
<code> param['hostname']=machine</code>
<code> param['container_name']=container</code>
<code> compo=salome.lcc.LoadComponent(param, "HELLO")</code>
- <code> print compo.hello(salome.myStudy, p1)</code>
+ <code> print compo.hello(p1)</code>
<code> print p1</code>
</function>
<inport name="p1" type="string"/>