X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMClient%2FGEOM_Client.hxx;h=717efb3314274f8874f61d733bbbd481bf17c143;hb=40f5df35aa4780823d1198399b7ebe5feba9ca77;hp=0dbaddd6362459e75748c6082bdbb0b4d9679417;hpb=10f156c322d94d87375388dec09e49f1cd01a9a7;p=modules%2Fgeom.git diff --git a/src/GEOMClient/GEOM_Client.hxx b/src/GEOMClient/GEOM_Client.hxx index 0dbaddd63..717efb331 100644 --- a/src/GEOMClient/GEOM_Client.hxx +++ b/src/GEOMClient/GEOM_Client.hxx @@ -1,38 +1,37 @@ -// GEOM GEOMClient : tool to transfer BREP files from GEOM server to GEOM client +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// 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. -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// 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. // +// 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 // // File : GEOM_Client.hxx // Author : Yves FRICAUD // Module : GEOM -// $Header$ #ifndef _GEOM_Client_HeaderFile #define _GEOM_Client_HeaderFile #include -#include CORBA_SERVER_HEADER(GEOM_Shape) #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 #endif @@ -42,10 +41,10 @@ #ifndef _Standard_Integer_HeaderFile #include #endif + class TCollection_AsciiString; class TopoDS_Shape; - #ifndef _Standard_HeaderFile #include #endif @@ -53,44 +52,97 @@ class TopoDS_Shape; #include #endif +#ifdef WNT + #if defined GEOMCLIENT_EXPORTS || defined GEOMClient_EXPORTS + #if defined WIN32 + #define GEOMCLIENT_EXPORT __declspec( dllexport ) + #else + #define GEOMCLIENT_EXPORT + #endif + #else + #if defined WIN32 + #define GEOMCLIENT_EXPORT __declspec( dllimport ) + #else + #define GEOMCLIENT_EXPORT + #endif + #endif +#else + #define GEOMCLIENT_EXPORT +#endif + +#include +#include +#include +#include + +/* + * 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 + * if define SINGLE_CLIENT is commented, we get the old way to define the GEOM_Client objects : get_client returns a new object + * and the SHAPE_READER macro defines also a new object + */ +#define SINGLE_CLIENT + //===================================================================== // GEOM_Client : class definition //===================================================================== -class GEOM_Client { +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 GEOM_Client(); - Standard_EXPORT GEOM_Client(Engines::Container_ptr client); - 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 TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape ); - Standard_EXPORT void RemoveShapeFromBuffer( const TCollection_AsciiString& shapeIOR ) ; - Standard_EXPORT void ClearClientBuffer() ; - Standard_EXPORT unsigned int BufferLength() ; - TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Shape_ptr aShape); + // + //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 + 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 + static GEOM_Client get_client(); +#endif -private: + private: // Fields PRIVATE // - TColStd_SequenceOfAsciiString myIORs ; - TopTools_SequenceOfShape myShapes ; + std::map< TCollection_AsciiString , std::vector > _mySubShapes; + std::map< TCollection_AsciiString , TopoDS_Shape > myShapesMap; long pid_client; }; +#ifdef SINGLE_CLIENT +#define SHAPE_READER(obj) GEOM_Client& obj=GEOM_Client::get_client() +#else +#define SHAPE_READER(obj) GEOM_Client obj +#endif #endif