summaryrefslogtreecommitdiff
path: root/inc/Transfer_Iterator.gxx
blob: ef4e6c57d50854e591727532f0b4d8e8942cad3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//  Transfer_Iterator.gxx
#include <Standard_NoSuchObject.hxx>


//  TheStart est suppose Handle(Standard_Transient) ou (Transfer_Finder)
//  Il a servi a instancier TheList qui est une HSequence


    Transfer_Iterator::Transfer_Iterator (const Standard_Boolean withstarts)
    : Transfer_TransferIterator ()
{  if (withstarts) thestarts = new TheList();  }


    void  Transfer_Iterator::Add
  (const Handle(Transfer_Binder)& binder)
{
  if (!thestarts.IsNull()) Standard_NoSuchObject::Raise
    ("Transfer_Iterator : Add, Starting Object required not provided");
  AddItem(binder);
}

    void  Transfer_Iterator::Add
  (const Handle(Transfer_Binder)& binder, const TheStart& start)
{
  AddItem(binder);
  if (!thestarts.IsNull()) thestarts->Append(start);
}

    void  Transfer_Iterator::Filter
  (const Handle(TheList)& list, const Standard_Boolean keep)
{
  if (list.IsNull() || thestarts.IsNull()) return;
  Standard_Integer i, j, nb = thestarts->Length();
  if (nb == 0) return;
  Handle(Transfer_Binder) factice;
  Transfer_TransferMap amap (nb);
  for (i = 1; i <= nb; i ++) {
    j = amap.Add (thestarts->Value(i),factice);
    SelectItem (j,!keep);
  }

//  Comparaison
  nb = list->Length();
  for (i = 1; i <= nb; i ++) {
    j = amap.FindIndex (list->Value(i));
    if (j > 0) SelectItem (j,keep);
  }
}

    Standard_Boolean  Transfer_Iterator::HasStarting () const
      {  return (!thestarts.IsNull());  }

    const TheStart&  Transfer_Iterator::Starting () const
{
//  if (thecurr == 0 || thecurr > themaxi) Standard_NoSuchObject::Raise
//    ("TransferIterator : Starting");
//  if (theselect->Value(thecurr) == 0)    Standard_NoSuchObject::Raise
//    ("TransferIterator : Starting");
  if (thestarts.IsNull()) Standard_NoSuchObject::Raise
    ("TransferIterator : No Starting defined at all");
  return thestarts->Value(thecurr);
}