mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-27 09:50:34 +05:00
WIP
This commit is contained in:
parent
a393dfe87b
commit
db9e239920
@ -74,6 +74,8 @@ SET(GEOMEngine_HEADERS
|
||||
GEOM_IMeasureOperations_i.hh
|
||||
GEOM_IGroupOperations_i.hh
|
||||
GEOM_Gen_i.hh
|
||||
GEOM_Gen_Session_i.hh
|
||||
GEOM_Gen_No_Session_i.hh
|
||||
GEOM_GEOM_I.hxx
|
||||
GEOM_wrap.hxx
|
||||
)
|
||||
@ -98,6 +100,8 @@ SET(GEOMEngine_SOURCES
|
||||
GEOM_IGroupOperations_i.cc
|
||||
GEOM_IFieldOperations_i.cc
|
||||
GEOM_Gen_i.cc
|
||||
GEOM_Gen_Session_i.cc
|
||||
GEOM_Gen_No_Session_i.cc
|
||||
GEOM_DumpPython.cc
|
||||
)
|
||||
|
||||
|
35
src/GEOM_I/GEOM_Gen_No_Session_i.cc
Normal file
35
src/GEOM_I/GEOM_Gen_No_Session_i.cc
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2021 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, 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
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include "GEOM_Gen_No_Session_i.hh"
|
||||
|
||||
#include "SALOMEDS_Study_i.hxx"
|
||||
|
||||
GEOM_Gen_No_Session_i::GEOM_Gen_No_Session_i(CORBA::ORB_ptr orb,
|
||||
PortableServer::POA_ptr poa,
|
||||
PortableServer::ObjectId *contId,
|
||||
const char *instanceName,
|
||||
const char *interfaceName):GEOM_Gen_i(orb,poa,contId,instanceName,interfaceName,false)
|
||||
{
|
||||
}
|
||||
|
||||
SALOMEDS::Study_var GEOM_Gen_No_Session_i::getStudyServant()
|
||||
{
|
||||
return SALOMEDS::Study::_duplicate(KERNEL::getStudyServantSA());
|
||||
}
|
34
src/GEOM_I/GEOM_Gen_No_Session_i.hh
Normal file
34
src/GEOM_I/GEOM_Gen_No_Session_i.hh
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (C) 2021 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, 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
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GEOM_Gen_i.hh"
|
||||
|
||||
class GEOM_I_EXPORT GEOM_Gen_No_Session_i : public GEOM_Gen_i
|
||||
{
|
||||
public:
|
||||
GEOM_Gen_No_Session_i(CORBA::ORB_ptr orb,
|
||||
PortableServer::POA_ptr poa,
|
||||
PortableServer::ObjectId * contId,
|
||||
const char *instanceName,
|
||||
const char *interfaceName);
|
||||
|
||||
SALOMEDS::Study_var getStudyServant() override;
|
||||
};
|
66
src/GEOM_I/GEOM_Gen_Session_i.cc
Normal file
66
src/GEOM_I/GEOM_Gen_Session_i.cc
Normal file
@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2021 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, 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
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include "GEOM_Gen_Session_i.hh"
|
||||
|
||||
GEOM_Gen_Session_i::GEOM_Gen_Session_i(CORBA::ORB_ptr orb,
|
||||
PortableServer::POA_ptr poa,
|
||||
PortableServer::ObjectId *contId,
|
||||
const char *instanceName,
|
||||
const char *interfaceName):GEOM_Gen_i(orb,poa,contId,instanceName,interfaceName,true)
|
||||
{
|
||||
name_service = new SALOME_NamingService(_orb);
|
||||
}
|
||||
|
||||
GEOM_Gen_Session_i::~GEOM_Gen_Session_i()
|
||||
{
|
||||
delete name_service;
|
||||
}
|
||||
|
||||
void GEOM_Gen_Session_i::register_name(char * name)
|
||||
{
|
||||
GEOM::GEOM_Gen_var g = _this();
|
||||
name_service->Register(g, name);
|
||||
}
|
||||
|
||||
SALOMEDS::Study_var GEOM_Gen_Session_i::getStudyServant()
|
||||
{
|
||||
static SALOMEDS::Study_var aStudy;
|
||||
if(CORBA::is_nil(aStudy))
|
||||
{
|
||||
CORBA::Object_ptr anObject = name_service->Resolve("/Study");
|
||||
aStudy = SALOMEDS::Study::_narrow(anObject);
|
||||
}
|
||||
return aStudy;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
GEOM_I_EXPORT PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr orb,
|
||||
PortableServer::POA_ptr poa,
|
||||
PortableServer::ObjectId* contId,
|
||||
const char* instanceName,
|
||||
const char* interfaceName)
|
||||
{
|
||||
GEOM_Gen_Session_i* myGEOM_Gen_i = new GEOM_Gen_Session_i(orb, poa, contId, instanceName, interfaceName);
|
||||
auto id = poa->activate_object(myGEOM_Gen_i);
|
||||
myGEOM_Gen_i->setId(id);
|
||||
return id;
|
||||
}
|
||||
}
|
39
src/GEOM_I/GEOM_Gen_Session_i.hh
Normal file
39
src/GEOM_I/GEOM_Gen_Session_i.hh
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2021 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, 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
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GEOM_Gen_i.hh"
|
||||
|
||||
class GEOM_I_EXPORT GEOM_Gen_Session_i : public GEOM_Gen_i
|
||||
{
|
||||
public:
|
||||
GEOM_Gen_Session_i(CORBA::ORB_ptr orb,
|
||||
PortableServer::POA_ptr poa,
|
||||
PortableServer::ObjectId * contId,
|
||||
const char *instanceName,
|
||||
const char *interfaceName);
|
||||
~GEOM_Gen_Session_i();
|
||||
void register_name(char * name);
|
||||
SALOMEDS::Study_var getStudyServant() override;
|
||||
SALOME_NamingService *GetNS() { return name_service; }
|
||||
private:
|
||||
SALOME_NamingService *name_service = nullptr;
|
||||
};
|
||||
|
@ -65,7 +65,6 @@
|
||||
|
||||
#include <SALOMEDS_Tool.hxx>
|
||||
#include <SALOMEDS_wrap.hxx>
|
||||
#include "SALOMEDS_Study_i.hxx"
|
||||
#include <Basics_DirUtils.hxx>
|
||||
#include <Basics_Utils.hxx>
|
||||
|
||||
@ -100,14 +99,10 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
|
||||
PortableServer::ObjectId* contId,
|
||||
const char* instanceName,
|
||||
const char* interfaceName,
|
||||
bool withRegistry,
|
||||
bool withNS) :
|
||||
bool withRegistry) :
|
||||
Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, withRegistry)
|
||||
{
|
||||
_thisObj = this;
|
||||
_id = _poa->activate_object(_thisObj);
|
||||
if(withNS)
|
||||
name_service = new SALOME_NamingService(_orb);
|
||||
|
||||
_impl = new ::GEOMImpl_Gen;
|
||||
|
||||
@ -144,10 +139,8 @@ GEOM_Gen_i::GEOM_Gen_i(CORBA::ORB_ptr orb,
|
||||
// purpose : destructor
|
||||
//============================================================================
|
||||
GEOM_Gen_i::~GEOM_Gen_i() {
|
||||
delete name_service;
|
||||
delete _impl;
|
||||
std::map<std::string, GEOM_GenericOperationsCreator*>::const_iterator it;
|
||||
for ( it = myOpCreatorMap.begin(); it != myOpCreatorMap.end(); ++it)
|
||||
for (auto it = myOpCreatorMap.cbegin(); it != myOpCreatorMap.cend(); ++it)
|
||||
delete (*it).second;
|
||||
}
|
||||
|
||||
@ -2159,25 +2152,6 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
|
||||
return aParts._retn();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// function : register()
|
||||
// purpose : register 'name' in 'name_service'
|
||||
//============================================================================
|
||||
void GEOM_Gen_i::register_name(char * name)
|
||||
{
|
||||
GEOM::GEOM_Gen_var g = _this();
|
||||
name_service->Register(g, name);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// function : getStudyServant()
|
||||
// purpose : Get Study
|
||||
//============================================================================
|
||||
SALOMEDS::Study_var GEOM_Gen_i::getStudyServant()
|
||||
{
|
||||
return SALOMEDS::Study::_duplicate(KERNEL::getStudyServantSA());
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// function : findOrCreateComponent()
|
||||
// purpose : Find root study component; create if it does not exist
|
||||
@ -3350,24 +3324,4 @@ void GEOM_Gen_i::includeSubObjects(const std::string& aSelectedEntry,
|
||||
includeSubObjects( aSubEntryStr, aSelected, aParents, aChildren, anOthers );
|
||||
}
|
||||
}
|
||||
//=====================================================================================
|
||||
// EXPORTED METHODS
|
||||
//=====================================================================================
|
||||
extern "C"
|
||||
{
|
||||
/*
|
||||
GEOM_I_EXPORT
|
||||
PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB*, PortableServer::POA*, PortableServer::ObjectId*, const char*, const char*);
|
||||
*/
|
||||
|
||||
GEOM_I_EXPORT
|
||||
PortableServer::ObjectId* GEOMEngine_factory(CORBA::ORB_ptr orb,
|
||||
PortableServer::POA_ptr poa,
|
||||
PortableServer::ObjectId* contId,
|
||||
const char* instanceName,
|
||||
const char* interfaceName)
|
||||
{
|
||||
GEOM_Gen_i* myGEOM_Gen_i = new GEOM_Gen_i(orb, poa, contId, instanceName, interfaceName);
|
||||
return myGEOM_Gen_i->getId();
|
||||
}
|
||||
}
|
||||
|
@ -96,23 +96,16 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
PortableServer::ObjectId * contId,
|
||||
const char *instanceName,
|
||||
const char *interfaceName,
|
||||
bool withRegistry = true,
|
||||
bool withNS = true);
|
||||
bool withRegistry = true);
|
||||
|
||||
// destructor, doing nothing (for now)
|
||||
virtual ~GEOM_Gen_i();
|
||||
|
||||
// generic method to be put in a super class
|
||||
void register_name(char * name);
|
||||
|
||||
// Get ORB object
|
||||
CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); }
|
||||
|
||||
// Get Naming Service object
|
||||
SALOME_NamingService* GetNS() { return name_service; }
|
||||
|
||||
// Get Study
|
||||
SALOMEDS::Study_var getStudyServant();
|
||||
virtual SALOMEDS::Study_var getStudyServant() = 0;
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Inherited methods from SALOMEDS::Driver //
|
||||
@ -390,7 +383,6 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
|
||||
private:
|
||||
|
||||
::GEOMImpl_Gen* _impl;
|
||||
SALOME_NamingService * name_service = nullptr;
|
||||
char * _name;
|
||||
|
||||
// plugin operations managing
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "GEOM_IOperations_i.hh"
|
||||
|
||||
#include "GEOM_Engine.hxx"
|
||||
#include "GEOM_Gen_i.hh"
|
||||
#include "GEOM_Gen_Session_i.hh"
|
||||
#include <SALOME_NamingService.hxx>
|
||||
|
||||
#include "utilities.h"
|
||||
@ -232,7 +232,7 @@ void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj)
|
||||
if (!CORBA::is_nil (theObj)) {
|
||||
// Cast _engine to GEOM_Gen_i type.
|
||||
PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in());
|
||||
GEOM_Gen_i *anEngine = dynamic_cast<GEOM_Gen_i *>(aServant);
|
||||
GEOM_Gen_Session_i *anEngine = dynamic_cast<GEOM_Gen_Session_i *>(aServant);
|
||||
|
||||
if (anEngine) {
|
||||
SALOME_NamingService *aNameService = anEngine->GetNS();
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
#include "GeomHelper.h"
|
||||
|
||||
#include "GEOM_Gen_i.hh"
|
||||
#include "GEOM_Gen_No_Session_i.hh"
|
||||
#include "SALOME_Container_i.hxx"
|
||||
#include "SALOME_KernelServices.hxx"
|
||||
|
||||
@ -44,8 +44,9 @@ std::string BuildGEOMInstance()
|
||||
//
|
||||
pman->activate();
|
||||
//
|
||||
GEOM_Gen_i *servant = new GEOM_Gen_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"GEOM_inst_2","GEOM",false,false);
|
||||
PortableServer::ObjectId *zeId = servant->getId();
|
||||
GEOM_Gen_No_Session_i *servant = new GEOM_Gen_No_Session_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"GEOM_inst_2","GEOM");
|
||||
PortableServer::ObjectId *zeId = poa->activate_object(servant);
|
||||
servant->setId(zeId);
|
||||
CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
|
||||
char *interfaceName = servant->interfaceName();
|
||||
std::string interfaceNameCpp(interfaceName);
|
||||
|
Loading…
Reference in New Issue
Block a user