[GME-commit] GMESRC/GME/ConstraintManager GMEConstraintBrowserDialog.cpp,1.13,1.14 OCLFactory.h,1.4,1.5 OCLGMECMFacade.cpp,1.29,1.30 OCLTree.cpp,1.33,1.34 OCLTree.h,1.17,1.18 OCLType.cpp,1.9,1.10 OCLType.h,1.5,1.6 OCLTypeExBasic.cpp,1.19,1.20 OCLTypeExBasic.h,1.4,1.5 OCLTypeExGMECM.cpp,1.28,1.29 OCLTypeExGMECM.h,1.5,1.6 OCLTypeExGMEEC.cpp,1.22,1.23 OCLTypeExGMEEC.h,1.5,1.6 OclConstraint.cpp,1.10,1.11 OclConstraint.h,1.7,1.8

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Thu Sep 21 21:26:29 CDT 2006


Update of /project/gme-repository/GMESRC/GME/ConstraintManager
In directory escher:/tmp/cvs-serv31199

Modified Files:
	GMEConstraintBrowserDialog.cpp OCLFactory.h OCLGMECMFacade.cpp 
	OCLTree.cpp OCLTree.h OCLType.cpp OCLType.h OCLTypeExBasic.cpp 
	OCLTypeExBasic.h OCLTypeExGMECM.cpp OCLTypeExGMECM.h 
	OCLTypeExGMEEC.cpp OCLTypeExGMEEC.h OclConstraint.cpp 
	OclConstraint.h 
Log Message:
Namespace related modifications to Constraint Manager.
(Expression Checker modified only because some of its classes have common baseclasses with those of Constraint Manager.)

Methods changed:

 TypeManager::GetType

 TypeFactory::GetTypes

 TypeFactory::GetDynamicTypes (OclGMECM and OclGMEEC namespaces)

Namespace member added to classes:

 OclTree::TypeContext

 Ocl::Constraint



CVS User: Zoltan Molnar, ISIS (zolmol)

Index: OCLTypeExGMECM.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTypeExGMECM.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OCLTypeExGMECM.h	13 Oct 2004 15:17:54 -0000	1.5
--- OCLTypeExGMECM.h	21 Sep 2006 20:26:26 -0000	1.6
***************
*** 230,237 ****
  							TypeFactory( CComPtr<IMgaProject> spProject );
  
! 			virtual  void 	GetTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
  		private :
  					void 	GetStereotypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
! 					void 	GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
  	};
  
--- 230,237 ----
  							TypeFactory( CComPtr<IMgaProject> spProject );
  
! 			virtual  void 	GetTypes( const std::string& strName, const std::string& strNSpace, std::vector<OclMeta::Type*>& vecTypes, std::string& strNameRes );
  		private :
  					void 	GetStereotypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
! 					void 	GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes, std::string& strNameResult );
  	};
  

Index: OCLTypeExGMECM.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTypeExGMECM.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** OCLTypeExGMECM.cpp	13 Oct 2004 15:17:54 -0000	1.28
--- OCLTypeExGMECM.cpp	21 Sep 2006 20:26:26 -0000	1.29
***************
*** 15,18 ****
--- 15,20 ----
  #include "Regexp.h"
  
+ #define NILNAMESPACE ""
+ 
  namespace OclGmeCM
  {
***************
*** 42,46 ****
  						if ( GetTypeManager()->IsTypeA( strKind, strMetaKind ) <= 0 )
  							ThrowException( "Kind does not conform to " + strMetaKind + "." );
! 					return GetTypeManager()->GetType( strKind )->GetName().substr( 6 );
  				}
  				return strKind;
--- 44,48 ----
  						if ( GetTypeManager()->IsTypeA( strKind, strMetaKind ) <= 0 )
  							ThrowException( "Kind does not conform to " + strMetaKind + "." );
! 					return GetTypeManager()->GetType( strKind, NILNAMESPACE )->GetName().substr( 6 );
  				}
  				return strKind;
***************
*** 2195,2203 ****
  	}
  
! 	void TypeFactory::GetTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes )
  	{
  		bool bHasNamespace = strName.find( "::" ) != std::string::npos;
  
! 		GetDynamicTypes( strName, vecTypes );
  		if ( ! bHasNamespace && ! vecTypes.empty() )
  			return;
--- 2197,2223 ----
  	}
  
! 	void TypeFactory::GetTypes( const std::string& strName, const std::string& strNSpace, std::vector<OclMeta::Type*>& vecTypes, std::string& strNameResult )
  	{
+ 		strNameResult = strName; // will be overwritten by the GetDynamicTypes if it finds something
  		bool bHasNamespace = strName.find( "::" ) != std::string::npos;
+ 		std::string str2Name = strName;
+ 		if( vecTypes.empty()
+ 			&& !strNSpace.empty()                                                          // if strNSpace specified
+ 			&& (!bHasNamespace || strName.substr( 0, strName.find( "::")) == "meta")       // either 'meta::' prefix found or no namespace found
+ 			&& strName.find( std::string( "::" + strNSpace + "::"))  == std::string::npos  // "::strNSpace::" is not yet substr of strName
+ 			&& strName != "meta::RootFolder" )                                             // special kind needs not modification: meta::RootFolder
+ 		{
+ 			
+ 			if( strName.find( "meta::") != std::string::npos)                              // 'meta::' found
+ 			{
+ 				str2Name.insert( strName.find( "::" ), std::string( "::" + strNSpace));    // str2Name = meta::strNSpace::strName
+ 			}
+ 			else
+ 			{
+ 				str2Name = strNSpace + "::" + strName;                                     // str2Name = strNSpace::strName
+ 			}
+ 		}
  
! 		GetDynamicTypes( str2Name, vecTypes, strNameResult );
  		if ( ! bHasNamespace && ! vecTypes.empty() )
  			return;
***************
*** 2366,2380 ****
  	}
  
! 	void TypeFactory::GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes )
  	{
! 		int iPos = strName.find( "::" );
! 		std::string strNS = ( iPos == std::string::npos ) ? "" : strName.substr( 0, iPos );
! 		std::string strN = ( iPos == std::string::npos ) ? strName : strName.substr( iPos + 2 );
! 		bool bLookUpInMeta = strNS == "meta" || strNS.empty();
! 		if ( bLookUpInMeta ) {
  			OclCommonEx::MetaBaseVector vecMetas;
  			CComPtr<IMgaMetaProject> spMetaProject;
  			COMTHROW( m_spProject->get_RootMeta( &spMetaProject ) );
  			OclCommonEx::GetMetaObjects( spMetaProject, strN, OBJTYPE_NULL, vecMetas );
  			for ( unsigned int i = 0 ; i < vecMetas.size() ; i++ ) {
  				objtype_enum eType = OclCommonEx::GetObjectType( vecMetas[ i ].p );
--- 2386,2416 ----
  	}
  
! 	void TypeFactory::GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes, std::string& strNameResult )
  	{
! 		int jPos = strName.find( "gme::" );
! 		int kPos = strName.find( "ocl::" );
! 		if( jPos == std::string::npos             // neither 'gme::' 
! 		 && kPos == std::string::npos)            // nor     'ocl::' is found
! 		{
! 			// lookup in meta:
! 			int iPos = strName.find( "meta::");
! 			std::string strN = strName;
! 			std::string strNS;
! 			if( iPos != std::string::npos)        // if 'meta::' found
! 			{
! 				strNS = "meta";
! 				strN = strName.substr( iPos + 6); // let's remove 'meta::' from the name
! 			}
! 
! 			// search for that kind in the Metaproject
  			OclCommonEx::MetaBaseVector vecMetas;
  			CComPtr<IMgaMetaProject> spMetaProject;
  			COMTHROW( m_spProject->get_RootMeta( &spMetaProject ) );
  			OclCommonEx::GetMetaObjects( spMetaProject, strN, OBJTYPE_NULL, vecMetas );
+ 			
+ 			// if found, use longer form
+ 			if( vecMetas.size() > 0)
+ 				strNameResult = "meta::" + strN;
+ 
  			for ( unsigned int i = 0 ; i < vecMetas.size() ; i++ ) {
  				objtype_enum eType = OclCommonEx::GetObjectType( vecMetas[ i ].p );

Index: OCLTree.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTree.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** OCLTree.cpp	13 Jul 2005 20:10:55 -0000	1.33
--- OCLTree.cpp	21 Sep 2006 20:26:26 -0000	1.34
***************
*** 15,18 ****
--- 15,19 ----
  #include "OCLException.h"
  
+ #define NILNAMESPACE ""
  namespace OclTree
  {
***************
*** 99,103 ****
  			OclMeta::Type* pType = NULL;
  			try {
! 				pType = m_pManager->GetTypeManager()->GetType( vecType[ i ] );
  				if ( i != vecType.size() - 1 ) {
  					if ( ! pType->IsCompound() ) {
--- 100,104 ----
  			OclMeta::Type* pType = NULL;
  			try {
! 				pType = m_pManager->GetTypeManager()->GetType( vecType[ i ], context.m_namespace);
  				if ( i != vecType.size() - 1 ) {
  					if ( ! pType->IsCompound() ) {
***************
*** 162,166 ****
  			}
  
! 			if ( GetTreeManager()->GetTypeManager()->GetType( vecType1[ 0 ] )->IsCompound() ) {
  
  				if ( strLastType == TYPE_ARGUMENT_SELF_BASE || strLastType == TYPE_COMPOUNDARGUMENT_SELF_BASE ) {
--- 163,167 ----
  			}
  
! 			if ( GetTreeManager()->GetTypeManager()->GetType( vecType1[ 0 ], NILNAMESPACE )->IsCompound() ) {
  
  				if ( strLastType == TYPE_ARGUMENT_SELF_BASE || strLastType == TYPE_COMPOUNDARGUMENT_SELF_BASE ) {
***************
*** 170,174 ****
  					TypeSeq vecTypeA = vecType2;
  
! 					if ( strLastType == TYPE_COMPOUNDARGUMENT_SELF_BASE && GetTreeManager()->GetTypeManager()->GetType( vecType2[ 0 ] )->IsCompound() )
  						vecTypeA.erase( vecTypeA.begin() );
  
--- 171,175 ----
  					TypeSeq vecTypeA = vecType2;
  
! 					if ( strLastType == TYPE_COMPOUNDARGUMENT_SELF_BASE && GetTreeManager()->GetTypeManager()->GetType( vecType2[ 0 ], NILNAMESPACE )->IsCompound() )
  						vecTypeA.erase( vecTypeA.begin() );
  
***************
*** 1164,1168 ****
  		for ( int i = context.m_vecImplicits.size() - 1 ; i >= 0 ; i-- ) {
  
! 			TypeContext contextIterator;
  			CheckInitialize();
  			m_pThisNode = CreateThis( context, i );
--- 1165,1169 ----
  		for ( int i = context.m_vecImplicits.size() - 1 ; i >= 0 ; i-- ) {
  
! 			TypeContext contextIterator( context.m_namespace);
  			CheckInitialize();
  			m_pThisNode = CreateThis( context, i );
***************
*** 1186,1190 ****
  	{
  
! 		OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ] );
  
  		// Not compound Type cannot have iterators
--- 1187,1191 ----
  	{
  
! 		OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ], context.m_namespace );
  
  		// Not compound Type cannot have iterators
***************
*** 1319,1323 ****
  			OclImplementation::Iterator* pIIterator = NULL;
  			if ( ! m_pAccuNode ) {
! 				OclMeta::CompoundType* pCType = (OclMeta::CompoundType*) GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName() );
  				OclMeta::Iterator* pIterator = pCType->GetIterator(m_iteratorLevel, signature );
  				pIIterator = pIterator->GetImplementation();
--- 1320,1324 ----
  			OclImplementation::Iterator* pIIterator = NULL;
  			if ( ! m_pAccuNode ) {
! 				OclMeta::CompoundType* pCType = (OclMeta::CompoundType*) GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName(), NILNAMESPACE );
  				OclMeta::Iterator* pIterator = pCType->GetIterator(m_iteratorLevel, signature );
  				pIIterator = pIterator->GetImplementation();
***************
*** 1470,1474 ****
  		if ( bThisValid ) {
  
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ] );
  
  			// Check if Object Node is callable
--- 1471,1475 ----
  		if ( bThisValid ) {
  
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ], context.m_namespace );
  
  			// Check if Object Node is callable
***************
*** 1698,1702 ****
  
  		EVALTRY {
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName() );
  			OclMeta::Method* pMethod = pType->GetMethod( signature );
  			OclImplementation::Method* pIMethod = pMethod->GetImplementation();
--- 1699,1703 ----
  
  		EVALTRY {
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName(), NILNAMESPACE );
  			OclMeta::Method* pMethod = pType->GetMethod( signature );
  			OclImplementation::Method* pIMethod = pMethod->GetImplementation();
***************
*** 1973,1977 ****
  		for ( int i = context.m_vecImplicits.size() - 1 ; i >= 0 ; i-- ) {
  
! 			TypeContext contextAssociation;
  			CheckInitialize();
  			m_pThisNode = CreateThis( context, i );
--- 1974,1978 ----
  		for ( int i = context.m_vecImplicits.size() - 1 ; i >= 0 ; i-- ) {
  
! 			TypeContext contextAssociation( context.m_namespace);
  			CheckInitialize();
  			m_pThisNode = CreateThis( context, i );
***************
*** 1994,1998 ****
  	bool AssociationNode::CheckAssociation( TypeContext& context )
  	{
! 		OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ] );
  
  		// Check static object can be called
--- 1995,1999 ----
  	bool AssociationNode::CheckAssociation( TypeContext& context )
  	{
! 		OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ], context.m_namespace );
  
  		// Check static object can be called
***************
*** 2035,2039 ****
  
  		EVALTRY {
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName() );
  			OclMeta::Association* pAssociation = pType->GetAssociation( signature );
  			OclImplementation::Association* pIAssociation = pAssociation->GetImplementation();
--- 2036,2040 ----
  
  		EVALTRY {
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName(), NILNAMESPACE );
  			OclMeta::Association* pAssociation = pType->GetAssociation( signature );
  			OclImplementation::Association* pIAssociation = pAssociation->GetImplementation();
***************
*** 2122,2126 ****
  		if ( bThisValid ) {
  
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ] );
  
  			// Type is not compound
--- 2123,2127 ----
  		if ( bThisValid ) {
  
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 0 ], context.m_namespace );
  
  			// Type is not compound
***************
*** 2190,2194 ****
  				// Create Feature Call Check
  
! 				OclMeta::Type* pTypeInner = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 1 ] );
  
  				std::vector<OclMeta::Type*> vecTypes( 2, pType ); vecTypes[ 1 ] = pTypeInner;
--- 2191,2195 ----
  				// Create Feature Call Check
  
! 				OclMeta::Type* pTypeInner = GetTreeManager()->GetTypeManager()->GetType( m_pThisNode->m_vecType[ 1 ], context.m_namespace );
  
  				std::vector<OclMeta::Type*> vecTypes( 2, pType ); vecTypes[ 1 ] = pTypeInner;
***************
*** 2272,2276 ****
  
  		EVALTRY {
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName() );
  			OclMeta::Attribute* pAttribute = pType->GetAttribute( signature );
  			OclImplementation::Attribute* pIAttribute = pAttribute->GetImplementation();
--- 2273,2277 ----
  
  		EVALTRY {
! 			OclMeta::Type* pType = GetTreeManager()->GetTypeManager()->GetType( objectThis.GetStaticTypeName(), NILNAMESPACE );
  			OclMeta::Attribute* pAttribute = pType->GetAttribute( signature );
  			OclImplementation::Attribute* pIAttribute = pAttribute->GetImplementation();
***************
*** 2338,2342 ****
  		// Check if Type exists
  
! 		TypeContext contextType;
  		m_pType = GetTreeManager()->CreateObject();
  		m_pType->m_bTester = true;
--- 2339,2343 ----
  		// Check if Type exists
  
! 		TypeContext contextType( context.m_namespace);
  		m_pType = GetTreeManager()->CreateObject();
  		m_pType->m_bTester = true;
***************
*** 2703,2707 ****
  
  		if ( bValid ) {
! 			OclMeta::Type* pType = pNode->GetTreeManager()->GetTypeManager()->GetType( pNode->m_vecType[ 0 ] );
  			if ( ! pType->IsCompound() ) {
  				ADDEX( EXCEPTION1( EX_TYPE_ISNT_COMPOUND, pNode->m_vecType[ 0 ], pNode->m_mapPositions[ LID_NODE_START ] ) );
--- 2704,2708 ----
  
  		if ( bValid ) {
! 			OclMeta::Type* pType = pNode->GetTreeManager()->GetTypeManager()->GetType( pNode->m_vecType[ 0 ], context.m_namespace );
  			if ( ! pType->IsCompound() ) {
  				ADDEX( EXCEPTION1( EX_TYPE_ISNT_COMPOUND, pNode->m_vecType[ 0 ], pNode->m_mapPositions[ LID_NODE_START ] ) );

Index: OCLType.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLType.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OCLType.h	13 Jul 2005 20:10:55 -0000	1.5
--- OCLType.h	21 Sep 2006 20:26:26 -0000	1.6
***************
*** 82,86 ****
  			void 		ClearGlobals();
  
! 			Type* 		GetType( const std::string& strName );
  
  			int 			GetTypeDistance( const std::string& strName );
--- 82,86 ----
  			void 		ClearGlobals();
  
! 			Type* 		GetType( const std::string& strName, const std::string& strNSpace );
  
  			int 			GetTypeDistance( const std::string& strName );

Index: OCLTypeExGMEEC.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTypeExGMEEC.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** OCLTypeExGMEEC.h	13 Oct 2004 15:17:54 -0000	1.5
--- OCLTypeExGMEEC.h	21 Sep 2006 20:26:26 -0000	1.6
***************
*** 230,237 ****
  		 					TypeFactory( CComPtr<IMgaProject> spProject );
  
! 			virtual  void 	GetTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
  		private :
  					void 	GetStereotypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
! 					void 	GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
  	};
  
--- 230,237 ----
  		 					TypeFactory( CComPtr<IMgaProject> spProject );
  
! 							virtual  void 	GetTypes( const std::string& strName, const std::string& strNSpace, std::vector<OclMeta::Type*>& vecTypes, std::string& nameRes );
  		private :
  					void 	GetStereotypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
! 					void 	GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes, std::string& strNameResult );
  	};
  

Index: GMEConstraintBrowserDialog.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/GMEConstraintBrowserDialog.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** GMEConstraintBrowserDialog.cpp	13 Oct 2004 15:17:54 -0000	1.13
--- GMEConstraintBrowserDialog.cpp	21 Sep 2006 20:26:26 -0000	1.14
***************
*** 20,23 ****
--- 20,24 ----
  #endif
  
+ #define NILNAMESPACE ""
  namespace OclGmeCM {
  
***************
*** 569,573 ****
  				strType = strType.substr( 0, iPos - 1 );
  				try {
! 					m_pFacade->GetTreeManager()->GetTypeManager()->GetType( strType );
  				}
  				catch ( ... ) {
--- 570,574 ----
  				strType = strType.substr( 0, iPos - 1 );
  				try {
! 					m_pFacade->GetTreeManager()->GetTypeManager()->GetType( strType, NILNAMESPACE );
  				}
  				catch ( ... ) {

Index: OCLGMECMFacade.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLGMECMFacade.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** OCLGMECMFacade.cpp	21 Jul 2006 19:24:37 -0000	1.29
--- OCLGMECMFacade.cpp	21 Sep 2006 20:26:26 -0000	1.30
***************
*** 306,318 ****
  			CString strNmspc;
  			COMTHROW( MGACOLL_ITER->GetDefinedForNamespace( PutOut( strNmspc)));
- 			if( strNmspc.IsEmpty()) { // disregard outsider constraints ///z
  			constraint_type_enum eType;
  			COMTHROW( MGACOLL_ITER->get_Type( &eType ) );
  			if ( eType == CONSTRAINT_TYPE_FUNCTION ) {
  				OclGme::SpConstraintFunction spConstraintFunction( new OclGme::ConstraintFunction( MGACOLL_ITER ) );
  				spConstraintFunction->Register( m_pTreeManager );
  				vecFounds.push_back( spConstraintFunction );
  			}
- 			}
  		} MGACOLL_ITERATE_END;
  
--- 306,317 ----
  			CString strNmspc;
  			COMTHROW( MGACOLL_ITER->GetDefinedForNamespace( PutOut( strNmspc)));
  			constraint_type_enum eType;
  			COMTHROW( MGACOLL_ITER->get_Type( &eType ) );
  			if ( eType == CONSTRAINT_TYPE_FUNCTION ) {
  				OclGme::SpConstraintFunction spConstraintFunction( new OclGme::ConstraintFunction( MGACOLL_ITER ) );
+ 				spConstraintFunction->SetNamespace( (LPCTSTR) strNmspc);
  				spConstraintFunction->Register( m_pTreeManager );
  				vecFounds.push_back( spConstraintFunction );
  			}
  		} MGACOLL_ITERATE_END;
  
***************
*** 456,467 ****
  				CString strNmspc;
  				COMTHROW( MGACOLL_ITER->GetDefinedForNamespace( PutOut( strNmspc)));
- 				if( strNmspc.IsEmpty()) { // disregard outsider constraints ///z
  				constraint_type_enum eType;
  				COMTHROW( MGACOLL_ITER->get_Type( &eType ) );
  				if ( eType != CONSTRAINT_TYPE_FUNCTION ) {
  					OclGme::SpConstraint spConstraint( new OclGme::Constraint( strName, MGACOLL_ITER ) );
  					spConstraint->Register( m_pTreeManager );
  					vecFounds.push_back( spConstraint );
! 				}}
  			} MGACOLL_ITERATE_END;
  		}
--- 455,466 ----
  				CString strNmspc;
  				COMTHROW( MGACOLL_ITER->GetDefinedForNamespace( PutOut( strNmspc)));
  				constraint_type_enum eType;
  				COMTHROW( MGACOLL_ITER->get_Type( &eType ) );
  				if ( eType != CONSTRAINT_TYPE_FUNCTION ) {
  					OclGme::SpConstraint spConstraint( new OclGme::Constraint( strName, MGACOLL_ITER ) );
+ 					spConstraint->SetNamespace( (LPCTSTR) strNmspc);
  					spConstraint->Register( m_pTreeManager );
  					vecFounds.push_back( spConstraint );
! 				}
  			} MGACOLL_ITERATE_END;
  		}

Index: OCLTree.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTree.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** OCLTree.h	13 Jul 2005 20:10:55 -0000	1.17
--- OCLTree.h	21 Sep 2006 20:26:26 -0000	1.18
***************
*** 58,65 ****
  			std::string						m_strStereotype;
  			OclMeta::DependencySet		m_setDependencies;
  
  		public :
! 			TypeContext()
  				: m_strStereotype( "inv" )
  			{
  			}
--- 58,67 ----
  			std::string						m_strStereotype;
  			OclMeta::DependencySet		m_setDependencies;
+ 			std::string					m_namespace;
  
  		public :
! 			TypeContext( const std::string& pNamesp )
  				: m_strStereotype( "inv" )
+ 				, m_namespace( pNamesp)
  			{
  			}
***************
*** 67,70 ****
--- 69,73 ----
  			TypeContext( const TypeContext& context )
  				: m_ctxTypes( context.m_ctxTypes ), m_poolExceptions( context.m_poolExceptions ), m_vecImplicits( context.m_vecImplicits ), m_strStereotype( context.m_strStereotype ), m_setDependencies( context.m_setDependencies )
+ 				, m_namespace( context.m_namespace)
  			{
  			}
***************
*** 77,81 ****
  					m_vecImplicits = context.m_vecImplicits;
  					m_strStereotype = context.m_strStereotype;
! 					m_setDependencies = m_setDependencies;
  				}
  				return *this;
--- 80,85 ----
  					m_vecImplicits = context.m_vecImplicits;
  					m_strStereotype = context.m_strStereotype;
! 					m_setDependencies = context.m_setDependencies; //FIXED, was m_setDependencies = m_setDependencies;
! 					m_namespace = context.m_namespace;
  				}
  				return *this;

Index: OCLTypeExBasic.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTypeExBasic.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** OCLTypeExBasic.cpp	26 Jan 2005 17:28:24 -0000	1.19
--- OCLTypeExBasic.cpp	21 Sep 2006 20:26:26 -0000	1.20
***************
*** 3219,3224 ****
  	}
  
! 	void TypeFactory::GetTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes )
  	{
  		if ( strName == "ocl::Any" || strName == "Any" ) {
  			StringVector vecSupers;
--- 3219,3225 ----
  	}
  
! 	void TypeFactory::GetTypes( const std::string& strName, const std::string& , std::vector<OclMeta::Type*>& vecTypes, std::string& strNameResult )
  	{
+ 		strNameResult = strName;
  		if ( strName == "ocl::Any" || strName == "Any" ) {
  			StringVector vecSupers;

Index: OCLType.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLType.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** OCLType.cpp	13 Jul 2005 20:10:55 -0000	1.9
--- OCLType.cpp	21 Sep 2006 20:26:26 -0000	1.10
***************
*** 8,11 ****
--- 8,13 ----
  #include "OCLType.h"
  
+ #define NILNAMESPACE ""
+ 
  namespace OclMeta
  {
***************
*** 143,147 ****
  		for ( unsigned int i = 0 ; i < vecSuperTypes.size() ; i++ ) {
  			try {
! 				Type* pType = pManager->GetType( vecSuperTypes[ i ] );
  				callResult = pType->GetResults( signature );
  				if ( callResult.bIsValid )
--- 145,149 ----
  		for ( unsigned int i = 0 ; i < vecSuperTypes.size() ; i++ ) {
  			try {
! 				Type* pType = pManager->GetType( vecSuperTypes[ i ], NILNAMESPACE );
  				callResult = pType->GetResults( signature );
  				if ( callResult.bIsValid )
***************
*** 229,234 ****
  	}
  
! 	Type* TypeManager::GetType( const std::string& strName )
  	{
  		TypeResultMap::iterator i = m_mapTypes.find( strName );
  		if ( i != m_mapTypes.end() ) {
--- 231,237 ----
  	}
  
! 	Type* TypeManager::GetType( const std::string& strName, const std::string& strNSpace  )
  	{
+ 		std::string nameResult;
  		TypeResultMap::iterator i = m_mapTypes.find( strName );
  		if ( i != m_mapTypes.end() ) {
***************
*** 241,245 ****
  		TypeResult typeResult;
  		try {
! 			m_pTypeFactory->GetTypes( strName, vecTypes );
  			if ( vecTypes.empty() ) {
  				typeResult.bIsValid = false;
--- 244,248 ----
  		TypeResult typeResult;
  		try {
! 			m_pTypeFactory->GetTypes( strName, strNSpace, vecTypes, nameResult );
  			if ( vecTypes.empty() ) {
  				typeResult.bIsValid = false;
***************
*** 263,267 ****
  			typeResult.uResult.pException = new OclCommon::Exception( ex );
  		}
! 		m_mapTypes.insert( TypeResultMap::value_type( strName, typeResult ) );
  		RegisterType( typeResult );
  		if ( typeResult.bIsValid )
--- 266,270 ----
  			typeResult.uResult.pException = new OclCommon::Exception( ex );
  		}
! 		m_mapTypes.insert( TypeResultMap::value_type( nameResult, typeResult ) ); // WAS: m_mapTypes.insert( TypeResultMap::value_type( strName, typeResult ) );
  		RegisterType( typeResult );
  		if ( typeResult.bIsValid )
***************
*** 273,277 ****
  	int TypeManager::IsTypeAR( const std::string& strName1, const std::string& strName2, int iLevel )
  	{
! 		Type* pType1 = GetType( strName1 );
  		if ( pType1->GetName() == strName2 )
  			return iLevel;
--- 276,280 ----
  	int TypeManager::IsTypeAR( const std::string& strName1, const std::string& strName2, int iLevel )
  	{
! 		Type* pType1 = GetType( strName1, NILNAMESPACE );
  		if ( pType1->GetName() == strName2 )
  			return iLevel;
***************
*** 288,292 ****
  	int TypeManager::IsTypeA( const std::string& strName1, const std::string& strName2 )
  	{
! 		Type* pType2 = GetType( strName2 );
  		return IsTypeAR( strName1, pType2->GetName(), 0 );
  	}
--- 291,295 ----
  	int TypeManager::IsTypeA( const std::string& strName1, const std::string& strName2 )
  	{
! 		Type* pType2 = GetType( strName2, NILNAMESPACE );
  		return IsTypeAR( strName1, pType2->GetName(), 0 );
  	}
***************
*** 294,298 ****
  	int TypeManager::GetTypeDistance( const std::string& strName )
  	{
! 		Type* pType = GetType( ( strName.empty() ) ? "ocl::Any" : strName );
  		const StringVector& vecSuperTypes = pType->GetSuperTypeNames();
  		if ( vecSuperTypes.empty() )
--- 297,301 ----
  	int TypeManager::GetTypeDistance( const std::string& strName )
  	{
! 		Type* pType = GetType( ( strName.empty() ) ? "ocl::Any" : strName, NILNAMESPACE );
  		const StringVector& vecSuperTypes = pType->GetSuperTypeNames();
  		if ( vecSuperTypes.empty() )
***************
*** 312,316 ****
  				return strName1;
  		StringVector vecTypes;
! 		const StringVector& vecSuperTypes = GetType( strName1 )->GetSuperTypeNames();
  		unsigned int i;
  		for ( i = 0 ; i < vecSuperTypes.size() ; i++ )
--- 315,319 ----
  				return strName1;
  		StringVector vecTypes;
! 		const StringVector& vecSuperTypes = GetType( strName1, NILNAMESPACE )->GetSuperTypeNames();
  		unsigned int i;
  		for ( i = 0 ; i < vecSuperTypes.size() ; i++ )

Index: OCLTypeExGMEEC.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTypeExGMEEC.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** OCLTypeExGMEEC.cpp	13 Oct 2004 15:17:54 -0000	1.22
--- OCLTypeExGMEEC.cpp	21 Sep 2006 20:26:26 -0000	1.23
***************
*** 937,945 ****
  	}
  
! 	void TypeFactory::GetTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes )
  	{
  		bool bHasNamespace = strName.find( "::" ) != std::string::npos;
  
! 		GetDynamicTypes( strName, vecTypes );
  		if ( ! bHasNamespace && ! vecTypes.empty() )
  			return;
--- 937,946 ----
  	}
  
! 	void TypeFactory::GetTypes( const std::string& strName, const std::string& strNSpace, std::vector<OclMeta::Type*>& vecTypes, std::string& strNameResult )
  	{
+ 		strNameResult = strName;
  		bool bHasNamespace = strName.find( "::" ) != std::string::npos;
  
! 		GetDynamicTypes( strName, vecTypes, strNameResult);
  		if ( ! bHasNamespace && ! vecTypes.empty() )
  			return;
***************
*** 1115,1119 ****
  	}
  
! 	void TypeFactory::GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes )
  	{
  		std::string strRealName = strName;
--- 1116,1120 ----
  	}
  
! 	void TypeFactory::GetDynamicTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes, std::string& )
  	{
  		std::string strRealName = strName;

Index: OclConstraint.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OclConstraint.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** OclConstraint.h	16 May 2005 20:35:18 -0000	1.7
--- OclConstraint.h	21 Sep 2006 20:26:26 -0000	1.8
***************
*** 70,73 ****
--- 70,74 ----
  			OclCommon::ExceptionPool 				m_poolExceptions;
  			OclTree::ViolationVector					m_vecViolations;
+ 			std::string								m_nmsp;
  
  		public :
***************
*** 98,102 ****
  					OclCommon::FormalParameterVector 	GetFormalParameters() const;
  					virtual std::string							GetFullName() const;
! 
  					State Parse();
  
--- 99,104 ----
  					OclCommon::FormalParameterVector 	GetFormalParameters() const;
  					virtual std::string							GetFullName() const;
! 					std::string									GetNamespace() const;
! 					void										SetNamespace( const std::string& nm);
  					State Parse();
  

Index: OCLTypeExBasic.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLTypeExBasic.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OCLTypeExBasic.h	13 Oct 2004 15:17:54 -0000	1.4
--- OCLTypeExBasic.h	21 Sep 2006 20:26:26 -0000	1.5
***************
*** 206,210 ****
  	{
  		public :
! 			virtual void GetTypes( const std::string& strName, std::vector<OclMeta::Type*>& vecTypes );
  	};
  
--- 206,210 ----
  	{
  		public :
! 			virtual void GetTypes( const std::string& strName, const std::string& strNSpace, std::vector<OclMeta::Type*>& vecTypes, std::string& nameRes );
  	};
  

Index: OCLFactory.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OCLFactory.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** OCLFactory.h	13 Jul 2005 20:10:55 -0000	1.4
--- OCLFactory.h	21 Sep 2006 20:26:26 -0000	1.5
***************
*** 83,87 ****
  			virtual			~TypeFactory() {};
  
! 			virtual void	GetTypes( const std::string& strName, std::vector< OclMeta::Type* >& vecTypes ) = 0;
  
  			OclMeta::TypeManager* GetTypeManager() const
--- 83,87 ----
  			virtual			~TypeFactory() {};
  
! 			virtual void	GetTypes( const std::string& strName, const std::string& strNSpace, std::vector< OclMeta::Type* >& vecTypes, std::string& nameRes ) = 0;
  
  			OclMeta::TypeManager* GetTypeManager() const

Index: OclConstraint.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/ConstraintManager/OclConstraint.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** OclConstraint.cpp	13 Jul 2005 20:10:55 -0000	1.10
--- OclConstraint.cpp	21 Sep 2006 20:26:26 -0000	1.11
***************
*** 163,167 ****
  		if ( ! m_pCtxConstraint )
  			throw CS_CTX_CHECK_FAILED;
! 		OclTree::TypeContext context;
  		m_bContextSucceeded = m_pCtxConstraint->Check( context );
  		m_poolCtxExceptions = context.m_poolExceptions;
--- 163,167 ----
  		if ( ! m_pCtxConstraint )
  			throw CS_CTX_CHECK_FAILED;
! 		OclTree::TypeContext context( m_nmsp);
  		m_bContextSucceeded = m_pCtxConstraint->Check( context );
  		m_poolCtxExceptions = context.m_poolExceptions;
***************
*** 186,189 ****
--- 186,200 ----
  	}
  
+ 	std::string Constraint::GetNamespace() const
+ 	{
+ 		return m_nmsp;
+ 	}
+ 
+ 	void Constraint::SetNamespace( const std::string& nm)
+ 	{
+ 		m_nmsp = nm;
+ 	}
+ 
+ 
  	std::string Constraint::GetReturnType() const
  	{
***************
*** 236,240 ****
  		if ( m_eState >= CS_CHECK_SUCCEEDED )
  			return CS_CHECK_SUCCEEDED;
! 		OclTree::TypeContext context;
  		context.m_ctxTypes = ctxTypes;
  		bool bResult = m_pConstraint->Check( context );
--- 247,251 ----
  		if ( m_eState >= CS_CHECK_SUCCEEDED )
  			return CS_CHECK_SUCCEEDED;
! 		OclTree::TypeContext context( m_nmsp);
  		context.m_ctxTypes = ctxTypes;
  		bool bResult = m_pConstraint->Check( context );



More information about the GME-commit mailing list