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.
14 #include <StepData_Plex.ixx>
15 #include <TCollection_AsciiString.hxx>
16 #include <Interface_InterfaceMismatch.hxx>
17 #include <StepData_ECDescr.hxx>
18 #include <StepData_Simple.hxx>
21 static StepData_Field bid;
23 StepData_Plex::StepData_Plex (const Handle(StepData_ECDescr)& descr)
24 : StepData_Described (descr) { }
26 void StepData_Plex::Add (const Handle(StepData_Simple)& member)
27 { themembers.Append (member); }
29 Handle(StepData_ECDescr) StepData_Plex::ECDescr () const
30 { return Handle(StepData_ECDescr)::DownCast(Description()); }
33 Standard_Boolean StepData_Plex::IsComplex () const
34 { return Standard_True; }
36 Standard_Boolean StepData_Plex::Matches (const Standard_CString steptype) const
38 Standard_Integer i, nb = NbMembers();
39 for (i = 1; i <= nb; i ++) {
40 if (Member(i)->Matches (steptype)) return Standard_True;
42 return Standard_False;
45 Handle(StepData_Simple) StepData_Plex::As (const Standard_CString steptype) const
47 Handle(StepData_Simple) ent;
48 Standard_Integer i, nb = NbMembers();
49 for (i = 1; i <= nb; i ++) {
51 if (ent->Matches(steptype)) return ent;
57 Standard_Boolean StepData_Plex::HasField (const Standard_CString name) const
59 Standard_Integer i, nb = NbMembers();
60 for (i = 1; i <= nb; i ++) {
61 if (Member(i)->HasField (name)) return Standard_True;
63 return Standard_False;
66 const StepData_Field& StepData_Plex::Field (const Standard_CString name) const
68 Handle(StepData_Simple) ent;
69 Standard_Integer i, nb = NbMembers();
70 for (i = 1; i <= nb; i ++) {
72 if (ent->HasField (name)) return ent->Field (name);
74 Interface_InterfaceMismatch::Raise("StepData_Plex : Field");
75 return bid; // pour faire plaisir au compilo
79 StepData_Field& StepData_Plex::CField (const Standard_CString name)
81 Handle(StepData_Simple) ent;
82 Standard_Integer i, nb = NbMembers();
83 for (i = 1; i <= nb; i ++) {
85 if (ent->HasField (name)) return ent->CField (name);
87 Interface_InterfaceMismatch::Raise("StepData_Plex : Field");
88 return bid; // pour faire plaisir au compilo
92 Standard_Integer StepData_Plex::NbMembers () const
93 { return themembers.Length(); }
95 Handle(StepData_Simple) StepData_Plex::Member (const Standard_Integer num) const
96 { return Handle(StepData_Simple)::DownCast (themembers.Value(num)); }
98 Handle(TColStd_HSequenceOfAsciiString) StepData_Plex::TypeList () const
100 Handle(TColStd_HSequenceOfAsciiString) tl = new TColStd_HSequenceOfAsciiString();
101 Standard_Integer i, nb = NbMembers();
102 for (i = 1; i <= nb; i ++) {
103 TCollection_AsciiString nam (Member(i)->StepType());
110 void StepData_Plex::Check(Handle(Interface_Check)& ach) const
112 Standard_Integer i, nb = NbMembers();
113 for (i = 1; i <= nb; i ++) {
114 Handle(StepData_Simple) si = Member(i);
120 void StepData_Plex::Shared (Interface_EntityIterator& list) const
122 Standard_Integer i, nb = NbMembers();
123 for (i = 1; i <= nb; i ++) {
124 Handle(StepData_Simple) si = Member(i);