42cf5bc1 |
1 | // Created on: 1992-02-03 |
2 | // Created by: Christian CAILLET |
3 | // Copyright (c) 1992-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_GeneralLib_HeaderFile |
18 | #define _Interface_GeneralLib_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | class Interface_NodeOfGeneralLib; |
27 | class Standard_NoSuchObject; |
28 | class Standard_Transient; |
29 | class Interface_GeneralModule; |
30 | class Interface_Protocol; |
31 | class Interface_GlobalNodeOfGeneralLib; |
32 | |
33 | |
34 | |
35 | class Interface_GeneralLib |
36 | { |
37 | public: |
38 | |
39 | DEFINE_STANDARD_ALLOC |
40 | |
41 | |
36b9ff75 |
42 | //! Adds a couple (Module-Protocol) into the global definition set |
43 | //! for this class of Library. |
42cf5bc1 |
44 | Standard_EXPORT static void SetGlobal (const Handle(Interface_GeneralModule)& amodule, const Handle(Interface_Protocol)& aprotocol); |
45 | |
36b9ff75 |
46 | //! Creates a Library which complies with a Protocol, that is : |
47 | //! Same class (criterium IsInstance) |
48 | //! This creation gets the Modules from the global set, those |
49 | //! which are bound to the given Protocol and its Resources |
42cf5bc1 |
50 | Standard_EXPORT Interface_GeneralLib(const Handle(Interface_Protocol)& aprotocol); |
51 | |
36b9ff75 |
52 | //! Creates an empty Library : it will later by filled by method |
53 | //! AddProtocol |
42cf5bc1 |
54 | Standard_EXPORT Interface_GeneralLib(); |
55 | |
36b9ff75 |
56 | //! Adds a couple (Module-Protocol) to the Library, given the |
57 | //! class of a Protocol. Takes Resources into account. |
58 | //! (if <aprotocol> is not of type TheProtocol, it is not added) |
42cf5bc1 |
59 | Standard_EXPORT void AddProtocol (const Handle(Standard_Transient)& aprotocol); |
60 | |
36b9ff75 |
61 | //! Clears the list of Modules of a library (can be used to |
62 | //! redefine the order of Modules before action : Clear then |
63 | //! refill the Library by calls to AddProtocol) |
42cf5bc1 |
64 | Standard_EXPORT void Clear(); |
65 | |
36b9ff75 |
66 | //! Sets a library to be defined with the complete Global list |
67 | //! (all the couples Protocol/Modules recorded in it) |
42cf5bc1 |
68 | Standard_EXPORT void SetComplete(); |
69 | |
36b9ff75 |
70 | //! Selects a Module from the Library, given an Object. |
71 | //! Returns True if Select has succeeded, False else. |
72 | //! Also Returns (as arguments) the selected Module and the Case |
73 | //! Number determined by the associated Protocol. |
74 | //! If Select has failed, <module> is Null Handle and CN is zero. |
75 | //! (Select can work on any criterium, such as Object DynamicType) |
42cf5bc1 |
76 | Standard_EXPORT Standard_Boolean Select (const Handle(Standard_Transient)& obj, Handle(Interface_GeneralModule)& module, Standard_Integer& CN) const; |
77 | |
36b9ff75 |
78 | //! Starts Iteration on the Modules (sets it on the first one) |
42cf5bc1 |
79 | Standard_EXPORT void Start(); |
80 | |
36b9ff75 |
81 | //! Returns True if there are more Modules to iterate on |
42cf5bc1 |
82 | Standard_EXPORT Standard_Boolean More() const; |
83 | |
36b9ff75 |
84 | //! Iterates by getting the next Module in the list |
85 | //! If there is none, the exception will be raised by Value |
42cf5bc1 |
86 | Standard_EXPORT void Next(); |
87 | |
36b9ff75 |
88 | //! Returns the current Module in the Iteration |
42cf5bc1 |
89 | Standard_EXPORT const Handle(Interface_GeneralModule)& Module() const; |
90 | |
36b9ff75 |
91 | //! Returns the current Protocol in the Iteration |
42cf5bc1 |
92 | Standard_EXPORT const Handle(Interface_Protocol)& Protocol() const; |
93 | |
94 | |
95 | |
96 | |
97 | protected: |
98 | |
99 | |
100 | |
101 | |
102 | |
103 | private: |
104 | |
105 | |
106 | |
107 | Handle(Interface_NodeOfGeneralLib) thelist; |
108 | Handle(Interface_NodeOfGeneralLib) thecurr; |
109 | |
110 | |
111 | }; |
112 | |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | |
119 | #endif // _Interface_GeneralLib_HeaderFile |