1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 // Transfer_Iterator.gxx
15 #include <Standard_NoSuchObject.hxx>
18 // TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder)
19 // Il a servi a instancier TheList qui est une HSequence
22 Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts)
23 : Transfer_TransferIterator ()
24 { if (withstarts) thestarts = new TheList(); }
27 void Transfer_Iterator::Add
28 (const Handle(Transfer_Binder)& binder)
30 if (!thestarts.IsNull()) throw Standard_NoSuchObject("Transfer_Iterator : Add, Starting Object required not provided");
34 void Transfer_Iterator::Add
35 (const Handle(Transfer_Binder)& binder, const TheStart& start)
38 if (!thestarts.IsNull()) thestarts->Append(start);
41 void Transfer_Iterator::Filter
42 (const Handle(TheList)& list, const Standard_Boolean keep)
44 if (list.IsNull() || thestarts.IsNull()) return;
45 Standard_Integer i, j, nb = thestarts->Length();
47 Handle(Transfer_Binder) factice;
48 Transfer_TransferMap amap (nb);
49 for (i = 1; i <= nb; i ++) {
50 j = amap.Add (thestarts->Value(i),factice);
56 for (i = 1; i <= nb; i ++) {
57 j = amap.FindIndex (list->Value(i));
58 if (j > 0) SelectItem (j,keep);
62 Standard_Boolean Transfer_Iterator::HasStarting () const
63 { return (!thestarts.IsNull()); }
65 const TheStart& Transfer_Iterator::Starting () const
67 // if (thecurr == 0 || thecurr > themaxi) throw Standard_NoSuchObject
68 // ("TransferIterator : Starting");
69 // if (theselect->Value(thecurr) == 0) throw Standard_NoSuchObject
70 // ("TransferIterator : Starting");
71 if (thestarts.IsNull()) throw Standard_NoSuchObject("TransferIterator : No Starting defined at all");
72 return thestarts->Value(thecurr);