[GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep Any.cpp,1.7,1.8 AspectRep.cpp,1.5,1.6 AspectRep.h,1.4,1.5 AttributeRep.cpp,1.4,1.5 ConnJoint.cpp,1.7,1.8 ConnJoint.h,1.2,1.3 ConnectionRep.cpp,1.4,1.5 Dumper.cpp,1.15,1.16 Dumper.h,1.5,1.6 FolderRep.cpp,1.5,1.6 ModelRep.cpp,1.9,1.10 ModelRep.h,1.4,1.5 ReferenceRep.cpp,1.8,1.9 ReferenceRep.h,1.4,1.5

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Apr 26 13:13:40 CDT 2004


Update of /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep
In directory braindrain:/tmp/cvs-serv7087

Modified Files:
	Any.cpp AspectRep.cpp AspectRep.h AttributeRep.cpp 
	ConnJoint.cpp ConnJoint.h ConnectionRep.cpp Dumper.cpp 
	Dumper.h FolderRep.cpp ModelRep.cpp ModelRep.h 
	ReferenceRep.cpp ReferenceRep.h 
Log Message:
1.	XMLFilter introduced for attribute fields like Prompt, Help, 
	DefaultMenuItem, MenuItems in case of EnumAttribute
	Default for FieldAttribute

2.	Heterogeneous references allowed (in connections and aspect mapping as well)

3.	Intellingent source/destination label parsing introduced for Connections: 
	If attribute found with that name leading and trailing % characters introduced, 
	otherwise treated as simple string. 
	If the user uses the %attr% form then the is checked if exists attribute with such name.

4.	Connection inheritance: a "Design Error" message is issued if Connection inheritance
	does not conform with requirements of UML2.0. Soft warning like a constraint.

Modified Files:
 	Any.cpp AspectRep.cpp AspectRep.h AttributeRep.cpp 
 	ConnJoint.cpp ConnJoint.h ConnectionRep.cpp Dumper.cpp 
 	Dumper.h FolderRep.cpp ModelRep.cpp ModelRep.h 
 	ReferenceRep.cpp ReferenceRep.h 


CVS User: zolmol

Index: Any.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/Any.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Any.cpp	10 Mar 2004 02:36:28 -0000	1.7
--- Any.cpp	26 Apr 2004 17:13:38 -0000	1.8
***************
*** 156,177 ****
  	// if called with non empty in_token, this has to have a leading slash
  
- 	/*std::string token = "/" + token1;
- 	std::string meta_ref = "";
- 	if ( this->m_ptr)
- 	{
- 		meta_ref = m_ptr->getRegistry()->getValueByPath(token);
- 			
- 		if (meta_ref == "") 
- 		{ 
- 			int meta_ref_int = Broker::getNextMetaRefId();
- 			char n_meta_ref[64];
- 			sprintf( n_meta_ref, "%d", meta_ref_int);
- 			m_ptr->getRegistry()->setValueByPath( token, n_meta_ref);
- 			meta_ref = n_meta_ref;
- 		}
- 		return meta_ref;
- 	}
- 	return "NullPtrError";*/
- 
  	// getValueByPath needs leading '/'
  	// getChild doesn't need leading '/'
--- 156,159 ----

Index: AspectRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/AspectRep.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AspectRep.cpp	10 Mar 2004 02:36:28 -0000	1.5
--- AspectRep.cpp	26 Apr 2004 17:13:38 -0000	1.6
***************
*** 111,142 ****
  {
  	m_fcoInitialList.push_back( fco); 
- 	//m_wholeFCOIsInAspect.push_back( true);
- 	//m_inWhole[ fco] = true;
  }
  
  
- /*void AspectRep::addRole( FCO* fco, const std::string & role)
- {
- 	unsigned int i = 0; 
- 	bool conti = true;
- 	for( ; conti && i < m_fcoInitialList.size(); ++i)
- 	{
- 		if ( m_fcoInitialList[i] == fco && m_wholeFCOIsInAspect[i])
- 		{
- 			conti = false;
- 		}
- 	}
- 	if (!conti) // this means that the aspect already contains the whole fco
- 		return;
- 
- 	FCO_ROLE_PAIR p( fco, role);
- 	m_roleInitialList.push_back( p);
- 
- 	m_fcoInitialList.push_back( fco);
- 	m_wholeFCOIsInAspect.push_back( false);
- 	m_fcoRoleMap[ fco].push_back( role);
- }*/
- 
- 
  void AspectRep::addRRole( RoleRep & role)
  {
--- 111,117 ----
***************
*** 235,278 ****
  		global_vars.err << "Error: Part " << part.getRoleRepPtr()->getSmartRoleName() 
  		<< " attempted to insert twice into aspect " << getName() << "\n";
- }
- 
- 
- void AspectRep::addParts2Map( ModelRep * mod_ptr, FCO * fco, const std::vector<RoleRep>& roleserie)
- // not used currently
- {
- 	throw 1;
- 	if ( m_fcoFinalList.end() != 
- 		std::find(m_fcoFinalList.begin(), m_fcoFinalList.end(), fco))
- 	{
- 		std::vector<RoleRep>::const_iterator c_r_it = roleserie.begin();
- 		for( ; c_r_it != roleserie.end(); ++c_r_it)
- 		{
- 			PartRep pr( *c_r_it, this);
- 			addPart2Map( mod_ptr, pr);
- 		}
- 	}
- 	/*else // if the whole set of roles is not intended to be part of the aspect
- 	{
- 		std::vector<RoleRep>::const_iterator c_r_it = roleserie.begin();
- 		for( ; c_r_it != roleserie.end(); ++c_r_it)
- 		{
- 			bool found = false;
- 			std::string rolename = (*c_r_it)->getOnlyRoleName();
- 			std::list < std::string > &the_roles = m_fcoRoleMap[ fco];
- 			std::list < std::string >::iterator l_s_it = the_roles.begin();
- 			for( ; l_s_it != the_roles.end(); ++l_s_it)
- 			{
- 				if ( *l_s_it == rolename)
- 				{
- 					found = true;
- 				}
- 			}
- 			if ( found) // this aspect should contain this role 
- 			{
- 				PartRep pr( *c_r_it, this, 0, 1, 1);
- 				addPart2Map( mod_ptr, pr);
- 			}
- 		}
- 	}*/
  }
  
--- 210,213 ----

Index: AspectRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/AspectRep.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AspectRep.h	8 Mar 2004 22:22:59 -0000	1.4
--- AspectRep.h	26 Apr 2004 17:13:38 -0000	1.5
***************
*** 47,54 ****
  
  	void addPart2Map( ModelRep * mptr, const PartRep & part);
- 	void addParts2Map( ModelRep * mptr, FCO * fco, const std::vector<RoleRep>& roles);
  
  	void addFCO( FCO* fco); // to the initial list
- 	//void addRole( FCO* fco, const std::string & role); // to the initial list
  	void addRRole( RoleRep & role);
  	bool findFinalFCO( const FCO * fco) const; // in the final list
--- 47,52 ----
***************
*** 82,96 ****
  	int m_priority;
  	
- 	/*typedef std::pair< FCO*, std::string> FCO_ROLE_PAIR;
- 	std::vector< FCO_ROLE_PAIR > m_roleInitialList;
- 	typedef std::map < FCO*, std::list< std::string > > FCO_ROLE_MAP;
- 	typedef std::map < FCO*, std::list< std::string > >::iterator FCO_ROLE_MAP_Iterator;
- 	FCO_ROLE_MAP m_fcoRoleMap; // for the roles
- 	typedef std::map < FCO*, std::list< RoleRep > > FCO_ROLE2_MAP;
- 	typedef std::map < FCO*, std::list< RoleRep > >::iterator FCO_ROLE2_MAP_Iterator;
- 	FCO_ROLE2_MAP m_fcoRole2Map; // for the roles
- 	std::vector< bool> m_wholeFCOIsInAspect;
- 	std::map< FCO*, bool> m_inWhole;*/
- 
  	ModelPartsMap m_partsMap;
  
--- 80,83 ----

Index: AttributeRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/AttributeRep.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AttributeRep.cpp	11 Mar 2004 15:39:38 -0000	1.4
--- AttributeRep.cpp	26 Apr 2004 17:13:38 -0000	1.5
***************
*** 8,11 ****
--- 8,12 ----
  
  #include "globals.h"
+ #include "Dumper.h"
  extern Globals global_vars;
  extern int ind;
***************
*** 37,41 ****
  std::string AttributeRep::getPrompt()
  {
! 	return m_ptr->getAttribute("Prompt")->getStringValue();
  }
  
--- 38,42 ----
  std::string AttributeRep::getPrompt()
  {
! 	return Dumper::xmlFilter( m_ptr->getAttribute("Prompt")->getStringValue());
  }
  
***************
*** 44,48 ****
  {
  	std::string mmm;
! 	std::string help = m_ptr->getAttribute("Help")->getStringValue();
  	if( !help.empty())
  		mmm += indStr() + "<regnode name=\"help\" value = \"" + help + "\"></regnode>\n";
--- 45,49 ----
  {
  	std::string mmm;
! 	std::string help = Dumper::xmlFilter( m_ptr->getAttribute("Help")->getStringValue());
  	if( !help.empty())
  		mmm += indStr() + "<regnode name=\"help\" value = \"" + help + "\"></regnode>\n";
***************
*** 56,60 ****
  	std::string m_ref;
  	std::string token = "";
! 	if (!owner.empty()) token = "/" + owner;
  	m_ref = askMetaRef(token);
  
--- 57,61 ----
  	std::string m_ref;
  	std::string token = "";
! 	if ( !owner.empty()) token = "/" + owner;
  	m_ref = askMetaRef(token);
  
***************
*** 117,123 ****
  , value4			-error case
  elem4,				-error case
  */
  
! 	std::string items = m_ptr->getAttribute("MenuItems")->getStringValue();
  
  	items += '\n'; // like an EOF sign
--- 118,127 ----
  , value4			-error case
  elem4,				-error case
+ 
+ 
+ using special characters like: & < > " ' is not an error any more: are replaced with the xml escape codes
  */
  
! 	std::string items = Dumper::xmlFilter( m_ptr->getAttribute("MenuItems")->getStringValue());
  
  	items += '\n'; // like an EOF sign
***************
*** 144,148 ****
  
  				if ( end>=st)
! 					m_items.push_back(items.substr( st, end - st + 1));//m_items.push_back(items.substr( start_i, comma_i - start_i));
  				else
  					m_items.push_back("Error");
--- 148,152 ----
  
  				if ( end>=st)
! 					m_items.push_back(items.substr( st, end - st + 1));
  				else
  					m_items.push_back("Error");
***************
*** 155,159 ****
  				
  				if ( end>=st)
! 					m_itemsVal.push_back(items.substr( st, end - st + 1));//m_itemsVal.push_back(items.substr( comma_i + 1, i - comma_i - 1));
  				else
  					m_items.push_back("Error");
--- 159,163 ----
  				
  				if ( end>=st)
! 					m_itemsVal.push_back(items.substr( st, end - st + 1));
  				else
  					m_items.push_back("Error");
***************
*** 172,177 ****
  				if ( end>=st)
  				{
! 					m_items.push_back(items.substr( st, end - st + 1));//m_items.push_back(items.substr( start_i, i - start_i));
! 					m_itemsVal.push_back(items.substr( st, end - st + 1));//m_itemsVal.push_back(items.substr( start_i, i - start_i));
  				}
  			}
--- 176,181 ----
  				if ( end>=st)
  				{
! 					m_items.push_back(items.substr( st, end - st + 1));
! 					m_itemsVal.push_back(items.substr( st, end - st + 1));
  				}
  			}
***************
*** 188,192 ****
  	}
  
! 	std::string def_item = m_ptr->getAttribute("DefaultItem")->getStringValue();
  
  	bool found ( false);
--- 192,196 ----
  	}
  
! 	std::string def_item = Dumper::xmlFilter( m_ptr->getAttribute("DefaultItem")->getStringValue());
  
  	bool found ( false);
***************
*** 215,219 ****
  	
  	++ind;
! 	mmm += indStr() + "<dispname>" + getPrompt() + "</dispname>\n";
  	for(int i = 0; i < m_noOfItems; ++i)
  	{
--- 219,227 ----
  	
  	++ind;
! 
! 	std::string prompt = getPrompt();
! 	if ( !prompt.empty())
! 		mmm += indStr() + "<dispname>" + prompt + "</dispname>\n";
! 
  	for(int i = 0; i < m_noOfItems; ++i)
  	{
***************
*** 243,247 ****
  	
  	++ind;
! 	mmm += indStr() + "<dispname>" + getPrompt() + "</dispname>\n";
  
  	mmm += dumpHelp();
--- 251,258 ----
  	
  	++ind;
! 
! 	std::string prompt = getPrompt();
! 	if ( !prompt.empty())
! 		mmm += indStr() + "<dispname>" + prompt + "</dispname>\n";
  
  	mmm += dumpHelp();
***************
*** 257,261 ****
  	std::string mmm = "";
  	std::string val_type = m_ptr->getAttribute("DataType")->getStringValue();
! 	std::string def_val = m_ptr->getAttribute("FieldDefault")->getStringValue();
  	int multiline = m_ptr->getAttribute("Multiline")->getIntegerValue();
  
--- 268,272 ----
  	std::string mmm = "";
  	std::string val_type = m_ptr->getAttribute("DataType")->getStringValue();
! 	std::string def_val = Dumper::xmlFilter( m_ptr->getAttribute("FieldDefault")->getStringValue());
  	int multiline = m_ptr->getAttribute("Multiline")->getIntegerValue();
  
***************
*** 265,269 ****
  	
  	++ind;
! 	mmm += indStr() + "<dispname>" + getPrompt() + "</dispname>\n";
  	if( multiline > 1)
  	{
--- 276,284 ----
  	
  	++ind;
! 
! 	std::string prompt = getPrompt();
! 	if ( !prompt.empty())
! 		mmm += indStr() + "<dispname>" + prompt + "</dispname>\n";
! 
  	if( multiline > 1)
  	{

Index: ConnJoint.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ConnJoint.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ConnJoint.cpp	10 Mar 2004 20:03:32 -0000	1.7
--- ConnJoint.cpp	26 Apr 2004 17:13:38 -0000	1.8
***************
*** 377,380 ****
--- 377,381 ----
  }
  
+ 
  void ConnJoint::createConstraints( Sheet* s, const std::string& conn_name)
  {
***************
*** 458,461 ****
--- 459,494 ----
  
  
+ /*
+ the added connjoint (since it comes from above) is supposed to have an m_oper1 and m_oper2 
+ values that are ancestors of the m_oper1 and m_oper2 lists of *this 
+ */
+ bool ConnJoint::descendantsOf( const ConnJoint& peer) const
+ {
+ 	bool res = true;
+ 	
+ 	const SDList* mylists[] = { &m_oper1, &m_oper2 };
+ 	const SDList* peerlists[] = { &peer.m_oper1, &peer.m_oper2 };
+ 
+ 	for( int i = 0; res && i < 2; ++i)
+ 	{
+ 		SDList_ConstIterator it = mylists[i]->begin();
+ 		for( ; res && it != mylists[i]->end(); ++it)
+ 		{
+ 			bool current_found = false;
+ 			
+ 			SDList_ConstIterator itp = peerlists[i]->begin();
+ 			for( ; !current_found && itp != peerlists[i]->end(); ++itp)
+ 			{
+ 				std::vector<FCO*> descs;
+ 				(*itp)->getIntDescendants( descs);
+ 
+ 				if ( std::find( descs.begin(), descs.end(), *it) != descs.end()) // found
+ 					current_found = true;
+ 			}
+ 			res = res && current_found;
+ 		}
+ 	}
+ 	return res;
+ }
  
  
***************
*** 489,490 ****
--- 522,525 ----
  then the C has to be extended with the M4 A1, M5 A1, M6 A1 targets
  */
+ 
+ 

Index: ConnJoint.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ConnJoint.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ConnJoint.h	10 Mar 2004 02:36:29 -0000	1.2
--- ConnJoint.h	26 Apr 2004 17:13:38 -0000	1.3
***************
*** 57,60 ****
--- 57,62 ----
  	void createConstraints( Sheet*, const std::string& conn_name);
  
+ 	bool descendantsOf( const ConnJoint& peer) const;
+ 
  protected:
  

Index: ConnectionRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ConnectionRep.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConnectionRep.cpp	10 Mar 2004 02:36:29 -0000	1.4
--- ConnectionRep.cpp	26 Apr 2004 17:13:38 -0000	1.5
***************
*** 30,42 ****
  
  
! void ConnectionRep::appendJointElements( const ConnJoint & old_joint)
  {
! 	ConnJoint joint( old_joint); // create a copy of the old joint
! 	joint.setConnectionPtr( this); // set the new container connection
  
  	if (m_jointList.empty())
! 		m_jointList.push_back( joint);
! 	else // with some constraint, but still copying
! 		m_jointList.push_back( joint);
  }
  
--- 30,53 ----
  
  
! void ConnectionRep::appendJointElements( const ConnJoint & joint_of_ancestor)
  {
! 	ConnJoint a_joint( joint_of_ancestor); // create a copy of the joint
! 	a_joint.setConnectionPtr( this); // set the new container connection
  
  	if (m_jointList.empty())
! 		m_jointList.push_back( a_joint);
! 	else // with some constraint, but still copying (in error case write a log - like a constraint)
! 	{
! 		m_jointList.push_back( a_joint);
! 
! 		bool desc = false;
! 
! 		std::list<ConnJoint>::iterator it = m_jointList.begin();
! 		for( ; !desc && it != m_jointList.end(); ++it)
! 			desc = desc || it->descendantsOf( a_joint);
! 
! 		if ( !desc)
! 			global_vars.err << "Design error at connection \"" << getName() << "\". Derived connection is valid only if defined between fcos derived from the fcos connected by the base connection.\n";
! 	}
  }
  
***************
*** 74,79 ****
  			ConnectionRep * conn_rep = 0;
  			if ( (*conn_it)->getMyKind() == Any::CONN)
! 				conn_rep = static_cast<ConnectionRep *>(*conn_it);
! 			if (conn_rep)			
  				conn_rep->appendJointElements( *joint_it);
  		}
--- 85,90 ----
  			ConnectionRep * conn_rep = 0;
  			if ( (*conn_it)->getMyKind() == Any::CONN)
! 				conn_rep = dynamic_cast<ConnectionRep *>( *conn_it);
! 			if (conn_rep)
  				conn_rep->appendJointElements( *joint_it);
  		}
***************
*** 124,135 ****
  			std::string label = m_ptr->getAttribute( which[i])->getStringValue();
  			if( !label.empty()) {
! 				bool attr = findFinalAttributeBasedOnName( label);
! 				if( attr ) 
! 					mmm += indStr() + "<regnode name= \"" + reg_label[i] + "\" value=\"%" + label + "%\"/>\n";
  				else
! 					global_vars.err << "Attribute \"" << label << "\" not found for connection \"" << getName() << "\". Wrong label specification.\n";
  			}
  		}
- 
  	}
  	return mmm;
--- 135,160 ----
  			std::string label = m_ptr->getAttribute( which[i])->getStringValue();
  			if( !label.empty()) {
! 				// the label may or may not contain the % sign
! 				// but if we find an attribute with that name, we place the % sign arount it
! 				// if the attribute is not found it is considered to be an ordinary label
! 				if ( label.length() > 1 && label[0] == '%' && label[ label.length() - 1] == '%')
! 				{
! 					bool attr = findFinalAttributeBasedOnName( label.substr( 1, label.length() - 2));
! 					if( attr ) 
! 						mmm += indStr() + "<regnode name= \"" + reg_label[i] + "\" value=\"" + label + "\"/>\n";
! 					else
! 						global_vars.err << "Attribute \"" << label.substr( 1, label.length() - 2) << "\" not found for connection \"" << getName() << "\". Wrong label specification.\n";
! 				}
  				else
! 				{
! 					bool attr = findFinalAttributeBasedOnName( label);
! 					if( attr ) 
! 						mmm += indStr() + "<regnode name= \"" + reg_label[i] + "\" value=\"%" + label + "%\"/>\n";
! 					else
! 						mmm += indStr() + "<regnode name= \"" + reg_label[i] + "\" value=\"" + label + "\"/>\n";
! 						// previously: global_vars.err << "Attribute \"" << label << "\" not found for connection \"" << getName() << "\". Wrong label specification.\n";
! 				}
  			}
  		}
  	}
  	return mmm;

Index: Dumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/Dumper.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Dumper.cpp	11 Mar 2004 15:39:38 -0000	1.15
--- Dumper.cpp	26 Apr 2004 17:13:38 -0000	1.16
***************
*** 8,12 ****
  #include "algorithm"
  #include <afxdlgs.h>
- #define FILE_SELECTION 1
  
  #include "globals.h"
--- 8,11 ----
***************
*** 1166,1175 ****
  		else
  		{
! 			if (!(*it5)->checkAllTheSameKind())
  			{
! 				// removed upon user request: 2/25/2004
! 				/*global_vars.err << "CHECK: Reference \"" << (*it5)->getName() << "\" is referring to more than one kind of fcos.\n"; 
! 				res = false;*/
! 			}
  			if (!(*it5)->isAbstract() && !(*it5)->checkIsPartOfFinal()) 
  			{ 
--- 1165,1174 ----
  		else
  		{
! 			// removed upon user request: 2/25/2004
! 			/*if (!(*it5)->checkAllTheSameKind())
  			{
! 				global_vars.err << "CHECK: Reference \"" << (*it5)->getName() << "\" is referring to more than one kind of fcos.\n"; 
! 				res = false;
! 			}*/
  			if (!(*it5)->isAbstract() && !(*it5)->checkIsPartOfFinal()) 
  			{ 
***************
*** 1539,1543 ****
  /*static*/ int Dumper::selectOutputFiles( const std::string& proj_name)
  {
- #if(FILE_SELECTION)
  	try {
  		global_vars.xmp_file_name = proj_name + ".xmp";
--- 1538,1541 ----
***************
*** 1562,1566 ****
  		global_vars.err << "Exception caught! Using default filenames.\n";
  	}
- #endif
  	return 1;
  }
--- 1560,1563 ----
***************
*** 1583,1592 ****
  		}
  	}
- 	/*else 
- 	{
- 		AfxMessageBox("Cannot open/create file " + filename, MB_OK | MB_ICONSTOP);
- 				AfxMessageBox("No output was produced!", MB_OK | MB_ICONSTOP);
- 	}*/
  }
  
  
--- 1580,1602 ----
  		}
  	}
  }
  
  
+ /*static*/ std::string Dumper::xmlFilter( const std::string& in)
+ {
+ 	std::map<char, std::string> m;
+ 	m['&'] = "&amp;";
+ 	m['>'] = "&gt;";
+ 	m['<'] = "&lt;";
+ 	m['"'] = "&quot;";
+ 	m['\''] = "&apos;";
+ 
+ 	std::string ret;
+ 	for( std::string::const_iterator i = in.begin(); i != in.end(); ++i)
+ 		if ( m.find( *i) != m.end())
+ 			ret += m[*i];
+ 		else
+ 			ret += *i;
+ 
+ 	return ret;
+ }
\ No newline at end of file

Index: Dumper.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/Dumper.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Dumper.h	10 Mar 2004 02:36:29 -0000	1.5
--- Dumper.h	26 Apr 2004 17:13:38 -0000	1.6
***************
*** 5,8 ****
--- 5,9 ----
  #include "vector"
  #include "Sheet.h"
+ #include "functional"
  
  class Dumper : public Sheet {
***************
*** 26,29 ****
--- 27,31 ----
  		std::string &expr);
  	
+ 	static std::string xmlFilter( const std::string& in);
  
  protected:

Index: FolderRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/FolderRep.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FolderRep.cpp	10 Mar 2004 02:36:29 -0000	1.5
--- FolderRep.cpp	26 Apr 2004 17:13:38 -0000	1.6
***************
*** 84,88 ****
  	{
  		if (!(*it)->isAbstract())
! 					fco_list_empty = false;
  		++it;
  	}
--- 84,88 ----
  	{
  		if (!(*it)->isAbstract())
! 			fco_list_empty = false;
  		++it;
  	}

Index: ModelRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ModelRep.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ModelRep.cpp	11 Mar 2004 15:39:38 -0000	1.9
--- ModelRep.cpp	26 Apr 2004 17:13:38 -0000	1.10
***************
*** 158,174 ****
  bool ModelRep::getFinalRoles( const FCO * ptr, RoleMapValue& map_val) const
  {
! 	RoleMap_ConstIterator it = m_finalRoleMap.begin();
! 	while ( it != m_finalRoleMap.end() && it->first != ptr)
! 		++it;
! 	if ( it == m_finalRoleMap.end())
! 		return false;
! 	map_val = it->second;
! 	return true;
! /*RoleMap_ConstIterator it = m_finalRoleMap.find( ptr);
  	if ( it == m_finalRoleMap.end())
  		return false;
  
  	map_val = it->second;
! 	return true;*/
  }
  
--- 158,167 ----
  bool ModelRep::getFinalRoles( const FCO * ptr, RoleMapValue& map_val) const
  {
! 	RoleMap_ConstIterator it = m_finalRoleMap.find( const_cast<FCO *>( ptr));
  	if ( it == m_finalRoleMap.end())
  		return false;
  
  	map_val = it->second;
! 	return true;
  }
  
***************
*** 456,478 ****
  
  
- /* 
- obsolete!
- how many of my aspects contain FCO as an aspect member
- */
- /*int ModelRep::searchMyAspectsForFCO( const FCO* asp_element) const // should be changed to part search
- {
- 	throw 1;
- 	unsigned int i = 0;
- 	int count = 0;
- 	while ( i < m_finalAspectList.size())
- 	{
- 		if ( m_finalAspectList[i]->findFinalFCO( asp_element))
- 			++count;
- 		++i;
- 	}
- 	return count;
- }*/
- 
- 
  void ModelRep::getAspectNames(CStringList &list) const
  {
--- 449,452 ----
***************
*** 578,600 ****
  
  	// aspects
- 	/*std::list<AspectRep*> temp_list;
- 	//std::list<AspectRep*>::iterator t_it;
- 	
- 	if (!m_finalAspectList.empty())
- 	{
- 		temp_list.push_back( *m_finalAspectList.begin());
- 
- 		std::vector<AspectRep*>::iterator asp_it0 = m_finalAspectList.begin();
- 		for( ++asp_it0 ; asp_it0 != m_finalAspectList.end(); ++asp_it0)
- 		{
- 			t_it = temp_list.begin();
- 			while( t_it != temp_list.end() && (*t_it)->lessThan(*(*asp_it0)))
- 				++t_it;
- 			temp_list.insert( t_it, *asp_it0);
- 		}
- 
- 		// dump uses temp_list
- 		std::list<AspectRep*>::iterator asp_it = temp_list.begin();
- 		for( ; asp_it != temp_list.end(); ++asp_it)*/
  	{
  		AspectCompare asp_less_than;
--- 552,555 ----
***************
*** 617,621 ****
  				mmm += asp_ptr->dumpDispName();
  
! 			std::vector/*map*/< std::string/*, std::vector<std::string>, StringLex*/> part_lines_to_dump;
  
  			const AspectRep::PartRepSeries parts = (*asp_it)->getPartSeries( this);
--- 572,576 ----
  				mmm += asp_ptr->dumpDispName();
  
! 			std::vector< std::string> part_lines_to_dump;
  
  			const AspectRep::PartRepSeries parts = (*asp_it)->getPartSeries( this);
***************
*** 673,677 ****
  					if (!error) 
  					{
! 						TO("Check log file for errors.");
  						error = true;
  					}
--- 628,632 ----
  					if (!error) 
  					{
! 						TO("Please check the log file for errors.");
  						error = true;
  					}

Index: ModelRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ModelRep.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ModelRep.h	10 Mar 2004 02:36:29 -0000	1.4
--- ModelRep.h	26 Apr 2004 17:13:38 -0000	1.5
***************
*** 69,74 ****
  
  	// search
- private: // obsolete
- 	int searchMyAspectsForFCO( const FCO* asp_element) const; // how many of my aspects contain FCO as an aspect member
  public:
  	int searchMyAspectsForPart( PartRep& part) const; // how many of my aspects contain part as an aspect member
--- 69,72 ----

Index: ReferenceRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ReferenceRep.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ReferenceRep.cpp	10 Mar 2004 20:03:32 -0000	1.8
--- ReferenceRep.cpp	26 Apr 2004 17:13:38 -0000	1.9
***************
*** 58,71 ****
  }
  
! /*
! Return true if the reference refers to a Model (a non abstract model) beside other kinds like FCO or Reference
! -----------------------------------------------------------------------------------------------
! Since the inheritance is allowed to be homogenous the result is not depending 
! if we checked the m_initialRefereeList or m_finalRefereeList
! */
  bool ReferenceRep::pointsToModels() const
  {
! 	int how_many_models = 0;
! 	std::string which_models;
  	bool value_set = false;
  	bool to_models = true;
--- 58,91 ----
  }
  
! /**
!  * Returns true if the reference refers to a Model (a non abstract model) beside all other kinds like Atom, FCO, Reference, Set
!  * The permissive version
!  */
  bool ReferenceRep::pointsToModels() const
  {
! 	bool to_models = false;
! 
! 	for( unsigned int i = 0; !to_models && i < m_allReferees.size(); ++i)
! 	{
! 		// consider the non-abstracts models only (if a reference points to an abstract model, that doesn't mean too much)
! 		if ( !m_allReferees[i]->isAbstract())
! 		{
! 			to_models = to_models || (m_allReferees[i]->getMyKind() == Any::MODEL);
! 		}
! 	}
! 
! 	return to_models;
! }
! 
! /*****    deprecated version, see Emre's bug, non-homogeneous references  ************
! // The strict version
! //Return true if the reference refers to a Model (a non abstract model) beside other kinds like FCO or Reference
! //-----------------------------------------------------------------------------------------------
! //Since the inheritance is allowed to be homogenous the result is not depending 
! //if we checked the m_initialRefereeList or m_finalRefereeList
! bool ReferenceRep::pointsToModels() const
! {
! 	int how_many_models = 0;//t
! 	std::string which_models;//t
  	bool value_set = false;
  	bool to_models = true;
***************
*** 84,88 ****
  				value_set = true;
  
! 				if (kind == Any::MODEL)
  				{
  					how_many_models += 1;
--- 104,108 ----
  				value_set = true;
  
! 				if (kind == Any::MODEL)//t
  				{
  					how_many_models += 1;
***************
*** 95,103 ****
  	if (value_set) return to_models;
  	else return false;
! }
  
  
  /*
! Should return vector<ModelRep *> if pointToModels is true
  Returns non abstract models only !!! (see ESML paradigm)
  */
--- 115,124 ----
  	if (value_set) return to_models;
  	else return false;
! }*/
! 
  
  
  /*
! Should return vector<ModelRep *> if pointsToModels is true
  Returns non abstract models only !!! (see ESML paradigm)
  */
***************
*** 105,110 ****
  {
  	std::vector<const ModelRep *> models;
! 	unsigned int i = 0;
! 	while( i < m_allReferees.size()) 
  	{
  		if ( m_allReferees[i]->getMyKind() == Any::MODEL && !m_allReferees[i]->isAbstract())
--- 126,131 ----
  {
  	std::vector<const ModelRep *> models;
! 	
! 	for( unsigned int i = 0; i < m_allReferees.size(); ++i) 
  	{
  		if ( m_allReferees[i]->getMyKind() == Any::MODEL && !m_allReferees[i]->isAbstract())
***************
*** 114,118 ****
  				models.push_back( c_m);
  		}
- 		++i;
  	}
  
--- 135,138 ----
***************
*** 122,126 ****
  
  /* -- obsolete
! Should return a ModelRep * if pointToModels is true
  Returns non abstract models only !!! (see ESML paradigm)
  */
--- 142,146 ----
  
  /* -- obsolete
! Should return a ModelRep * if pointsToModels is true
  Returns non abstract models only !!! (see ESML paradigm)
  */
***************
*** 316,319 ****
--- 336,341 ----
  }
  
+ /*
+ // obsolete // removed upon user request 2/25/2004
  bool ReferenceRep::checkAllTheSameKind() const
  {
***************
*** 343,348 ****
  				{
  					// removed upon user request 2/25/2004
! 					/*global_vars.err << "CHECK: Reference \"" << getName() << "\" refers to too many kinds: " <<
! 					Any::KIND_TYPE_STR[kind] << " and " << Any::KIND_TYPE_STR[kind_of_i] << "\n";*/
  				}
  			}
--- 365,370 ----
  				{
  					// removed upon user request 2/25/2004
! 					global_vars.err << "CHECK: Reference \"" << getName() << "\" refers to too many kinds: " <<
! 					Any::KIND_TYPE_STR[kind] << " and " << Any::KIND_TYPE_STR[kind_of_i] << "\n";
  				}
  			}
***************
*** 351,355 ****
  	if (value_set) return same_kind;
  	else return false;
! }
  
  
--- 373,377 ----
  	if (value_set) return same_kind;
  	else return false;
! }*/
  
  
***************
*** 409,430 ****
  }
  
- 
- /*out of date, out of use obsolete*/
- /*AspectRep * ReferenceRep::getFirstAmongModelAspects() const
- {
- 	// the first aspects of the referred models to be compared and the best returned
- 	AspectRep * lowest_asp = 0;
- 	std::vector<const ModelRep *> models = getModelRefVector();
- 	std::vector<const ModelRep *>::iterator it = models.begin();
- 	for( ; it != models.end(); ++it)
- 	{
- 		AspectRep * min_asp = (*it)->getFirstAspect();
- 		if ( !lowest_asp) // is lowest_asp set?
- 			lowest_asp = min_asp;
- 		else if ( !lowest_asp->lessThan( *min_asp)) // compare
- 			lowest_asp = min_asp;
- 	}
- 	return lowest_asp;
- }*/
  
  
--- 431,434 ----

Index: ReferenceRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Rep/ReferenceRep.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ReferenceRep.h	10 Mar 2004 02:36:29 -0000	1.4
--- ReferenceRep.h	26 Apr 2004 17:13:38 -0000	1.5
***************
*** 31,40 ****
  	void inherit();
  
! 	bool pointsToModels() const; // true if points to models only
  	std::vector<const ModelRep *> getModelRefVector() const;
- 	//const ModelRep * getModelRef() const; // obsolete
  
  	bool checkNotEmpty() const;
- 	bool checkAllTheSameKind() const; 
  
  	// aspect related
--- 31,38 ----
  	void inherit();
  
! 	bool pointsToModels() const; // true if points to models as well
  	std::vector<const ModelRep *> getModelRefVector() const;
  
  	bool checkNotEmpty() const;
  
  	// aspect related
***************
*** 42,46 ****
  	std::vector<AspectRep *> getAspectsIntersection() const;
  	AspectRep * getFirstAspectFromIntersection() const;
- 	//AspectRep * getFirstAmongModelAspects() const; //obsolete
  
  protected:
--- 40,43 ----



More information about the GME-commit mailing list