46c23c0a1f01d0e727a6949de36483f395bf730e
[occt.git] / src / Transfer / Transfer_TransferIterator.hxx
1 // Created on: 1992-10-28
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 _Transfer_TransferIterator_HeaderFile
18 #define _Transfer_TransferIterator_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Transfer_HSequenceOfBinder.hxx>
25 #include <TColStd_HSequenceOfInteger.hxx>
26 #include <Standard_Integer.hxx>
27 #include <Standard_Type.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Transfer_StatusExec.hxx>
30 class Standard_NoSuchObject;
31 class Transfer_Binder;
32 class Standard_Transient;
33 class Interface_Check;
34
35 // resolve name collisions with X11 headers
36 #ifdef Status
37   #undef Status
38 #endif
39
40 //! Defines an Iterator on the result of a Transfer
41 //! Available for Normal Results or not (Erroneous Transfer)
42 //! It gives several kinds of Informations, and allows to consider
43 //! various criteria (criteria are cumulative)
44 class Transfer_TransferIterator 
45 {
46 public:
47
48   DEFINE_STANDARD_ALLOC
49
50   
51   //! Creates an empty Iterator
52   Standard_EXPORT Transfer_TransferIterator();
53   
54   //! Adds a Binder to the iteration list (construction)
55   Standard_EXPORT void AddItem (const Handle(Transfer_Binder)& atr);
56   
57   //! Selects Items on the Type of Binder : keep only
58   //! Binders which are of a given Type (if keep is True) or
59   //! reject only them (if keep is False)
60   Standard_EXPORT void SelectBinder (const Handle(Standard_Type)& atype, const Standard_Boolean keep);
61   
62   //! Selects Items on the Type of Result. Considers only Unique
63   //! Results. Considers Dynamic Type for Transient Result,
64   //! Static Type (the one given to define the Binder) else.
65   //!
66   //! Results which are of a given Type (if keep is True) or reject
67   //! only them (if keep is False)
68   Standard_EXPORT void SelectResult (const Handle(Standard_Type)& atype, const Standard_Boolean keep);
69   
70   //! Select Items according Unicity : keep only Unique Results (if
71   //! keep is True) or keep only Multiple Results (if keep is False)
72   Standard_EXPORT void SelectUnique (const Standard_Boolean keep);
73   
74   //! Selects/Unselect (according to <keep> an item designated by
75   //! its rank <num> in the list
76   //! Used by sub-classes which have specific criteria
77   Standard_EXPORT void SelectItem (const Standard_Integer num, const Standard_Boolean keep);
78   
79   //! Returns count of Binders to be iterated
80   Standard_EXPORT Standard_Integer Number() const;
81   
82   //! Clears Iteration in progress, to allow it to be restarted
83   Standard_EXPORT void Start();
84   
85   //! Returns True if there are other Items to iterate
86   Standard_EXPORT Standard_Boolean More();
87   
88   //! Sets Iteration to the next Item
89   Standard_EXPORT void Next();
90   
91   //! Returns the current Binder
92   Standard_EXPORT const Handle(Transfer_Binder)& Value() const;
93   
94   //! Returns True if current Item brings a Result, Transient
95   //! (Handle) or not or Multiple. That is to say, if it corresponds
96   //! to a normally acheived Transfer, Transient Result is read by
97   //! specific TransientResult below.
98   //! Other kind of Result must be read specifically from its Binder
99   Standard_EXPORT Standard_Boolean HasResult() const;
100   
101   //! Returns True if Current Item has a Unique Result
102   Standard_EXPORT Standard_Boolean HasUniqueResult() const;
103   
104   //! Returns the Type of the Result of the current Item, if Unique.
105   //! If No Unique Result (Error Transfert or Multiple Result),
106   //! returns a Null Handle
107   //! The Type is : the Dynamic Type for a Transient Result,
108   //! the Type defined by the Binder Class else
109   Standard_EXPORT Handle(Standard_Type) ResultType() const;
110   
111   //! Returns True if the current Item has a Transient Unique
112   //! Result (if yes, use TransientResult to get it)
113   Standard_EXPORT Standard_Boolean HasTransientResult() const;
114   
115   //! Returns the Transient Result of the current Item if there is
116   //! (else, returns a null Handle)
117   //! Supposes that Binding is done by a SimpleBinderOfTransient
118   Standard_EXPORT const Handle(Standard_Transient)& TransientResult() const;
119   
120   //! Returns Execution Status of current Binder
121   //! Normal transfer corresponds to StatusDone
122   Standard_EXPORT Transfer_StatusExec Status() const;
123   
124   //! Returns True if Fail Messages are recorded with the current
125   //! Binder. They can then be read through Check (see below)
126   Standard_EXPORT Standard_Boolean HasFails() const;
127   
128   //! Returns True if Warning Messages are recorded with the current
129   //! Binder. They can then be read through Check (see below)
130   Standard_EXPORT Standard_Boolean HasWarnings() const;
131   
132   //! Returns Check associated to current Binder
133   //! (in case of error, it brings Fail messages)
134   //! (in case of warnings, it brings Warning messages)
135   Standard_EXPORT const Handle(Interface_Check) Check() const;
136
137
138
139
140 protected:
141
142
143
144   Standard_Integer thecurr;
145
146
147 private:
148
149
150
151   Handle(Transfer_HSequenceOfBinder) theitems;
152   Handle(TColStd_HSequenceOfInteger) theselect;
153   Standard_Integer themaxi;
154
155
156 };
157
158
159
160
161
162
163
164 #endif // _Transfer_TransferIterator_HeaderFile