[GME-commit] GMESRC/GME/ConstraintManager OCLTree.h,1.11,1.12 OCLTree.cpp,1.19,1.20 OclConstraint.cpp,1.3,1.4

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Tue Apr 27 16:28:26 CDT 2004


Update of /var/lib/gme/GMESRC/GME/ConstraintManager
In directory braindrain:/tmp/cvs-serv14273

Modified Files:
	OCLTree.h OCLTree.cpp OclConstraint.cpp 
Log Message:
constarint: infinite recursion problem solved without correct violation management

CVS User: bogyom

Index: OCLTree.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLTree.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** OCLTree.h	23 Apr 2004 19:10:13 -0000	1.11
--- OCLTree.h	27 Apr 2004 20:28:23 -0000	1.12
***************
*** 393,396 ****
--- 393,399 ----
  		: public TreeNode
  	{
+ 		private:
+ 			static int m_iteratorLevel;
+ 
  		public :		string 						m_strName;
  					TreeNode* 				m_pThisNode;

Index: OCLTree.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OCLTree.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** OCLTree.cpp	23 Apr 2004 19:10:13 -0000	1.19
--- OCLTree.cpp	27 Apr 2004 20:28:23 -0000	1.20
***************
*** 1255,1258 ****
--- 1255,1259 ----
  //
  //##############################################################################################################################################
+ 	int MethodNode::m_iteratorLevel = 0;
  
  	MethodNode::MethodNode( TreeManager* pManager )
***************
*** 1507,1512 ****
--- 1508,1517 ----
  	}
  
+ #define MAX_CONSTR_FUNC_LEVEL 200 // max level of constraint function encapsulation
+ 
  	OclMeta::Object MethodNode::Evaluate( ObjectContext& context )
  	{
+ 		LevelCounter level(&m_iteratorLevel);
+ 
  		if ( m_pIterator )
  			return m_pIterator->Evaluate( context );
***************
*** 1519,1522 ****
--- 1524,1534 ----
  		OclSignature::Method signature( m_strName, m_pThisNode->m_vecType[ 0 ], vecTypes );
  
+ 		if (m_iteratorLevel >= MAX_CONSTR_FUNC_LEVEL)
+ 		{
+ 			string message = "possibly infinite loop broken";
+ 			AddViolation(context, iLineFeatureName, signature.Print(), message);
+ 			return OclMeta::Object::UNDEFINED;
+ 		}
+ 
  		OclMeta::Object objectThis = m_pThisNode->Evaluate( context );
  		OclMeta::ObjectVector vecArguments;
***************
*** 1547,1552 ****
--- 1559,1568 ----
  
  			OclMeta::Object spResult = EvaluateCast( context, pIMethod->GetResult(), iLineFeatureName, signature.Print() );
+ 
  			pIMethod->Finalize();
  
+ 			// all of the violations collected in pIMethod (((OclGmeCM::ConstraintMethod*)pIMethod)->m_spFunction)
+ 			// will lose, one violation will be added to context depending on spResult 
+ 			// ?? !!
  			return CheckFalseResult( context, spResult, iLineFeatureName, signature.Print() );
  		} EVALCATCH( iLineFeatureName, signature.Print() );
***************
*** 2403,2406 ****
--- 2419,2423 ----
  				AddViolation( context, iLineNodeStart, "At root expression", strMyself + "evaluated to undefined object." );
  			}
+ 
  			return CheckFalseResult( context, spResult, iLineNodeStart, "At root expression" );
  		} EVALCATCH( iLineNodeStart, "At root expression" );

Index: OclConstraint.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ConstraintManager/OclConstraint.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OclConstraint.cpp	15 Nov 2002 21:58:00 -0000	1.3
--- OclConstraint.cpp	27 Apr 2004 20:28:23 -0000	1.4
***************
*** 312,315 ****
--- 312,317 ----
  	}
  
+ 	// this method called once at the end not for each constarint function ?? !!
+ 	// m_vecViolations will lose for the constarint functions 
  	OclTree::ViolationVector Constraint::GetViolations()
  	{



More information about the GME-commit mailing list