Version: 9.16.0
GEOM_Client.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22// File : GEOM_Client.hxx
23// Author : Yves FRICAUD
24// Module : GEOM
25
26#ifndef _GEOM_Client_HeaderFile
27#define _GEOM_Client_HeaderFile
28
29#include <SALOMEconfig.h>
30#include CORBA_SERVER_HEADER(GEOM_Gen)
31
32#include <Standard_Boolean.hxx>
33#include <TCollection_AsciiString.hxx>
34#include <TopoDS_Shape.hxx>
35
36#include <map>
37#include <vector>
38
39#ifdef WIN32
40 #if defined GEOMCLIENT_EXPORTS || defined GEOMClient_EXPORTS
41 #define GEOMCLIENT_EXPORT __declspec( dllexport )
42 #else
43 #define GEOMCLIENT_EXPORT __declspec( dllimport )
44 #endif
45#else
46 #define GEOMCLIENT_EXPORT
47#endif
48
49/*
50 * if define SINGLE_CLIENT is not commented, the method get_client always returns the same GEOM_Client object (singleton object)
51 * and the SHAPE_READER macro can be used to define an object that is always this singleton object
52 * if define SINGLE_CLIENT is commented, we get the old way to define the GEOM_Client objects : get_client returns a new object
53 * and the SHAPE_READER macro defines also a new object
54 */
55#define SINGLE_CLIENT
56
57//=====================================================================
58// GEOM_Client : class definition
59//=====================================================================
61
62 public:
63 // Methods PUBLIC
64 //
66 GEOM_Client(Engines::Container_ptr client);
67 GEOM_Client(const GEOM_Client& client);
68
69 TopoDS_Shape GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape );
70 Standard_Boolean Find( const TopoDS_Shape& S, TCollection_AsciiString& IOR ) ;
71 void RemoveShapeFromBuffer( const TCollection_AsciiString& IOR ) ;
72 void ClearClientBuffer() ;
73
74#ifdef SINGLE_CLIENT
75 static GEOM_Client& get_client();
76#else
77 static GEOM_Client get_client();
78#endif
79
80 private:
81 // Methods PRIVATE
82 //
83 Standard_Boolean Find( const TCollection_AsciiString& IOR, TopoDS_Shape& S ) ;
84 void Bind( const TCollection_AsciiString& IOR, const TopoDS_Shape& S, int Tick ) ;
85 TopoDS_Shape Load( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_ptr aShape);
86
87 // Fields PRIVATE
88 //
89 std::map< TCollection_AsciiString , std::vector<TopoDS_Shape> > _mySubShapes;
90 std::map< TCollection_AsciiString , TopoDS_Shape > myShapesMap;
91 std::map< TCollection_AsciiString , int > myTicksMap;
93};
94
95#ifdef SINGLE_CLIENT
96#define SHAPE_READER(obj) GEOM_Client& obj=GEOM_Client::get_client()
97#else
98#define SHAPE_READER(obj) GEOM_Client obj
99#endif
100
101#endif
#define GEOMCLIENT_EXPORT
Definition: GEOM_Client.hxx:46
Definition: GEOM_Client.hxx:60
long pid_client
Definition: GEOM_Client.hxx:92
std::map< TCollection_AsciiString, std::vector< TopoDS_Shape > > _mySubShapes
Definition: GEOM_Client.hxx:89
std::map< TCollection_AsciiString, int > myTicksMap
Definition: GEOM_Client.hxx:91
std::map< TCollection_AsciiString, TopoDS_Shape > myShapesMap
Definition: GEOM_Client.hxx:90