0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / IFSelect / IFSelect_DispPerSignature.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IFGraph_SubPartsIterator.hxx>
16 #include <IFSelect_DispPerSignature.hxx>
17 #include <IFSelect_Selection.hxx>
18 #include <IFSelect_SignCounter.hxx>
19 #include <Interface_EntityIterator.hxx>
20 #include <Interface_Graph.hxx>
21 #include <Interface_InterfaceError.hxx>
22 #include <Standard_Type.hxx>
23 #include <TCollection_AsciiString.hxx>
24 #include <TCollection_HAsciiString.hxx>
25 #include <TColStd_HSequenceOfHAsciiString.hxx>
26 #include <TColStd_HSequenceOfTransient.hxx>
27
28 #include <stdio.h>
29 IMPLEMENT_STANDARD_RTTIEXT(IFSelect_DispPerSignature,IFSelect_Dispatch)
30
31 IFSelect_DispPerSignature::IFSelect_DispPerSignature ()    {  }
32
33     Handle(IFSelect_SignCounter)  IFSelect_DispPerSignature::SignCounter () const
34 {  return thesign;  }
35
36     void  IFSelect_DispPerSignature::SetSignCounter
37   (const Handle(IFSelect_SignCounter)& sign)
38 {  thesign = sign;  thesign->SetList (Standard_True);  }
39
40     Standard_CString  IFSelect_DispPerSignature::SignName () const
41 {  return (Standard_CString ) (thesign.IsNull() ? "???" : thesign->Name());  }
42
43     TCollection_AsciiString  IFSelect_DispPerSignature::Label () const
44 {
45   char lab[50];
46   sprintf (lab,"One File per Signature %s",SignName());
47   return TCollection_AsciiString(lab);
48 }
49
50     Standard_Boolean  IFSelect_DispPerSignature::LimitedMax
51   (const Standard_Integer nbent, Standard_Integer& max) const
52 {
53   max = nbent;
54   return Standard_True;
55 }
56
57     void  IFSelect_DispPerSignature::Packets
58   (const Interface_Graph& G, IFGraph_SubPartsIterator& packs) const
59 {
60   if (thesign.IsNull()) {
61     packs.AddPart();
62     packs.GetFromIter (FinalSelection()->RootResult(G));
63     return;
64   }
65
66   thesign->Clear();
67   thesign->AddList (FinalSelection()->RootResult(G).Content(),G.Model());
68   Handle(TColStd_HSequenceOfHAsciiString) list = thesign->List();
69   Standard_Integer i,nb,is,nbs = list->Length();
70   Handle(TCollection_HAsciiString) asign;
71   Handle(TColStd_HSequenceOfTransient) ents;
72   for (is = 1; is <= nbs; is ++) {
73     asign = list->Value(is);
74     ents = thesign->Entities (asign->ToCString());
75     if (ents.IsNull()) continue;
76     packs.AddPart();
77     nb = ents->Length();
78     for (i = 1; i <= nb; i ++)
79       packs.GetFromEntity (ents->Value(i),Standard_False);
80   }
81 }