mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-14 09:38:34 +05:00
Optimization : get direct TopoDS_Shape when GEOMClient and GEOM server are colocated
This commit is contained in:
parent
ed50cd3d1a
commit
b1fdc98179
@ -246,3 +246,12 @@ GEOM::GEOM_Gen_ptr GEOM_Shape_i::Engine()
|
|||||||
{
|
{
|
||||||
return _engine;
|
return _engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : getShape
|
||||||
|
//purpose : return the TopoDS_Shape when client and servant are colocated, be careful
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
long GEOM_Shape_i::getShape() {
|
||||||
|
return((long)(&_geom));
|
||||||
|
}
|
||||||
|
@ -112,6 +112,8 @@ public:
|
|||||||
GEOM::GEOM_Shape::TMPFile* GetShapeStream();
|
GEOM::GEOM_Shape::TMPFile* GetShapeStream();
|
||||||
|
|
||||||
GEOM::GEOM_Gen_ptr Engine();
|
GEOM::GEOM_Gen_ptr Engine();
|
||||||
|
|
||||||
|
long getShape();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,15 +47,29 @@ using namespace std;
|
|||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define HST_CLIENT_LEN 256
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Load()
|
// function : Load()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
static TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape )
|
TopoDS_Shape GEOM_Client::Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape )
|
||||||
{
|
{
|
||||||
TopoDS_Shape S;
|
char hst_client[HST_CLIENT_LEN];
|
||||||
|
gethostname(hst_client, HST_CLIENT_LEN);
|
||||||
|
|
||||||
|
Engines::Container_var ctn_server = geom->GetContainerRef();
|
||||||
|
long pid_server = ctn_server->getPID();
|
||||||
|
|
||||||
|
if ( (pid_client==pid_server) && (strcmp(hst_client, ctn_server->getHostName())==0) ) {
|
||||||
|
TopoDS_Shape* S = (TopoDS_Shape*)(aShape->getShape());
|
||||||
|
return(*S);
|
||||||
|
} else {
|
||||||
/* get sequence of bytes of resulting brep shape from GEOM server */
|
/* get sequence of bytes of resulting brep shape from GEOM server */
|
||||||
|
TopoDS_Shape S;
|
||||||
GEOM::GEOM_Shape::TMPFile_var SeqFile = aShape->GetShapeStream();
|
GEOM::GEOM_Shape::TMPFile_var SeqFile = aShape->GetShapeStream();
|
||||||
int sizebuf = SeqFile->length();
|
int sizebuf = SeqFile->length();
|
||||||
char* buf;
|
char* buf;
|
||||||
@ -63,18 +77,28 @@ static TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape )
|
|||||||
istrstream streamBrep(buf,sizebuf);
|
istrstream streamBrep(buf,sizebuf);
|
||||||
BRep_Builder aBuilder;
|
BRep_Builder aBuilder;
|
||||||
BRepTools::Read(S, streamBrep, aBuilder);
|
BRepTools::Read(S, streamBrep, aBuilder);
|
||||||
return S;
|
return(S);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Create()
|
// function : Create()
|
||||||
// purpose :
|
// purpose : Create in client not in a container
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
GEOM_Client::GEOM_Client()
|
GEOM_Client::GEOM_Client()
|
||||||
{
|
{
|
||||||
|
pid_client = (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : Create()
|
||||||
|
// purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOM_Client::GEOM_Client(Engines::Container_ptr client)
|
||||||
|
{
|
||||||
|
pid_client = client->getPID();
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : Find()
|
// function : Find()
|
||||||
|
@ -75,18 +75,21 @@ public:
|
|||||||
// Methods PUBLIC
|
// Methods PUBLIC
|
||||||
//
|
//
|
||||||
Standard_EXPORT GEOM_Client();
|
Standard_EXPORT GEOM_Client();
|
||||||
|
Standard_EXPORT GEOM_Client(Engines::Container_ptr client);
|
||||||
Standard_EXPORT Standard_Integer Find( const TCollection_AsciiString& ShapeIOR, TopoDS_Shape& S ) ;
|
Standard_EXPORT Standard_Integer Find( const TCollection_AsciiString& ShapeIOR, TopoDS_Shape& S ) ;
|
||||||
Standard_EXPORT void Bind( const TCollection_AsciiString& ShapeIOR, const TopoDS_Shape& S ) ;
|
Standard_EXPORT void Bind( const TCollection_AsciiString& ShapeIOR, const TopoDS_Shape& S ) ;
|
||||||
Standard_EXPORT TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape );
|
Standard_EXPORT TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape );
|
||||||
Standard_EXPORT void RemoveShapeFromBuffer( const TCollection_AsciiString& shapeIOR ) ;
|
Standard_EXPORT void RemoveShapeFromBuffer( const TCollection_AsciiString& shapeIOR ) ;
|
||||||
Standard_EXPORT void ClearClientBuffer() ;
|
Standard_EXPORT void ClearClientBuffer() ;
|
||||||
Standard_EXPORT unsigned int BufferLength() ;
|
Standard_EXPORT unsigned int BufferLength() ;
|
||||||
|
TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Fields PRIVATE
|
// Fields PRIVATE
|
||||||
//
|
//
|
||||||
TColStd_SequenceOfAsciiString myIORs ;
|
TColStd_SequenceOfAsciiString myIORs ;
|
||||||
TopTools_SequenceOfShape myShapes ;
|
TopTools_SequenceOfShape myShapes ;
|
||||||
|
long pid_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user