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.
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <Interface_InterfaceMismatch.hxx>
18 #include <Standard_Type.hxx>
19 #include <StepData_ECDescr.hxx>
20 #include <StepData_Field.hxx>
21 #include <StepData_Plex.hxx>
22 #include <StepData_Simple.hxx>
23 #include <TCollection_AsciiString.hxx>
25 IMPLEMENT_STANDARD_RTTIEXT(StepData_Plex,StepData_Described)
27 static StepData_Field bid;
29 StepData_Plex::StepData_Plex (const Handle(StepData_ECDescr)& descr)
30 : StepData_Described (descr) { }
32 void StepData_Plex::Add (const Handle(StepData_Simple)& member)
33 { themembers.Append (member); }
35 Handle(StepData_ECDescr) StepData_Plex::ECDescr () const
36 { return Handle(StepData_ECDescr)::DownCast(Description()); }
39 Standard_Boolean StepData_Plex::IsComplex () const
40 { return Standard_True; }
42 Standard_Boolean StepData_Plex::Matches (const Standard_CString steptype) const
44 Standard_Integer i, nb = NbMembers();
45 for (i = 1; i <= nb; i ++) {
46 if (Member(i)->Matches (steptype)) return Standard_True;
48 return Standard_False;
51 Handle(StepData_Simple) StepData_Plex::As (const Standard_CString steptype) const
53 Handle(StepData_Simple) ent;
54 Standard_Integer i, nb = NbMembers();
55 for (i = 1; i <= nb; i ++) {
57 if (ent->Matches(steptype)) return ent;
63 Standard_Boolean StepData_Plex::HasField (const Standard_CString name) const
65 Standard_Integer i, nb = NbMembers();
66 for (i = 1; i <= nb; i ++) {
67 if (Member(i)->HasField (name)) return Standard_True;
69 return Standard_False;
72 const StepData_Field& StepData_Plex::Field (const Standard_CString name) const
74 Handle(StepData_Simple) ent;
75 Standard_Integer i, nb = NbMembers();
76 for (i = 1; i <= nb; i ++) {
78 if (ent->HasField (name)) return ent->Field (name);
80 Interface_InterfaceMismatch::Raise("StepData_Plex : Field");
81 return bid; // pour faire plaisir au compilo
85 StepData_Field& StepData_Plex::CField (const Standard_CString name)
87 Handle(StepData_Simple) ent;
88 Standard_Integer i, nb = NbMembers();
89 for (i = 1; i <= nb; i ++) {
91 if (ent->HasField (name)) return ent->CField (name);
93 Interface_InterfaceMismatch::Raise("StepData_Plex : Field");
94 return bid; // pour faire plaisir au compilo
98 Standard_Integer StepData_Plex::NbMembers () const
99 { return themembers.Length(); }
101 Handle(StepData_Simple) StepData_Plex::Member (const Standard_Integer num) const
102 { return Handle(StepData_Simple)::DownCast (themembers.Value(num)); }
104 Handle(TColStd_HSequenceOfAsciiString) StepData_Plex::TypeList () const
106 Handle(TColStd_HSequenceOfAsciiString) tl = new TColStd_HSequenceOfAsciiString();
107 Standard_Integer i, nb = NbMembers();
108 for (i = 1; i <= nb; i ++) {
109 TCollection_AsciiString nam (Member(i)->StepType());
116 void StepData_Plex::Check(Handle(Interface_Check)& ach) const
118 Standard_Integer i, nb = NbMembers();
119 for (i = 1; i <= nb; i ++) {
120 Handle(StepData_Simple) si = Member(i);
126 void StepData_Plex::Shared (Interface_EntityIterator& list) const
128 Standard_Integer i, nb = NbMembers();
129 for (i = 1; i <= nb; i ++) {
130 Handle(StepData_Simple) si = Member(i);