// function : Bind()
// purpose :
//=======================================================================
-void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S )
+void GEOM_Client::Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S, int Tick )
{
myShapesMap[IOR] = S;
+ myTicksMap[IOR] = Tick;
}
//=======================================================================
myShapesMap.clear();
}
-//=======================================================================
-// function : BufferLength()
-// purpose :
-//=======================================================================
-unsigned int GEOM_Client::BufferLength()
-{
- return myShapesMap.size();
-}
-
//=======================================================================
// function : GetShape()
// purpose :
//=======================================================================
TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape )
{
- TopoDS_Shape S;
CORBA::String_var anIOR = geom->GetStringFromIOR(aShape);
TCollection_AsciiString IOR = anIOR.in();
+ int aShapeTick = aShape->GetTick();
+
+ std::map< TCollection_AsciiString , int >::iterator i2t = myTicksMap.find( IOR );
+ if ( i2t != myTicksMap.end() ) {
+ // The shape was modified, clean the stored one
+ if (i2t->second != aShapeTick)
+ RemoveShapeFromBuffer(IOR);
+ }
+
+ TopoDS_Shape S;
if ( Find( IOR, S ))
return S;
/******* in case of a MAIN GEOM::SHAPE ********/
if ( aShape->IsMainShape() ) {
S = Load(geom, aShape);
- Bind(IOR, S);
+ Bind(IOR, S, aShapeTick);
return S;
}
S = aCompound;
}
- Bind(IOR, S);
+ Bind(IOR, S, aShapeTick);
return S;
}
#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 _TColStd_SequenceOfAsciiString_HeaderFile
-#include <TColStd_SequenceOfAsciiString.hxx>
-#endif
-#ifndef _TopTools_SequenceOfShape_HeaderFile
-#include <TopTools_SequenceOfShape.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-
-class TCollection_AsciiString;
-class TopoDS_Shape;
+#include <Standard_Boolean.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopoDS_Shape.hxx>
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
+#include <map>
+#include <vector>
#ifdef WIN32
#if defined GEOMCLIENT_EXPORTS || defined GEOMClient_EXPORTS
#define GEOMCLIENT_EXPORT
#endif
-#include <TCollection_AsciiString.hxx>
-#include <TopoDS_Shape.hxx>
-#include <map>
-#include <vector>
-
/*
* if define SINGLE_CLIENT is not commented, the method get_client always returns the same GEOM_Client object (singleton object)
* and the SHAPE_READER macro can be used to define an object that is always this singleton object
class GEOMCLIENT_EXPORT GEOM_Client {
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 delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
// Methods PUBLIC
//
- //Standard_EXPORT
GEOM_Client();
- //Standard_EXPORT
GEOM_Client(Engines::Container_ptr client);
- //Standard_EXPORT
GEOM_Client(const GEOM_Client& client);
- //Standard_EXPORT
- Standard_Boolean Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
- //Standard_EXPORT
- Standard_Boolean Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
- //Standard_EXPORT
- void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S ) ;
- //Standard_EXPORT
+
TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape );
- //Standard_EXPORT
+ Standard_Boolean Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
void RemoveShapeFromBuffer( const TCollection_AsciiString& IOR ) ;
- //Standard_EXPORT
void ClearClientBuffer() ;
- //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();
#else
#endif
private:
+ // Methods PRIVATE
+ //
+ Standard_Boolean Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
+ void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S, int Tick ) ;
+ TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
+
// Fields PRIVATE
//
std::map< TCollection_AsciiString , std::vector<TopoDS_Shape> > _mySubShapes;
std::map< TCollection_AsciiString , TopoDS_Shape > myShapesMap;
+ std::map< TCollection_AsciiString , int > myTicksMap;
long pid_client;
};