1 //static const char* sccsid = "@(#)Expr_RelationIterator.cxx 3.2 95/01/10"; // Do not delete this line. Used by sccs.
2 // Copyright: Matra-Datavision 1991
3 // File: Expr_RelationIterator.cxx
4 // Created: Thu Jun 13 16:57:35 1991
5 // Author: Arnaud BOUZY
8 #include <Expr_RelationIterator.ixx>
9 #include <Standard_NoMoreObject.hxx>
10 #include <Standard_NoSuchObject.hxx>
11 #include <Expr_SystemRelation.hxx>
13 Expr_RelationIterator::Expr_RelationIterator (const Handle(Expr_GeneralRelation)& rel):myRelation(1,rel->NbOfSingleRelations())
15 if (rel->IsKind(STANDARD_TYPE(Expr_SingleRelation))) {
16 myRelation(1) = Handle(Expr_SingleRelation)::DownCast(rel);
19 Standard_Integer nbcur = 1;
20 Handle(Expr_GeneralRelation) currel;
21 for (Standard_Integer i =1; i<= rel->NbOfSubRelations(); i++) {
22 currel = rel->SubRelation(i);
23 if (currel->IsKind(STANDARD_TYPE(Expr_SingleRelation))) {
24 myRelation(nbcur) = Handle(Expr_SingleRelation)::DownCast(currel);
28 Expr_RelationIterator subit(currel);
29 while (subit.More()) {
30 myRelation(nbcur) = subit.Value();
40 Standard_Boolean Expr_RelationIterator::More () const
42 return (current <= myRelation.Length());
45 void Expr_RelationIterator::Next ()
48 Standard_NoMoreObject::Raise();
53 Handle(Expr_SingleRelation) Expr_RelationIterator::Value () const
56 Standard_NoSuchObject::Raise();
58 return myRelation(current);