summaryrefslogtreecommitdiff
path: root/src/IGESData/IGESData_FileProtocol.cxx
blob: bb6d53130e3f2f6ce45f9ce498ab79d053c30c70 (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
#include  <IGESData_FileProtocol.ixx>


    IGESData_FileProtocol::IGESData_FileProtocol ()    {  }

    void  IGESData_FileProtocol::Add (const Handle(IGESData_Protocol)& protocol)
{
  if      (theresource.IsNull()) theresource = protocol;
  else if (theresource->IsInstance(protocol->DynamicType())) return; // passer
  else if (!thenext.IsNull()) thenext->Add(protocol);
  else {
    thenext = new IGESData_FileProtocol;
    thenext->Add(protocol);
  }
}

    Standard_Integer  IGESData_FileProtocol::NbResources () const
{
  Standard_Integer nb = (theresource.IsNull() ? 0 : 1);
  if (!thenext.IsNull()) nb += thenext->NbResources();
  return nb;
}

    Handle(Interface_Protocol) IGESData_FileProtocol::Resource
  (const Standard_Integer num) const
{
  Handle(IGESData_Protocol) res;
  if (num == 1) return theresource;
  else if (!thenext.IsNull()) return thenext->Resource(num-1);
  return res;  // Null
}