[GME-commit] GMESRC/SDK/BON BONImpl.cpp,1.33,1.34 BONImpl.h,1.19,1.20 Extensions.cpp,1.11,1.12 MON.cpp,1.8,1.9 MON.h,1.7,1.8

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Fri Jul 21 20:40:03 CDT 2006


Update of /project/gme-repository/GMESRC/SDK/BON
In directory escher:/tmp/cvs-serv9926

Modified Files:
	BONImpl.cpp BONImpl.h Extensions.cpp MON.cpp MON.h 
Log Message:
Namespace related changes.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: MON.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/MON.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MON.cpp	29 Jun 2005 19:16:34 -0000	1.8
--- MON.cpp	21 Jul 2006 19:40:01 -0000	1.9
***************
*** 212,216 ****
  	MetaObject Project::findByName( const std::string strName ) const
  	{
! 		return ( (ProjectImpl*) getCounted() )->findByName( strName );
  	}
  
--- 212,224 ----
  	MetaObject Project::findByName( const std::string strName ) const
  	{
! 		MetaObject mo = ( (ProjectImpl*) getCounted() )->findByName( strName );
! 		if( mo) return mo;
! 		else
! 			return ( (ProjectImpl*) getCounted() )->findByName( prefixWNmsp( strName ));
! 	}
! 
! 	std::string Project::prefixWNmsp( const std::string& strName) const
! 	{
! 		return ( m_nmsp.length()>0? m_nmsp + "::" : "") + strName;
  	}
  

Index: MON.h
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/MON.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MON.h	29 Apr 2004 18:22:35 -0000	1.7
--- MON.h	21 Jul 2006 19:40:01 -0000	1.8
***************
*** 107,110 ****
--- 107,117 ----
  			MetaObject	findByRef( long lRef ) const;
  			MetaObject 	findByName( const std::string strName ) const;
+ 
+ 		// Namespace related
+ 		public:
+ 			std::string m_nmsp;
+ 			std::string prefixWNmsp( const std::string& strName) const;
+ 
+ 
  	};
  

Index: BONImpl.h
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/BONImpl.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** BONImpl.h	6 Jan 2006 19:23:09 -0000	1.19
--- BONImpl.h	21 Jul 2006 19:40:01 -0000	1.20
***************
*** 130,133 ****
--- 130,137 ----
  			ObjectMapByKind		m_mapObjectsByKind;
  			FolderImpl*			m_pRootFolder;
+ 		// Namespace related member variables
+ 		private :
+ 			std::string			m_nmsp;
+ 
  
  		// Construction and Destruction
***************
*** 186,189 ****
--- 190,207 ----
  
  			void					showFCO(FCO fco);
+ 		
+ 		// Namespace related
+ 		public: 
+ 			static std::string		prefixWNmspStatic( const std::string& pKindOrRole);
+ 			static std::string		getNmspStatic();
+ 			static void				setNmspStatic( const std::string& pNmsp);
+ 
+ 			std::string				prefixWNmsp( const std::string& pKindOrRole) const;
+ 			std::string				getNmsp();
+ 			void					setNmsp( const std::string& pNmsp);
+ 
+ 		private:
+ 			bool					setNmspInTerritory();
+ 			std::string				getNmspFrTerritory() const;
  
  

Index: BONImpl.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/BONImpl.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** BONImpl.cpp	23 Jun 2006 19:40:38 -0000	1.33
--- BONImpl.cpp	21 Jul 2006 19:40:01 -0000	1.34
***************
*** 29,32 ****
--- 29,37 ----
  namespace BON
  {
+ 	//*****************************************************
+ 	// this variable is used by macros and static createAs
+ 	// methods, to find the proper kind
+ 	extern std::string         strNamespacePref;
+ 	//*****************************************************
  
  //###############################################################################################################################################
***************
*** 768,771 ****
--- 773,831 ----
  	}
  
+ 	std::string ProjectImpl::prefixWNmsp( const std::string& pKindOrRole) const
+ 	{
+ 		return ( m_nmsp.length()>0? m_nmsp + "::" : "") + pKindOrRole;
+ 	}
+ 
+ 	/*static*/ std::string ProjectImpl::prefixWNmspStatic( const std::string& pKindOrRole)
+ 	{
+ 		return (strNamespacePref.empty()? "" : strNamespacePref + "::") + pKindOrRole;
+ 	}
+ 
+ 	/*static*/ std::string ProjectImpl::getNmspStatic()
+ 	{
+ 		return strNamespacePref;
+ 	}
+ 
+ 	/*static*/ void ProjectImpl::setNmspStatic( const std::string& pNmsp)
+ 	{
+ 		strNamespacePref = pNmsp;
+ 	}
+ 	
+ 	std::string ProjectImpl::getNmsp()
+ 	{
+ 		m_meta.m_nmsp = m_nmsp = getNmspFrTerritory();
+ 		return m_nmsp;
+ 	}
+ 
+ 	void ProjectImpl::setNmsp( const std::string& pNmsp)
+ 	{
+ 		m_meta.m_nmsp = m_nmsp = pNmsp;	// set into MON::Project as well
+ 		setNmspInTerritory();
+ 	}
+ 
+ 	bool ProjectImpl::setNmspInTerritory()
+ 	{
+ 		if( m_spTerritory)
+ 		{
+ 			m_spTerritory->SetNamespace( CComBSTR( m_nmsp.c_str()));
+ 			return true;
+ 		}
+ 		ASSERT(0);
+ 		return false;
+ 	}
+ 
+ 	std::string ProjectImpl::getNmspFrTerritory() const
+ 	{
+ 		if( m_spTerritory)
+ 		{
+ 			CComBSTR nms;
+ 			m_spTerritory->GetNamespace( &nms);
+ 			return Util::Copy( nms);
+ 		}
+ 		ASSERT(0);
+ 		return "";
+ 	}
+ 
  //===============================================================================================================================================
  // 	C L A S S : BON::ProjectImpl					// Relations - Find and Search
***************
*** 3889,3893 ****
  		std::set<MON::Containment> roles = getFCOMeta().parentContainments();
  		for ( std::set<MON::Containment>::iterator it = roles.begin() ; it != roles.end() ; it++ )
! 			if ( it->name() == strRole ) {
  				role = *it;
  				break;
--- 3949,3953 ----
  		std::set<MON::Containment> roles = getFCOMeta().parentContainments();
  		for ( std::set<MON::Containment>::iterator it = roles.begin() ; it != roles.end() ; it++ )
! 			if ( it->name() == strRole || it->name() == ObjectImpl::m_pProject->prefixWNmsp( strRole)) {
  				role = *it;
  				break;
***************
*** 4833,4837 ****
  		else {
  			for ( std::set<MON::Containment>::iterator it = metas.begin() ; it != metas.end() ; it++ ) {
! 				if ( it->name() == strRole && it->child().type() == eType ) {
  					role = *it;
  					break;
--- 4893,4897 ----
  		else {
  			for ( std::set<MON::Containment>::iterator it = metas.begin() ; it != metas.end() ; it++ ) {
! 				if ( ( it->name() == strRole || it->name() == ObjectImpl::m_pProject->prefixWNmsp( strRole)) && it->child().type() == eType ) {
  					role = *it;
  					break;
***************
*** 5057,5061 ****
  		std::set<MON::Containment> roles = getModelMeta().childContainments();
  		for ( std::set<MON::Containment>::iterator it = roles.begin() ; it != roles.end() ; it++ )
! 			if ( strRole == it->name() ) {
  				role = *it;
  				break;
--- 5117,5121 ----
  		std::set<MON::Containment> roles = getModelMeta().childContainments();
  		for ( std::set<MON::Containment>::iterator it = roles.begin() ; it != roles.end() ; it++ )
! 			if ( strRole == it->name() || ObjectImpl::m_pProject->prefixWNmsp( strRole) == it->name()) {
  				role = *it;
  				break;
***************
*** 6230,6234 ****
  		else {
  			for ( std::set<MON::Containment>::iterator it = metas.begin() ; it != metas.end() ; it++ ) {
! 				if ( it->name() == strRole && it->child().type() == MON::OT_Connection ) {
  					role = *it;
  					break;
--- 6290,6294 ----
  		else {
  			for ( std::set<MON::Containment>::iterator it = metas.begin() ; it != metas.end() ; it++ ) {
! 				if ( (it->name() == strRole || it->name() == ProjectImpl::prefixWNmspStatic( strRole)) && it->child().type() == MON::OT_Connection ) {
  					role = *it;
  					break;

Index: Extensions.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/SDK/BON/Extensions.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Extensions.cpp	15 Nov 2005 22:01:34 -0000	1.11
--- Extensions.cpp	21 Jul 2006 19:40:01 -0000	1.12
***************
*** 28,31 ****
--- 28,43 ----
  namespace BON
  {
+ 	// =================================================================================
+ 	//           SPECIAL CARE needed for strNamespacePref variable
+ 	// =================================================================================
+ 	// use this default declaration generally:
+ 	std::string                strNamespacePref = "";
+ 	//
+ 	// use this extern declaration if you define the initial value
+ 	// somewhere else e.g. bon2component.cpp, but in this case you 
+ 	// must do that in each component that shares the Extensions.cpp
+ 	// file located in c:\program files\sdk\bon:
+ 	//extern std::string         strNamespacePref;
+ 	// =================================================================================
  	void splitKinds( const std::string& strKinds, std::vector<std::string>& vecKinds )
  	{
***************
*** 107,114 ****
  			return exType;
  		for ( int i = 0 ; i < vecKinds.size() ; i++ ) {
! 			 if ( ! strRole.empty() && vecKinds[ i ] == strRole ) {
  			 	return ET_Role;
  			 }
! 			 else if ( vecKinds[ i ] == strKind ) {
  				if ( exType <= ET_MetaKind )
  					exType = ET_Kind;
--- 119,126 ----
  			return exType;
  		for ( int i = 0 ; i < vecKinds.size() ; i++ ) {
! 			 if ( ! strRole.empty() && ( vecKinds[ i ] == strRole || (strNamespacePref.empty()?"" : strNamespacePref + "::") + vecKinds[i] == strRole)) { 
  			 	return ET_Role;
  			 }
! 			 else if ( vecKinds[ i ] == strKind || (strNamespacePref.empty()?"" : strNamespacePref + "::") + vecKinds[ i ] == strKind) {
  				if ( exType <= ET_MetaKind )
  					exType = ET_Kind;



More information about the GME-commit mailing list