0024157: Parallelization of assembly part of BO
[occt.git] / src / IFSelect / IFSelect_AppliedModifiers.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <IFSelect_AppliedModifiers.ixx>
19
20
b311480e 21IFSelect_AppliedModifiers::IFSelect_AppliedModifiers
7fd59977 22 (const Standard_Integer nbmax, const Standard_Integer nbent)
23 : thelists (nbmax+1)
24{
25 thenbent = nbent; theentcnt = 0;
26}
27
28 Standard_Boolean IFSelect_AppliedModifiers::AddModif
29 (const Handle(IFSelect_GeneralModifier)& modif)
30{
31 if (themodifs.Length() >= thelists.NbEntities()) return Standard_False;
32 themodifs.Append(modif);
33 thelists.SetNumber (themodifs.Length());
34 return Standard_True;
35}
36
37 Standard_Boolean IFSelect_AppliedModifiers::AddNum
38 (const Standard_Integer nument)
39{
40 thelists.Add (nument);
41 return Standard_True;
42}
43
44
45 Standard_Integer IFSelect_AppliedModifiers::Count () const
46 { return themodifs.Length(); }
47
48 Standard_Boolean IFSelect_AppliedModifiers::Item
49 (const Standard_Integer num,
50 Handle(IFSelect_GeneralModifier)& modif,
51 Standard_Integer& entcount)
52{
53 if (num < 1 || num > themodifs.Length()) return Standard_False;
54 modif = themodifs.Value(num);
55 thelists.SetNumber (num);
56 theentcnt = thelists.Length();
57 entcount = (theentcnt > 0 ? theentcnt : thenbent);
58 return Standard_True;
59}
60
61 Standard_Integer IFSelect_AppliedModifiers::ItemNum
62 (const Standard_Integer nument) const
63 { return (theentcnt > 0 ? thelists.Value(nument) : nument); }
64
65 Handle(TColStd_HSequenceOfInteger) IFSelect_AppliedModifiers::ItemList () const
66{
67 Handle(TColStd_HSequenceOfInteger) list = new TColStd_HSequenceOfInteger();
68 Standard_Integer i, nb = (theentcnt > 0 ? theentcnt : thenbent);
69 for (i = 1; i <= nb; i ++) list->Append (ItemNum(i));
70 return list;
71}
72
73 Standard_Boolean IFSelect_AppliedModifiers::IsForAll () const
74 { return (theentcnt == 0); }