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