7fd59977 |
1 | #include <StepData_Simple.ixx> |
2 | #include <Interface_InterfaceMismatch.hxx> |
3 | |
4 | StepData_Simple::StepData_Simple (const Handle(StepData_ESDescr)& descr) |
5 | : StepData_Described (descr) , thefields (descr->NbFields()) { } |
6 | |
7 | Handle(StepData_ESDescr) StepData_Simple::ESDescr () const |
8 | { return Handle(StepData_ESDescr)::DownCast (Description()); } |
9 | |
10 | Standard_CString StepData_Simple::StepType () const |
11 | { return ESDescr()->TypeName(); } |
12 | |
13 | |
14 | Standard_Boolean StepData_Simple::IsComplex () const |
15 | { return Standard_False; } |
16 | |
17 | Standard_Boolean StepData_Simple::Matches (const Standard_CString steptype) const |
18 | { return ESDescr()->Matches (steptype); } |
19 | |
20 | Handle(StepData_Simple) StepData_Simple::As (const Standard_CString steptype) const |
21 | { |
22 | Handle(StepData_Simple) nulent; |
23 | if (Matches(steptype)) return this; |
24 | return nulent; |
25 | } |
26 | |
27 | |
28 | Standard_Boolean StepData_Simple::HasField (const Standard_CString name) const |
29 | { |
30 | Standard_Integer num = ESDescr()->Rank (name); |
31 | return (num > 0); |
32 | } |
33 | |
34 | const StepData_Field& StepData_Simple::Field (const Standard_CString name) const |
35 | { |
36 | Standard_Integer num = ESDescr()->Rank (name); |
37 | if (num == 0) Interface_InterfaceMismatch::Raise("StepData_Simple : Field"); |
38 | return FieldNum (num); |
39 | } |
40 | |
41 | StepData_Field& StepData_Simple::CField (const Standard_CString name) |
42 | { |
43 | Standard_Integer num = ESDescr()->Rank (name); |
44 | if (num == 0) Interface_InterfaceMismatch::Raise("StepData_Simple : Field"); |
45 | return CFieldNum (num); |
46 | } |
47 | |
48 | Standard_Integer StepData_Simple::NbFields () const |
49 | { return thefields.NbFields(); } |
50 | |
51 | const StepData_Field& StepData_Simple::FieldNum (const Standard_Integer num) const |
52 | { return thefields.Field(num); } |
53 | |
54 | StepData_Field& StepData_Simple::CFieldNum (const Standard_Integer num) |
55 | { return thefields.CField(num); } |
56 | |
57 | const StepData_FieldListN& StepData_Simple::Fields () const |
58 | { return thefields; } |
59 | |
60 | StepData_FieldListN& StepData_Simple::CFields () |
61 | { return thefields; } |
62 | |
63 | |
64 | void StepData_Simple::Check(Handle(Interface_Check)& ach) const |
65 | { |
66 | } // qq chose ? cf la description |
67 | |
68 | |
69 | void StepData_Simple::Shared (Interface_EntityIterator& list) const |
70 | { |
71 | Standard_Integer i, nb = thefields.NbFields(); |
72 | for (i = 1; i <= nb; i ++) { |
73 | const StepData_Field& fi = thefields.Field(i); |
74 | Standard_Integer j1,j2,l1,l2; l1 = l2 = 1; |
75 | if (fi.Arity() >= 1) l1 = fi.Length(1); |
76 | if (fi.Arity() > 1) l2 = fi.Length(2); |
77 | for (j1 = 1; j1 <= l1; j1 ++) { |
78 | for (j2 = 1; j2 <= l2; j2 ++) { |
79 | Handle(Standard_Transient) ent = fi.Entity(j1,j2); |
80 | if (!ent.IsNull()) list.AddItem(ent); |
81 | } |
82 | } |
83 | } |
84 | } |