42cf5bc1 |
1 | // Created on: 1998-01-08 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1998-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Interface_GTool_HeaderFile |
18 | #define _Interface_GTool_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Interface_GeneralLib.hxx> |
24 | #include <Interface_DataMapOfTransientInteger.hxx> |
25 | #include <TColStd_IndexedDataMapOfTransientTransient.hxx> |
26 | #include <MMgt_TShared.hxx> |
27 | #include <Standard_Integer.hxx> |
28 | #include <Standard_CString.hxx> |
29 | #include <Standard_Boolean.hxx> |
30 | class Interface_Protocol; |
31 | class Interface_SignType; |
32 | class Standard_Transient; |
33 | class Interface_InterfaceModel; |
34 | class Interface_GeneralLib; |
35 | class Interface_GeneralModule; |
36 | |
37 | |
38 | class Interface_GTool; |
39 | DEFINE_STANDARD_HANDLE(Interface_GTool, MMgt_TShared) |
40 | |
41 | //! GTool - General Tool for a Model |
42 | //! Provides the functions performed by Protocol/GeneralModule for |
43 | //! entities of a Model, and recorded in a GeneralLib |
44 | //! Optimized : once an entity has been queried, the GeneralLib is |
45 | //! not longer queried |
46 | //! Shareable between several users : as a Handle |
47 | class Interface_GTool : public MMgt_TShared |
48 | { |
49 | |
50 | public: |
51 | |
52 | |
53 | //! Creates an empty, not set, GTool |
54 | Standard_EXPORT Interface_GTool(); |
55 | |
56 | //! Creates a GTool from a Protocol |
57 | //! Optional starting count of entities |
58 | Standard_EXPORT Interface_GTool(const Handle(Interface_Protocol)& proto, const Standard_Integer nbent = 0); |
59 | |
60 | //! Sets a new SignType |
61 | Standard_EXPORT void SetSignType (const Handle(Interface_SignType)& sign); |
62 | |
63 | //! Returns the SignType. Can be null |
64 | Standard_EXPORT Handle(Interface_SignType) SignType() const; |
65 | |
66 | //! Returns the Signature for a Transient Object in a Model |
67 | //! It calls SignType to do that |
68 | //! If SignType is not defined, return ClassName of <ent> |
69 | Standard_EXPORT Standard_CString SignValue (const Handle(Standard_Transient)& ent, const Handle(Interface_InterfaceModel)& model) const; |
70 | |
71 | //! Returns the Name of the SignType, or "Class Name" |
72 | Standard_EXPORT Standard_CString SignName() const; |
73 | |
74 | //! Sets a new Protocol |
75 | //! if <enforce> is False and the new Protocol equates the old one |
76 | //! then nothing is done |
77 | Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto, const Standard_Boolean enforce = Standard_False); |
78 | |
79 | //! Returns the Protocol. Warning : it can be Null |
80 | Standard_EXPORT Handle(Interface_Protocol) Protocol() const; |
81 | |
82 | //! Returns the GeneralLib itself |
83 | Standard_EXPORT Interface_GeneralLib& Lib(); |
84 | |
85 | //! Reservates maps for a count of entities |
86 | //! <enforce> False : minimum count |
87 | //! <enforce> True : clears former reservations |
88 | //! Does not clear the maps |
89 | Standard_EXPORT void Reservate (const Standard_Integer nb, const Standard_Boolean enforce = Standard_False); |
90 | |
91 | //! Clears the maps which record, for each already recorded entity |
92 | //! its Module and Case Number |
93 | Standard_EXPORT void ClearEntities(); |
94 | |
95 | //! Selects for an entity, its Module and Case Number |
96 | //! It is optimised : once done for each entity, the result is |
97 | //! mapped and the GeneralLib is not longer queried |
98 | //! <enforce> True overpasses this optimisation |
99 | Standard_EXPORT Standard_Boolean Select (const Handle(Standard_Transient)& ent, Handle(Interface_GeneralModule)& gmod, Standard_Integer& CN, const Standard_Boolean enforce = Standard_False); |
100 | |
101 | |
102 | |
103 | |
92efcf78 |
104 | DEFINE_STANDARD_RTTIEXT(Interface_GTool,MMgt_TShared) |
42cf5bc1 |
105 | |
106 | protected: |
107 | |
108 | |
109 | |
110 | |
111 | private: |
112 | |
113 | |
114 | Handle(Interface_Protocol) theproto; |
115 | Handle(Interface_SignType) thesign; |
116 | Interface_GeneralLib thelib; |
117 | Interface_DataMapOfTransientInteger thentnum; |
118 | TColStd_IndexedDataMapOfTransientTransient thentmod; |
119 | |
120 | |
121 | }; |
122 | |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | #endif // _Interface_GTool_HeaderFile |