//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client
// File : GEOM_Client.cxx
// Author : Yves FRICAUD/Lucien PIGNOLONI
// Module : GEOM
-// $Header$
-//
+
#include <Standard_Stream.hxx>
#include <Standard_Stream.hxx>
#else
(long)getpid();
#endif
+ cout << "$$$ GEOM_Client::GEOM_Client() pid_client = " << pid_client << endl;
}
//=======================================================================
// purpose : Copy constructor
//=======================================================================
GEOM_Client::GEOM_Client(const GEOM_Client& client)
-{
+{
myIORs = client.myIORs;
myShapes = client.myShapes;
_myIndexes = client._myIndexes;
GEOM_Client::GEOM_Client(Engines::Container_ptr client)
{
pid_client = client->getPID();
+ cout << "$$$ GEOM_Client::GEOM_Client(client) pid_client = " << pid_client << endl;
}
+//=======================================================================
+// function : get_client()
+// purpose : Static method to have the only one instance of GEOM_Client
+//=======================================================================
+#ifdef SINGLE_CLIENT
+GEOM_Client& GEOM_Client::get_client()
+{
+ static GEOM_Client a;
+ return a;
+}
+#else
+GEOM_Client GEOM_Client::get_client()
+{
+ return GEOM_Client();
+}
+#endif
+
//=======================================================================
// function : Find()
// purpose :
//=======================================================================
Standard_Integer GEOM_Client::Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S )
{
- if(_myIndexes.count(IOR) != 0)
- {
- Standard_Integer i =_myIndexes[IOR];
- S = myShapes.Value(i);
- return i;
- }
+ cout << "$$$ GEOM_Client::Find BEGIN this = " << this << ", _myIndexes.size() = " << _myIndexes.size() << endl;
+ if (_myIndexes.count(IOR) != 0)
+ {
+ Standard_Integer i = _myIndexes[IOR];
+ S = myShapes.Value(i);
+ cout << "$$$ GEOM_Client::Find i = " << i << endl;
+ return i;
+ }
+ cout << "$$$ GEOM_Client::Find END" << endl;
return 0;
}
{
myIORs.Append(IOR);
myShapes.Append(S);
- _myIndexes[IOR]=myIORs.Length();
+ _myIndexes[IOR] = myIORs.Length();
+ cout << "$$$ !!! GEOM_Client::Bind this = " << this << ", _myIndexes.size() = " << _myIndexes.size() << endl;
+ cout << "$$$ !!! GEOM_Client::Bind len = " << myIORs.Length() << ", IOR = " << IOR.ToCString() << endl;
}
//=======================================================================
//=======================================================================
void GEOM_Client::RemoveShapeFromBuffer( const TCollection_AsciiString& IOR)
{
+ cout << "$$$ GEOM_Client::RemoveShapeFromBuffer BEGIN" << endl;
+ cout << "$$$ GEOM_Client::RemoveShapeFromBuffer myIORs.Length() = " << myIORs.Length() << ", _myIndexes.size() = " << _myIndexes.size() << endl;
if( myIORs.IsEmpty() )
return;
+ cout << "$$$ GEOM_Client::RemoveShapeFromBuffer 1" << endl;
TopoDS_Shape S;
Standard_Integer anIndex = Find( IOR, S );
if( anIndex != 0 ) {
+ cout << "$$$ GEOM_Client::RemoveShapeFromBuffer anIndex = " << anIndex << endl;
myIORs.Remove(anIndex);
myShapes.Remove(anIndex);
_myIndexes.erase(IOR);
_mySubShapes.erase(IOR);
}
- return;
+ cout << "$$$ GEOM_Client::RemoveShapeFromBuffer END" << endl;
}
//=======================================================================
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aMainShape, anIndices);
Standard_Integer ii = 1, nbSubSh = anIndices.Extent();
- for (; ii <= nbSubSh; ii++)
+ for (; ii <= nbSubSh; ii++)
{
_mySubShapes[mainIOR].push_back(anIndices.FindKey(ii));
}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client
// File : GEOM_Client.hxx
// Author : Yves FRICAUD
// Module : GEOM
-// $Header$
-//
+
#ifndef _GEOM_Client_HeaderFile
#define _GEOM_Client_HeaderFile
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#
+
#ifdef HAVE_FINITE
#undef HAVE_FINITE // E.A. fix a warning about redefinition of HAVE_FINITE in re-inclusion of Standard_values.h
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
+
class TCollection_AsciiString;
class TopoDS_Shape;
-
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
* and the SHAPE_READER macro defines also a new object
*/
#define SINGLE_CLIENT
+
//=====================================================================
// GEOM_Client : class definition
//=====================================================================
class GEOMCLIENT_EXPORT GEOM_Client {
-public:
-
- inline void* operator new(size_t,void* anAddress)
+ public:
+
+ inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
- inline void* operator new(size_t size)
- {
- return Standard::Allocate(size);
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
}
- inline void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
- //
- //Standard_EXPORT
+ //
+ //Standard_EXPORT
GEOM_Client();
- //Standard_EXPORT
+ //Standard_EXPORT
GEOM_Client(Engines::Container_ptr client);
- //Standard_EXPORT
+ //Standard_EXPORT
GEOM_Client(const GEOM_Client& client);
- //Standard_EXPORT
+ //Standard_EXPORT
Standard_Integer Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
- //Standard_EXPORT
+ //Standard_EXPORT
Standard_Integer Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
- //Standard_EXPORT
+ //Standard_EXPORT
void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) ;
- //Standard_EXPORT
+ //Standard_EXPORT
TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape );
- //Standard_EXPORT
+ //Standard_EXPORT
void RemoveShapeFromBuffer( const TCollection_AsciiString& IOR ) ;
- //Standard_EXPORT
+ //Standard_EXPORT
void ClearClientBuffer() ;
- //Standard_EXPORT
+ //Standard_EXPORT
unsigned int BufferLength() ;
TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
#ifdef SINGLE_CLIENT
- static GEOM_Client& get_client() { static GEOM_Client a;return a; }
+ static GEOM_Client& get_client();
#else
- static GEOM_Client get_client() { return GEOM_Client(); }
+ static GEOM_Client get_client();
#endif
-private:
+ private:
// Fields PRIVATE
//
TColStd_SequenceOfAsciiString myIORs ;