[GME-commit] GMESRC/Paradigms/MetaGME/BonExtension/Rep CodeGenReg.cpp,NONE,1.1 CodeGenTemplate.cpp,NONE,1.1 Any.cpp,1.8,1.9 Any.h,1.5,1.6 AttributeRep.cpp,1.7,1.8 AttributeRep.h,1.4,1.5 CodeGen.cpp,1.4,1.5 CodeGen.h,1.2,1.3 ConnJoint.cpp,1.6,1.7 ConnJoint.h,1.4,1.5 ConnectionRep.cpp,1.4,1.5 Dumper.cpp,1.10,1.11 Dumper.h,1.6,1.7 FCO.cpp,1.13,1.14 FCO.h,1.10,1.11 MakeVisitor.cpp,1.4,1.5 Method.cpp,1.5,1.6 Method.h,1.2,1.3 ModelRep.cpp,1.10,1.11 ModelRep.h,1.4,1.5 ReferenceRep.cpp,1.7,1.8 ReferenceRep.h,1.3,1.4 SetRep.cpp,1.8,1.9 SetRep.h,1.4,1.5

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Jun 16 14:35:06 CDT 2004


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

Modified Files:
	Any.cpp Any.h AttributeRep.cpp AttributeRep.h CodeGen.cpp 
	CodeGen.h ConnJoint.cpp ConnJoint.h ConnectionRep.cpp 
	Dumper.cpp Dumper.h FCO.cpp FCO.h MakeVisitor.cpp Method.cpp 
	Method.h ModelRep.cpp ModelRep.h ReferenceRep.cpp 
	ReferenceRep.h SetRep.cpp SetRep.h 
Added Files:
	CodeGenReg.cpp CodeGenTemplate.cpp 
Log Message:
Corrections:

-implementation inheritance mapping to C++ corrected.


Features:
-Options dialogue added

-template methods can be generated for ordering sets (as the user wishes)

-initialize and finalize generated if wanted



CVS User: zolmol

--- NEW FILE: CodeGenReg.cpp ---
#include "stdafx.h"
#include "CodeGen.h"
#include "Dumper.h"

/*const*/ extern int s_ind;


/*static*/ void CodeGen::folderGetter( const std::string& retval_folderkind, const std::string& folderkind, const std::string& method_name, bool extended, Any * cont, Method& m)
{
	std::string src, comm;
	
	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_folderkind + "> res;\n";
	src += indent(s_ind + 1) +   "std::set<BON::Folder> l = getChildFolders();\n";
	src += indent(s_ind + 1) +   "for( std::set<BON::Folder>::iterator i = l.begin(); i != l.end(); ++i)\n";
	src += indent(s_ind + 1) +   "{\n";
	src += indent(s_ind + 2) +     retval_folderkind + " elem(*i);\n";
	if ( extended)
		src += indent(s_ind + 2) +   "if (elem)\n";
	else
		src += indent(s_ind + 2) +   "if (elem && elem->getObjectMeta().name() == \"" + folderkind + "\")\n";
	src += indent(s_ind + 3) +       "res.insert(elem);\n";
	src += indent(s_ind + 1) +   "}\n";
	src += indent(s_ind + 1) +   "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";

	comm = "getter for subfolder \"" + folderkind + "\"";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_folderkind + ">";
	m.m_signature = method_name + "()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;

	return;
}


/*static*/ void CodeGen::kindGetter1( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m)
{
	std::string src, comm;
	
	comm = "getter for kind \"" + kind + "\"";
	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(s_ind + 1) +   "std::set<BON::Object> kinds = getChildObjects";
	src +=               "(\"" + kind + "\");\n";
	src += indent(s_ind + 1) +   "for( std::set<BON::Object>::iterator i = kinds.begin(); i != kinds.end(); ++i)\n";
	src += indent(s_ind + 1) +   "{\n";
	src += indent(s_ind + 2) +     retval_kind + " elem(*i);\n";
	src += indent(s_ind + 2) +     "ASSERT(elem);\n";
	src += indent(s_ind + 2) +     "res.insert(elem);\n";
	src += indent(s_ind + 1) +   "}\n";
	src += indent(s_ind + 1) +   "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = method_name + "()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;

	return;
}


/*static*/ void CodeGen::kindGetter2( const std::string& retval_kind, const std::string& kind, const std::vector< std::string>& kind_vec, const std::string& method_name, Any * cont, Method& m)
{
	std::string src, comm;

	// the number of non-abstract fcos
	char len_s[10]; sprintf(len_s, "%u", kind_vec.size()); std::string len_str( len_s);
	
	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(s_ind + 1) +   "const int len = " + len_str + ";\n";
	src += indent(s_ind + 1) +   "std::set<BON::Object> kinds_vec[ len];\n";
	
	for( int k = 0; k < kind_vec.size(); ++k)
	{
		char k_s[10]; sprintf( k_s, "%i", k); std::string k_str( k_s);
		src += indent(s_ind + 1) + "kinds_vec[" + k_str + "] = getChildObjects";
		src += "(\"" + kind_vec[k] + "\");\n";
	}
	src += indent(s_ind + 1) + "for( int k = 0; k < len; ++k)\n";
	src += indent(s_ind + 2) +   "for( std::set<BON::Object>::iterator i = kinds_vec[k].begin(); i != kinds_vec[k].end(); ++i)\n";
	src += indent(s_ind + 2) +   "{\n";
	src += indent(s_ind + 3) +     retval_kind + " elem(*i);\n";
	src += indent(s_ind + 3) +     "ASSERT(elem);\n";
	src += indent(s_ind + 3) +     "res.insert(elem);\n";
	src += indent(s_ind + 2) +   "}\n";
	src += indent(s_ind + 1) + "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";	

	comm = "aggregated getter for kind \"" + kind + "\" and its descendants";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = method_name + "()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;
}


/*static*/ void CodeGen::kindGetter3( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m)
{
	// currently not used
	std::string src, comm;

	comm = "EXCL getter for kind \"" + kind + "\"";

	src  = "{\n";
	src += "  std::set<" + retval_kind + "> res;\n";
	src += "  std::set<Object> l = getChildObjects";
	src += "(\"" + kind + "\");\n";
	src += "  for( std::set<Object>::iterator i = l.begin(); i != l.end(); ++i)\n";
	src += "  {\n";
	src += "     " + retval_kind + " elem(*i);\n";
	src += "     ASSERT(elem);\n";
	src += "     res.insert(elem);\n";
	src += "  }\n";
	src += "  return res;\n";
	src += "}\n\n\n";	

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = method_name + "_Excl()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;
}

/*static*/ void CodeGen::roleGetter1( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& m)
{
	std::string src, comm;

	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(s_ind + 1) +   "std::set<BON::FCO> roles = getChildFCOsAs";
	src +=                       "(\"" + inquire + "\");\n";
	src += indent(s_ind + 1) +   "for( std::set<BON::FCO>::iterator i = roles.begin(); i != roles.end(); ++i)\n";
	src += indent(s_ind + 1) +   "{\n";
	src += indent(s_ind + 2) +       retval_kind + " elem(*i);\n";
	src += indent(s_ind + 2) +      "ASSERT(elem);\n";
	src += indent(s_ind + 2) +      "res.insert(elem);\n";
	src += indent(s_ind + 1) +   "}\n";
	src += indent(s_ind + 1) +   "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";

	comm =  "getter for role \"" + inquire + "\" among \"" + fco_name + "\"s";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = method_name + "()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;

	return;
}


/*static*/ void CodeGen::roleGetter2( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& m)
{
	std::string src, comm;

	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(s_ind + 1) +   "std::set<BON::FCO> roles = getChildFCOsAs";
	src +=                       "(\"" + inquire + "\");\n";
	src += indent(s_ind + 1) +   "for( std::set<BON::FCO>::iterator i = roles.begin(); i != roles.end(); ++i)\n";
	src += indent(s_ind + 1) +   "{\n";
	src += indent(s_ind + 2) +      retval_kind + " elem(*i);\n";
	src += indent(s_ind + 2) +      "ASSERT(elem);\n";
	src += indent(s_ind + 2) +      "res.insert(elem);\n";
	src += indent(s_ind + 1) +   "}\n";
	src += indent(s_ind + 1) +   "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";

	comm = "getter for role \"" + inquire + "\" among \"" + fco_name + "\"s";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = method_name + "()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;

	return;
}


/*static*/ void CodeGen::roleGetter3( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& role_name, const std::vector< std::string > & roles, const std::string& dummy_str, Any * cont, Method& m)
{
	std::string src, comm;

	char len_s[10]; sprintf(len_s, "%u", roles.size()); std::string len_str( len_s);

	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(s_ind + 1) +   "const int len = " + len_str + ";\n";
	src += indent(s_ind + 1) +   "std::set<BON::FCO> roles_vec[ len];\n";
	
	for( int k = 0; k < roles.size(); ++k)
	{
		char k_s[10]; sprintf( k_s, "%i", k); std::string k_str( k_s);
		src += indent(s_ind + 1) + "roles_vec[" + k_str + "] = getChildFCOsAs";
		src += "(\"";
		src += roles[k];
		src += "\");\n";
	}

	src += indent(s_ind + 1) + "for( int k = 0; k < len; ++k)\n";
	src += indent(s_ind + 2) +   "for( std::set<BON::FCO>::iterator i = roles_vec[k].begin(); i != roles_vec[k].end(); ++i)\n";
	src += indent(s_ind + 2) +   "{\n";
	src += indent(s_ind + 3) +      retval_kind + " elem(*i);\n";
	src += indent(s_ind + 3) +      "ASSERT(elem);\n";
	src += indent(s_ind + 3) +      "res.insert(elem);\n";
	src += indent(s_ind + 2) +   "}\n";
	src += indent(s_ind + 1) + "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";	

	comm = "aggregated getter for role \"" + role_name + "\" among \"" + fco_name + "\"s and its descendants";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">"; 
	m.m_signature = method_name + "(" + dummy_str + ")";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;

	return;
}


/*static*/ void CodeGen::roleGetter4( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& desc_k_name, const std::string& role_name, Any * cont, Method& m)
{
	std::string src, comm;

	src  = indent(s_ind + 0) + "{\n";
	src += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(s_ind + 1) +   "std::set<BON::FCO> roles = getChildFCOsAs";
	src +=                       "(\"";
	src +=                              desc_k_name + role_name;
	src +=                       "\");\n";
	src += indent(s_ind + 1) +   "for( std::set<BON::FCO>::iterator i = roles.begin(); i != roles.end(); ++i)\n";
	src += indent(s_ind + 1) +   "{\n";
	src += indent(s_ind + 2) +     retval_kind + " elem(*i);\n";
	src += indent(s_ind + 2) +     "ASSERT(elem);\n";
	src += indent(s_ind + 2) +     "res.insert(elem);\n";
	src += indent(s_ind + 1) +   "}\n";
	src += indent(s_ind + 1) +   "return res;\n";
	src += indent(s_ind + 0) + "}\n\n\n";

	comm = "getter for role \"" + desc_k_name + role_name + "\" among \"" + fco_name + "\"s and its descendants";

	m.m_virtual = true;
	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = method_name + "()";
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = comm;

	return;
}


/*static*/ Method CodeGen::dumpGetInConnectionLinks( FCO *fco, ConnectionRep * conn)
{
	Method m;

	std::string mmm;

	mmm  = indent(s_ind + 0) + "{\n";
	mmm += indent(s_ind + 1) +   "std::set<" + conn->getDispName() + "> result;\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::Connection> conns = ConnectionEndImpl::getInConnLinks();\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::Connection>::iterator it = conns.begin();\n";
	mmm += indent(s_ind + 1) +   "for( ; it != conns.end(); ++it)\n";
	mmm += indent(s_ind + 1) +   "{\n";
	mmm += indent(s_ind + 2) +     conn->getDispName() + " c( *it);\n";
	mmm += indent(s_ind + 2) +     "if (c)\n";
	mmm += indent(s_ind + 3) +       "result.insert( c);\n";
	mmm += indent(s_ind + 1) +   "}\n";
	mmm += indent(s_ind + 1) +   "return result;\n";
	mmm += indent(s_ind + 0) + "}\n\n\n";

	m.m_signature = "getIn" + conn->getDispName() + "Links()";
	m.m_returnValue = "std::set<" + conn->getDispName() + ">";
	m.m_implementation = mmm;
	m.m_container = fco;
	m.m_comment = "";

	return m;
}



/*static*/ Method CodeGen::dumpGetOutConnectionLinks( FCO *fco, ConnectionRep * conn)
{
	Method m;

	std::string mmm;

	mmm  = indent(s_ind + 0) + "{\n";
	mmm += indent(s_ind + 1) +   "std::set<" + conn->getDispName() + "> result;\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::Connection> conns = ConnectionEndImpl::getOutConnLinks();\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::Connection>::iterator it = conns.begin();\n";
	mmm += indent(s_ind + 1) +   "for( ; it != conns.end(); ++it)\n";
	mmm += indent(s_ind + 1) +   "{\n";
	mmm += indent(s_ind + 2) +      conn->getDispName() + " c( *it);\n";
	mmm += indent(s_ind + 2) +      "if (c)\n";
	mmm += indent(s_ind + 3) +        "result.insert( c);\n";
	mmm += indent(s_ind + 1) +   "}\n";
	mmm += indent(s_ind + 1) +   "return result;\n";
	mmm += indent(s_ind + 0) + "}\n\n\n";

	m.m_signature = "getOut" + conn->getDispName() + "Links()";
	m.m_returnValue = "std::set<" + conn->getDispName() + ">";
	m.m_implementation = mmm;
	m.m_container = fco;
	m.m_comment = "";

	return m;
}



/*static*/ Method CodeGen::dumpGetBothConnectionLinks( FCO *fco, ConnectionRep * conn)
{
	Method m;

	std::string mmm;

	mmm  = indent(s_ind + 0) + "{\n";
	mmm += indent(s_ind + 1) +   "std::set<" + conn->getDispName() + "> result;\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::Connection> conns = ConnectionEndImpl::getConnLinks();\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::Connection>::iterator it = conns.begin();\n";
	mmm += indent(s_ind + 1) +   "for( ; it != conns.end(); ++it)\n";
	mmm += indent(s_ind + 1) +   "{\n";
	mmm += indent(s_ind + 2) +     conn->getDispName() + " c( *it);\n";
	mmm += indent(s_ind + 2) +     "if (c)\n";
	mmm += indent(s_ind + 3) +       "result.insert( c);\n";
	mmm += indent(s_ind + 1) +   "}\n";
	mmm += indent(s_ind + 1) +   "return result;\n";
	mmm += indent(s_ind + 0) + "}\n\n\n";

	m.m_signature = "get" + conn->getDispName() + "Links()";
	m.m_returnValue = "std::set<" + conn->getDispName() + ">";
	m.m_implementation = mmm;
	m.m_container = fco;
	m.m_comment = "";

	return m;
}


/*static*/ Method CodeGen::dumpGetInConnectionEnd( FCO *fco, FCO* peer, ConnectionRep* conn, bool peer_may_be_refport)
{
	Method m;
	std::string peer_lcd;
	if (peer)
		peer_lcd = peer->getDispName();
	else
		peer_lcd = "BON::FCO";

	std::string mmm, nnn;

	if ( peer_may_be_refport)
	{
		// if reference ports may be conn ends than the implementation is so simple
		nnn  = indent(s_ind + 0) + "{\n";
		nnn += indent(s_ind + 1) +   "return getInConnEnds(\"" + conn->getName() + "\");\n";
		nnn += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "get" + conn->getDispName() + "Srcs()";
		m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
		m.m_implementation = nnn;
		m.m_container = fco;
		m.m_comment = "returns src " + peer_lcd + "s and referenceports";
	}
	else
	{
		// if we know that no reference ports are between the connends
		mmm  = indent(s_ind + 0) + "{\n";
		mmm += indent(s_ind + 1) +   "std::multiset<" + peer_lcd + "> res;\n";
		mmm += indent(s_ind + 1) +   "{\n";
		// the name getInConnEnds is confusing but does the right thing
		mmm += indent(s_ind + 2) +     "std::multiset<BON::ConnectionEnd> in_ends = getInConnEnds(\"" + conn->getName() + "\");\n";
		mmm += indent(s_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cit = in_ends.begin() ; cit != in_ends.end() ; ++cit )\n";
		mmm += indent(s_ind + 2) +     "{\n";
		mmm += indent(s_ind + 3) +       peer_lcd + " dst( *cit );\n";
		mmm += indent(s_ind + 3) +       "ASSERT(dst);\n";
		mmm += indent(s_ind + 3) +       "res.insert( dst);\n";
		mmm += indent(s_ind + 2) +     "}\n";
		mmm += indent(s_ind + 1) +   "}\n";
		mmm += indent(s_ind + 1) +   "return res;\n";
		mmm += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "get" + conn->getDispName() + "Srcs()";
		m.m_returnValue = "std::multiset<" + peer_lcd + ">";
		m.m_implementation = mmm;
		m.m_container = fco;
		m.m_comment = "returns src " + peer_lcd + "s";
	}
	return m;
}



/*static*/ Method CodeGen::dumpGetOutConnectionEnd( FCO *fco, FCO* peer, ConnectionRep* conn, bool peer_may_be_refport)
{
	Method m;
	std::string peer_lcd;
	if (peer)
		peer_lcd = peer->getDispName();
	else
		peer_lcd = "BON::FCO";

	std::string mmm, nnn;

	if ( peer_may_be_refport)
	{
		nnn  = indent(s_ind + 0) + "{\n";
		nnn += indent(s_ind + 1) +   "return getOutConnEnds(\"" + conn->getName() + "\");\n";
		nnn += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "get" + conn->getDispName() + "Dsts()";
		m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
		m.m_implementation = nnn;
		m.m_container = fco;
		m.m_comment = "returns dst " + peer_lcd + "s and referenceports";
	}
	else
	{
		mmm  = indent(s_ind + 0) + "{\n";
		mmm += indent(s_ind + 1) +   "std::multiset<" + peer_lcd + "> res;\n";
		mmm += indent(s_ind + 1) +   "{\n";
		mmm += indent(s_ind + 2) +     "std::multiset<BON::ConnectionEnd> out_ends = getOutConnEnds(\"" + conn->getName() + "\");\n";
		mmm += indent(s_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cit = out_ends.begin() ; cit != out_ends.end() ; ++cit )\n";
		mmm += indent(s_ind + 2) +     "{\n";
		mmm += indent(s_ind + 3) +       peer_lcd + " dst( *cit );\n";
		mmm += indent(s_ind + 3) +       "ASSERT(dst);\n";
		mmm += indent(s_ind + 3) +       "res.insert( dst);\n";
		mmm += indent(s_ind + 2) +     "}\n";
		mmm += indent(s_ind + 1) +   "}\n";
		mmm += indent(s_ind + 1) +   "return res;\n";
		mmm += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "get" + conn->getDispName() + "Dsts()";
		m.m_returnValue = "std::multiset<" + peer_lcd + ">";
		m.m_implementation = mmm;
		m.m_container = fco;
		m.m_comment = "returns dst " + peer_lcd + "s";
	}

	return m;
}


/*static*/ Method CodeGen::dumpGetBothConnectionEnd( FCO *fco, FCO* peer, ConnectionRep* conn, bool peer_may_be_refport)
{
	Method m;
	std::string peer_lcd;
	if (peer)
		peer_lcd = peer->getDispName();
	else
		peer_lcd = "BON::FCO";

	std::string mmm, nnn;

	if ( peer_may_be_refport)
	{
		nnn  = indent(s_ind + 0) + "{\n";
		nnn += indent(s_ind + 1) +  "return getConnEnds(\"" + conn->getName() + "\");\n";
		nnn += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "get" + conn->getDispName() + "Ends()";
		m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
		m.m_implementation = nnn;
		m.m_container = fco;
		m.m_comment = "returns src and dst " + peer_lcd + "s and referenceports";
	}
	else
	{
		mmm += indent(s_ind + 0) + "{\n";
		mmm += indent(s_ind + 1) +   "std::multiset<" + peer_lcd + "> res;\n";
		mmm += indent(s_ind + 1) +   "{\n";
		mmm += indent(s_ind + 2) +     "std::multiset<BON::ConnectionEnd> in_ends = getInConnEnds(\"" + conn->getName() + "\");\n";
		mmm += indent(s_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cit = in_ends.begin() ; cit != in_ends.end() ; ++cit )\n";
		mmm += indent(s_ind + 2) +     "{\n";
		mmm += indent(s_ind + 3) +       peer_lcd + " dst( *cit );\n";
		mmm += indent(s_ind + 3) +       "ASSERT(dst);\n";
		mmm += indent(s_ind + 3) +       "res.insert( dst);\n";
		mmm += indent(s_ind + 2) +     "}\n";
		mmm += indent(s_ind + 2) +     "std::multiset<BON::ConnectionEnd> out_ends = getOutConnEnds(\"" + conn->getName() + "\");\n";
		mmm += indent(s_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cot = out_ends.begin() ; cot != out_ends.end() ; ++cot )\n";
		mmm += indent(s_ind + 2) +     "{\n";
		mmm += indent(s_ind + 3) +       peer_lcd + " dst( *cot );\n";
		mmm += indent(s_ind + 3) +       "ASSERT(dst);\n";
		mmm += indent(s_ind + 3) +       "res.insert( dst);\n";
		mmm += indent(s_ind + 2) +     "}\n";
		mmm += indent(s_ind + 1) +   "}\n";
		mmm += indent(s_ind + 1) +   "return res;\n";
		mmm += indent(s_ind + 0) + "}\n\n";

		m.m_signature = "get" + conn->getDispName() + "Ends()";
		m.m_returnValue = "std::multiset<" + peer_lcd + ">";
		m.m_implementation = mmm;
		m.m_container = fco;
		m.m_comment = "returns src and dst " + peer_lcd + "s";
	}
	return m;
}


/*static*/ Method CodeGen::dumpGetSrc( FCO *fco, ConnectionRep * conn, bool fco_may_be_refport)
{
	Method m;
	std::string oper1_lcd;
	if (fco && fco->isToBeEx())
		oper1_lcd = fco->getDispName();
	else if ( fco && fco->getExtedAnc())
		oper1_lcd = fco->getExtedAnc()->getDispName();
	else
		oper1_lcd = "BON::FCO";

	std::string mmm, nnn;

	if ( fco_may_be_refport)
	{
		nnn  = indent(s_ind + 0) + "{\n";
		nnn += indent(s_ind + 1) +   "return ConnectionImpl::getSrc();\n"; // otherwise recursive call resulted
		nnn += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "getSrc()";
		m.m_returnValue = "BON::ConnectionEnd";
		m.m_implementation = nnn;
		m.m_container = conn;
		m.m_comment = "getSrc() return value is a ConnectionEnd";
	}
	else
	{
		mmm  = indent(s_ind + 0) + "{\n";
		mmm += indent(s_ind + 1) +   "BON::ConnectionEnd ce = ConnectionImpl::getSrc();\n"; // otherwise recursive call resulted
		mmm += indent(s_ind + 1) +   oper1_lcd + " sp( ce);\n";
		mmm += indent(s_ind + 1) +   "if ( sp)\n";
		mmm += indent(s_ind + 2) +     "return sp;\n";
		mmm += indent(s_ind + 0) + "\n";
		mmm += indent(s_ind + 1) +   oper1_lcd + " empty;\n";
		mmm += indent(s_ind + 1) +   "return empty;\n";
		mmm += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "getSrc()";
		m.m_returnValue = oper1_lcd;
		m.m_implementation = mmm;
		m.m_container = conn;
		m.m_comment = "getSrc() return value is a ConnectionEnd casted to " + oper1_lcd;
	}
	return m;
}


/*static*/ Method CodeGen::dumpGetDst( FCO *fco, ConnectionRep * conn, bool fco_may_be_refport)
{
	Method m;
	std::string oper2_lcd;
	if (fco && fco->isToBeEx())
		oper2_lcd = fco->getDispName();
	else if ( fco && fco->getExtedAnc())
		oper2_lcd = fco->getExtedAnc()->getDispName();
	else
		oper2_lcd = "BON::FCO";

	std::string mmm, nnn;

	if ( fco_may_be_refport)
	{
		nnn  = indent(s_ind + 0) + "{\n";
		nnn += indent(s_ind + 1) +   "return ConnectionImpl::getDst();\n"; // otherwise recursive call would result
		nnn += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "getDst()";
		m.m_returnValue = "BON::ConnectionEnd";
		m.m_implementation = nnn;
		m.m_container = conn;
		m.m_comment = "getDst() return value is a ConnectionEnd";
	}
	else
	{
		mmm  = indent(s_ind + 0) + "{\n";
		mmm += indent(s_ind + 1) +   "BON::ConnectionEnd ce = ConnectionImpl::getDst();\n";
		mmm += indent(s_ind + 1) +   oper2_lcd + " sp( ce);\n";
		mmm += indent(s_ind + 1) +   "if ( sp)\n";
		mmm += indent(s_ind + 2) +     "return sp;\n";
		mmm += indent(s_ind + 0) + "\n";
		mmm += indent(s_ind + 1) +   oper2_lcd + " empty;\n";
		mmm += indent(s_ind + 1) +   "return empty;\n";
		mmm += indent(s_ind + 0) + "}\n\n\n";

		m.m_signature = "getDst()";
		m.m_returnValue = oper2_lcd;
		m.m_implementation = mmm;
		m.m_container = conn;
		m.m_comment = "getDst() return value is a ConnectionEnd casted to " + oper2_lcd;
	}
	return m;
}


/*static*/ Method CodeGen::dumpSetGetter( SetRep * cont, const FCO * fco, const std::string& common_kind, bool aggreg /*=false*/, bool dummy_par /*=false*/)
{
	ASSERT( fco || ( aggreg && !common_kind.empty())); //assert if fco is 0 and aggreg is false
	std::string retval_kind, kind; // the return value cannot be "Compound" if Compound is not extended

	if (fco)
	{
		retval_kind = kind = fco->getDispName();
		if ( !fco->isToBeEx()) 
		{
			FCO * ext_anc = fco->getExtedAnc();
			if ( ext_anc)
				retval_kind = ext_anc->getDispName();
			else
				retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
		}
	}
	else if ( !common_kind.empty()) // using the common_kind if set
		retval_kind = kind = "BON::" + common_kind;
	else // not intended for usage in such cases
		ASSERT(0);

	Method m;

	std::string mmm;
	mmm  = indent(s_ind + 0) + "{\n";
	mmm += indent(s_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::FCO> elems = getMembers();\n";
	mmm += indent(s_ind + 1) +   "std::set<BON::FCO>::iterator elem = elems.begin();\n";
	mmm += indent(s_ind + 1) +   "for( ; elem != elems.end(); ++elem)\n";
	mmm += indent(s_ind + 1) +   "{\n";
	mmm += indent(s_ind + 2) +     retval_kind + " r( *elem);\n";

	if ( fco)
	{
		if ( !aggreg) // not aggregated getter
		{
			mmm += indent(s_ind + 2) +   "if ( r && r->getObjectMeta().name() == \"" + fco->getDispName() + "\")\n";
		}
		else // aggregated getter, casting to the common base, which is not a common kind
		{
			mmm += indent(s_ind + 2) + "if ( r)\n";
		}
	}
	else // aggregated getter casting to the common kind
		mmm += indent(s_ind + 2) +   "if ( r)\n";

	mmm += indent(s_ind + 3) +       "res.insert( r);\n";
	mmm += indent(s_ind + 1) +   "}\n";
	mmm += indent(s_ind + 1) +   "return res;\n";
	mmm += indent(s_ind + 0) + "}\n\n\n";

	m.m_returnValue = "std::set<" + retval_kind + ">";
	m.m_signature = cont->setGetterTemplate( fco) + "(" + (dummy_par?" int dummy":"") + ")";
	m.m_implementation = mmm;
	m.m_container = cont;
	if ( !aggreg)
		m.m_comment = "specialized getter for " + fco->getDispName() + " setmembers";
	else //aggreg
		m.m_comment = "aggregated getter for setmembers";

	return m;
}




--- NEW FILE: CodeGenTemplate.cpp ---
#include "stdafx.h"
#include "CodeGen.h"
#include "Dumper.h"

/*const*/ extern int h_ind;

/*static*/ void CodeGen::folderGetterGeneric( const std::string& retval_folderkind, const std::string& folderkind, const std::string& method_name, bool extended, Any * cont, Method& m)
{
	std::string src, rtv, sgn;
	
	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_folderkind + ", T>";
	sgn  = method_name + "(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_folderkind + ", T> res;\n";
	src += indent(h_ind + 1) +   "std::set<BON::Folder> l = getChildFolders();\n";
	src += indent(h_ind + 1) +   "for( std::set<BON::Folder>::iterator i = l.begin(); i != l.end(); ++i)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +     retval_folderkind + " elem(*i);\n";

	if ( extended)
		src += indent(h_ind + 2) +   "if (elem)\n";
	else
		src += indent(h_ind + 2) +   "if (elem && elem->getObjectMeta().name() == \"" + folderkind + "\")\n";

	src += indent(h_ind + 3) +       "res.insert(elem);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_container = cont;
	m.m_template = true;
	m.m_virtual = false;
	m.m_returnValue = rtv;
	m.m_signature = sgn;
	m.m_implementation = src;
	m.m_comment = "getter for subfolder \"" + folderkind + "\"";

	return;
}


/*static*/ void CodeGen::kindGetter1Generic( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m)
{
	std::string src, rtv, sgn;;
	
	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) +   "std::set<BON::Object> kinds = getChildObjects(\"" + kind + "\");\n";
	src += indent(h_ind + 1) +   "for( std::set<BON::Object>::iterator i = kinds.begin(); i != kinds.end(); ++i)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +     retval_kind + " elem(*i);\n";
	src += indent(h_ind + 2) +     "ASSERT(elem);\n";
	src += indent(h_ind + 2) +     "res.insert(elem);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_template = true;
	m.m_virtual = false;
	m.m_returnValue = rtv;
	m.m_signature = sgn;
	m.m_implementation = src;
	m.m_comment = "getter for kind \"" + kind + "\"";
	m.m_container = cont;

	return;
}


/*static*/ void CodeGen::kindGetter2Generic( const std::string& retval_kind, const std::string& kind, const std::vector< std::string>& kind_vec, const std::string& method_name, Any * cont, Method& m)
{
	std::string src, rtv, sgn;;

	// the number of non-abstract fcos
	char len_s[10]; sprintf(len_s, "%u", kind_vec.size()); std::string len_str( len_s);
	
	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) +   "const int len = " + len_str + ";\n";
	src += indent(h_ind + 1) +   "std::set<BON::Object> kinds_vec[ len];\n";
	
	for( int k = 0; k < kind_vec.size(); ++k)
	{
		char k_s[10]; sprintf( k_s, "%i", k); std::string k_str( k_s);
		src += indent(h_ind + 1) + "kinds_vec[" + k_str + "] = getChildObjects";
		src += "(\"" + kind_vec[k] + "\");\n";
	}
	src += indent(h_ind + 1) + "for( int k = 0; k < len; ++k)\n";
	src += indent(h_ind + 2) +   "for( std::set<BON::Object>::iterator i = kinds_vec[k].begin(); i != kinds_vec[k].end(); ++i)\n";
	src += indent(h_ind + 2) +   "{\n";
	src += indent(h_ind + 3) +     retval_kind + " elem(*i);\n";
	src += indent(h_ind + 3) +     "ASSERT(elem);\n";
	src += indent(h_ind + 3) +     "res.insert(elem);\n";
	src += indent(h_ind + 2) +   "}\n";
	src += indent(h_ind + 1) + "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_template = true;
	m.m_virtual = false;
	m.m_returnValue = rtv;
	m.m_signature = sgn;
	m.m_implementation = src;
	m.m_comment = "aggregated getter for kind \"" + kind + "\" and its descendants";
	m.m_container = cont;
}


/*static*/ void CodeGen::kindGetter3Generic( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m)
{
	// currently not used
	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "_Excl(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) + "  std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) + "  std::set<Object> l = getChildObjects(\"" + kind + "\");\n";
	src += indent(h_ind + 1) + "  for( std::set<Object>::iterator i = l.begin(); i != l.end(); ++i)\n";
	src += indent(h_ind + 1) + "  {\n";
	src += indent(h_ind + 2) + "     " + retval_kind + " elem(*i);\n";
	src += indent(h_ind + 2) + "     ASSERT(elem);\n";
	src += indent(h_ind + 2) + "     res.insert(elem);\n";
	src += indent(h_ind + 1) + "  }\n";
	src += indent(h_ind + 1) + "  return res;\n";
	src += indent(h_ind + 0) + "}\n";	

	m.m_template = true;
	m.m_virtual = false;
	m.m_returnValue = rtv;
	m.m_signature = sgn;
	m.m_implementation = src;
	m.m_container = cont;
	m.m_comment = "EXCL getter for kind \"" + kind + "\"";
}




/*static*/ void CodeGen::roleGetter1Generic( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& tm)
{
	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) +   "std::set<BON::FCO> roles = getChildFCOsAs(\"" + inquire + "\");\n";
	src += indent(h_ind + 1) +   "for( std::set<BON::FCO>::iterator i = roles.begin(); i != roles.end(); ++i)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +       retval_kind + " elem(*i);\n";
	src += indent(h_ind + 2) +      "ASSERT(elem);\n";
	src += indent(h_ind + 2) +      "res.insert(elem);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	tm.m_virtual = false;
	tm.m_template = true;
	tm.m_returnValue = rtv;
	tm.m_signature = sgn;
	tm.m_implementation = src;
	tm.m_container = cont;
	tm.m_comment = "getter for role \"" + inquire + "\" among \"" + fco_name + "\"s";

	return;
}


/*static*/ void CodeGen::roleGetter2Generic( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& tm)
{
	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) +   "std::set<BON::FCO> roles = getChildFCOsAs(\"" + inquire + "\");\n";
	src += indent(h_ind + 1) +   "for( std::set<BON::FCO>::iterator i = roles.begin(); i != roles.end(); ++i)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +      retval_kind + " elem(*i);\n";
	src += indent(h_ind + 2) +      "ASSERT(elem);\n";
	src += indent(h_ind + 2) +      "res.insert(elem);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	tm.m_virtual = false;
	tm.m_template = true;
	tm.m_returnValue = rtv;
	tm.m_signature = sgn;
	tm.m_implementation = src;
	tm.m_container = cont;
	tm.m_comment = "getter for role \"" + inquire + "\" among \"" + fco_name + "\"s";

	return;
}


/*static*/ void CodeGen::roleGetter3Generic( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& role_name, const std::vector< std::string > & roles, const std::string& dummy_str, Any * cont, Method& tm)
{
	std::string src, rtv, sgn, comm;

	char len_s[10]; sprintf(len_s, "%u", roles.size()); std::string len_str( len_s);

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "(TDP" + ((dummy_str.empty())?"":", ") + dummy_str + ")";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) + "std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) + "const int len = " + len_str + ";\n";
	src += indent(h_ind + 1) + "std::set<BON::FCO> roles_vec[ len];\n";
	
	for( int k = 0; k < roles.size(); ++k)
	{
		char k_s[10]; sprintf( k_s, "%i", k); std::string k_str( k_s);
		src += indent(h_ind + 1) + "roles_vec[" + k_str + "] = getChildFCOsAs(\"" + roles[k] + "\");\n";
	}

	src += indent(h_ind + 1) + "for( int k = 0; k < len; ++k)\n";
	src += indent(h_ind + 2) +   "for( std::set<BON::FCO>::iterator i = roles_vec[k].begin(); i != roles_vec[k].end(); ++i)\n";
	src += indent(h_ind + 2) +   "{\n";
	src += indent(h_ind + 3) +      retval_kind + " elem(*i);\n";
	src += indent(h_ind + 3) +      "ASSERT(elem);\n";
	src += indent(h_ind + 3) +      "res.insert(elem);\n";
	src += indent(h_ind + 2) +   "}\n";
	src += indent(h_ind + 1) + "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	tm.m_virtual = false;
	tm.m_template = true;
	tm.m_returnValue = rtv;
	tm.m_signature = sgn;
	tm.m_implementation = src;
	tm.m_container = cont;
	tm.m_comment = "aggregated getter for role \"" + role_name + "\" among \"" + fco_name + "\"s and its descendants";

	return;
}


/*static*/ void CodeGen::roleGetter4Generic( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& desc_k_name, const std::string& role_name, Any * cont, Method& tm)
{
	std::string src, rtv, sgn, comm;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ", T>";
	sgn  = method_name + "(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_kind + ", T> res;\n";
	src += indent(h_ind + 1) +   "std::set<BON::FCO> roles = getChildFCOsAs(\"" + desc_k_name + role_name + "\");\n";
	src += indent(h_ind + 1) +   "for( std::set<BON::FCO>::iterator i = roles.begin(); i != roles.end(); ++i)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +     retval_kind + " elem(*i);\n";
	src += indent(h_ind + 2) +     "ASSERT(elem);\n";
	src += indent(h_ind + 2) +     "res.insert(elem);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	tm.m_virtual = false;
	tm.m_template = true;
	tm.m_returnValue = rtv;
	tm.m_signature = sgn;
	tm.m_implementation = src;
	tm.m_container = cont;
	tm.m_comment = "getter for role \"" + desc_k_name + role_name + "\" among \"" + fco_name + "\"s and its descendants";

	return;
}


/*static*/ Method CodeGen::dumpGetInConnectionLinksGeneric( FCO *fco, ConnectionRep * conn)
{
	Method m;

	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + conn->getDispName() + ", T>";
	sgn  = "getIn" + conn->getDispName() + "Links(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + conn->getDispName() + ", T> result;\n";
	src += indent(h_ind + 1) +   "std::set<BON::Connection> conns = ConnectionEndImpl::getInConnLinks();\n";
	src += indent(h_ind + 1) +   "std::set<BON::Connection>::iterator it = conns.begin();\n";
	src += indent(h_ind + 1) +   "for( ; it != conns.end(); ++it)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +      conn->getDispName() + " c( *it);\n";
	src += indent(h_ind + 2) +      "if (c)\n";
	src += indent(h_ind + 3) +        "result.insert( c);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return result;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_virtual = false;
	m.m_template = true;
	m.m_signature = sgn;
	m.m_returnValue = rtv;
	m.m_implementation = src;
	m.m_container = fco;
	m.m_comment = "";

	return m;
}

/*static*/ Method CodeGen::dumpGetOutConnectionLinksGeneric( FCO *fco, ConnectionRep * conn)
{
	Method m;

	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + conn->getDispName() + ", T>";
	sgn  = "getOut" + conn->getDispName() + "Links(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + conn->getDispName() + ", T> result;\n";
	src += indent(h_ind + 1) +   "std::set<BON::Connection> conns = ConnectionEndImpl::getOutConnLinks();\n";
	src += indent(h_ind + 1) +   "std::set<BON::Connection>::iterator it = conns.begin();\n";
	src += indent(h_ind + 1) +   "for( ; it != conns.end(); ++it)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +      conn->getDispName() + " c( *it);\n";
	src += indent(h_ind + 2) +      "if (c)\n";
	src += indent(h_ind + 3) +        "result.insert( c);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return result;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_virtual = false;
	m.m_template = true;
	m.m_signature = sgn;
	m.m_returnValue = rtv;
	m.m_implementation = src;
	m.m_container = fco;
	m.m_comment = "";

	return m;
}

/*static*/ Method CodeGen::dumpGetBothConnectionLinksGeneric( FCO *fco, ConnectionRep * conn)
{
	Method m;

	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + conn->getDispName() + ", T>";
	sgn  = "get" + conn->getDispName() + "Links(TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + conn->getDispName() + ", T> result;\n";
	src += indent(h_ind + 1) +   "std::set<BON::Connection> conns = ConnectionEndImpl::getConnLinks();\n";
	src += indent(h_ind + 1) +   "std::set<BON::Connection>::iterator it = conns.begin();\n";
	src += indent(h_ind + 1) +   "for( ; it != conns.end(); ++it)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +      conn->getDispName() + " c( *it);\n";
	src += indent(h_ind + 2) +      "if (c)\n";
	src += indent(h_ind + 3) +        "result.insert( c);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return result;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_virtual = false;
	m.m_template = true;
	m.m_signature = sgn;
	m.m_returnValue = rtv;
	m.m_implementation = src;
	m.m_container = fco;
	m.m_comment = "";

	return m;
}


/*static*/ Method CodeGen::dumpGetInConnectionEndGeneric( FCO *fco, FCO* peer, ConnectionRep* conn, bool peer_may_be_refport)
{
	Method m;
	std::string peer_lcd;
	if (peer)
		peer_lcd = peer->getDispName();
	else
		peer_lcd = "BON::FCO";

	std::string src, rtv, sgn;

	if ( peer_may_be_refport)
	{
		// if reference ports may be conn ends than the implementation is so simple
		rtv  = indent(h_ind + 0) + "template <class T>\n";
		rtv += indent(h_ind + 0) + "std::multiset<BON::ConnectionEnd, T>";
		sgn  = "get" + conn->getDispName() + "Srcs(TDP)";
		src  = indent(h_ind + 0) + "{\n";
		src += indent(h_ind + 1) +   "std::multiset<BON::ConnectionEnd> ends = getInConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 1) +   "return std::multiset<BON::ConnectionEnd, T>( ends.begin(), ends.end());\n";
		src += indent(h_ind + 0) + "}\n";
		
		m.m_virtual = false;
		m.m_template = true;
		m.m_signature = sgn;
		m.m_returnValue = rtv;
		m.m_implementation = src;
		m.m_container = fco;
		m.m_comment = "returns src " + peer_lcd + "s and referenceports";
	}
	else
	{
		// if we know that no reference ports are between the connends
		rtv  = indent(h_ind + 0) + "template <class T>\n";
		rtv += indent(h_ind + 0) + "std::multiset<" + peer_lcd + ", T>";
		sgn  = "get" + conn->getDispName() + "Srcs(TDP)";
		src  = indent(h_ind + 0) + "{\n";
		src += indent(h_ind + 1) +   "std::multiset<" + peer_lcd + ", T> res;\n";
		src += indent(h_ind + 1) +   "{\n";
		// the name getInConnEnds is confusing but does the right thing
		src += indent(h_ind + 2) +     "std::multiset<BON::ConnectionEnd> in_ends = getInConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cit = in_ends.begin() ; cit != in_ends.end() ; ++cit )\n";
		src += indent(h_ind + 2) +     "{\n";
		src += indent(h_ind + 3) +       peer_lcd + " dst( *cit );\n";
		src += indent(h_ind + 3) +       "ASSERT(dst);\n";
		src += indent(h_ind + 3) +       "res.insert( dst);\n";
		src += indent(h_ind + 2) +     "}\n";
		src += indent(h_ind + 1) +   "}\n";
		src += indent(h_ind + 1) +   "return res;\n";
		src += indent(h_ind + 0) + "}\n";

		m.m_virtual = false;
		m.m_template = true;
		m.m_signature = sgn;
		m.m_returnValue = rtv;
		m.m_implementation = src;
		m.m_container = fco;
		m.m_comment = "returns src " + peer_lcd + "s";;
	}
	return m;
}

/*static*/ Method CodeGen::dumpGetOutConnectionEndGeneric( FCO *fco, FCO* peer, ConnectionRep* conn, bool peer_may_be_refport)
{
	Method m;
	std::string peer_lcd;
	if (peer)
		peer_lcd = peer->getDispName();
	else
		peer_lcd = "BON::FCO";

	std::string src, rtv, sgn;

	if ( peer_may_be_refport)
	{
		// if reference ports may be conn ends than the implementation is so simple
		rtv  = indent(h_ind + 0) + "template <class T>\n";
		rtv += indent(h_ind + 0) + "std::multiset<BON::ConnectionEnd, T>";
		sgn  = "get" + conn->getDispName() + "Dsts(TDP)";
		src  = indent(h_ind + 0) + "{\n";
		src += indent(h_ind + 1) +   "std::multiset<BON::ConnectionEnd> ends = getOutConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 1) +   "return std::multiset<BON::ConnectionEnd, T>( ends.begin(), ends.end());\n";
		src += indent(h_ind + 0) + "}\n";

		
		m.m_virtual = false;
		m.m_template = true;
		m.m_signature = sgn;
		m.m_returnValue = rtv;
		m.m_implementation = src;
		m.m_container = fco;
		m.m_comment = "returns dst " + peer_lcd + "s and referenceports";
	}
	else
	{
		// if we know that no reference ports are between the connends
		rtv  = indent(h_ind + 0) + "template <class T>\n";
		rtv += indent(h_ind + 0) + "std::multiset<" + peer_lcd + ", T>";
		sgn  = "get" + conn->getDispName() + "Dsts(TDP)";
		src  = indent(h_ind + 0) + "{\n";
		src += indent(h_ind + 1) +   "std::multiset<" + peer_lcd + ", T> res;\n";
		src += indent(h_ind + 1) +   "{\n";
		// the name getOutConnEnds is confusing but does the right thing
		src += indent(h_ind + 2) +     "std::multiset<BON::ConnectionEnd> out_ends = getOutConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cit = out_ends.begin() ; cit != out_ends.end() ; ++cit )\n";
		src += indent(h_ind + 2) +     "{\n";
		src += indent(h_ind + 3) +       peer_lcd + " dst( *cit );\n";
		src += indent(h_ind + 3) +       "ASSERT(dst);\n";
		src += indent(h_ind + 3) +       "res.insert( dst);\n";
		src += indent(h_ind + 2) +     "}\n";
		src += indent(h_ind + 1) +   "}\n";
		src += indent(h_ind + 1) +   "return res;\n";
		src += indent(h_ind + 0) + "}\n";

		m.m_virtual = false;
		m.m_template = true;
		m.m_signature = sgn;
		m.m_returnValue = rtv;
		m.m_implementation = src;
		m.m_container = fco;
		m.m_comment = "returns dst " + peer_lcd + "s";
	}
	return m;
}


/*static*/ Method CodeGen::dumpGetBothConnectionEndGeneric( FCO *fco, FCO* peer, ConnectionRep* conn, bool peer_may_be_refport)
{
	Method m;
	std::string peer_lcd;
	if (peer)
		peer_lcd = peer->getDispName();
	else
		peer_lcd = "BON::FCO";

	std::string src, rtv, sgn;

	if ( peer_may_be_refport)
	{
		// if reference ports may be conn ends than the implementation is so simple
		rtv  = indent(h_ind + 0) + "template <class T>\n";
		rtv += indent(h_ind + 0) + "std::multiset<BON::ConnectionEnd, T>";
		sgn  = "get" + conn->getDispName() + "Ends(TDP)";
		src  = indent(h_ind + 0) + "{\n";
		src += indent(h_ind + 1) +   "std::multiset<BON::ConnectionEnd> ends = getConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 1) +   "return std::multiset<BON::ConnectionEnd, T>( ends.begin(), ends.end());\n";
		src += indent(h_ind + 0) + "}\n";
		
		
		m.m_virtual = false;
		m.m_template = true;
		m.m_signature = sgn;
		m.m_returnValue = rtv;
		m.m_implementation = src;
		m.m_container = fco;
		m.m_comment = "returns src and dst " + peer_lcd + "s and referenceports";
	}
	else
	{
		rtv  = indent(h_ind + 0) + "template <class T>\n";
		rtv += indent(h_ind + 0) + "std::multiset<" + peer_lcd + ", T>";
		sgn  = "get" + conn->getDispName() + "Ends(TDP)";
		src  = indent(h_ind + 0) + "{\n";
		src += indent(h_ind + 1) +   "std::multiset<" + peer_lcd + ", T> res;\n";
		src += indent(h_ind + 1) +   "{\n";
		src += indent(h_ind + 2) +     "std::multiset<BON::ConnectionEnd> in_ends = getInConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cit = in_ends.begin() ; cit != in_ends.end() ; ++cit )\n";
		src += indent(h_ind + 2) +     "{\n";
		src += indent(h_ind + 3) +       peer_lcd + " dst( *cit );\n";
		src += indent(h_ind + 3) +       "ASSERT(dst);\n";
		src += indent(h_ind + 3) +       "res.insert( dst);\n";
		src += indent(h_ind + 2) +     "}\n";
		src += indent(h_ind + 2) +     "std::multiset<BON::ConnectionEnd> out_ends = getOutConnEnds(\"" + conn->getName() + "\");\n";
		src += indent(h_ind + 2) +     "for ( std::multiset<BON::ConnectionEnd>::iterator cot = out_ends.begin() ; cot != out_ends.end() ; ++cot )\n";
		src += indent(h_ind + 2) +     "{\n";
		src += indent(h_ind + 3) +       peer_lcd + " dst( *cot );\n";
		src += indent(h_ind + 3) +       "ASSERT(dst);\n";
		src += indent(h_ind + 3) +       "res.insert( dst);\n";
		src += indent(h_ind + 2) +     "}\n";
		src += indent(h_ind + 1) +   "}\n";
		src += indent(h_ind + 1) +   "return res;\n";
		src += indent(h_ind + 0) + "}\n";

		m.m_virtual = false;
		m.m_template = true;
		m.m_signature = sgn;
		m.m_returnValue = rtv;
		m.m_implementation = src;
		m.m_container = fco;
		m.m_comment = "returns src and dst " + peer_lcd + "s";
	}
	return m;
}


/*static*/ Method CodeGen::dumpSetGetterGeneric( SetRep * cont, const FCO * fco, const std::string& common_kind, bool aggreg /*=false*/, bool dummy_par /*=false*/)
{
	ASSERT( fco || ( aggreg && !common_kind.empty())); //assert if fco is 0 and aggreg is false
	std::string retval_kind, kind; // the return value cannot be "Compound" if Compound is not extended

	if (fco)
	{
		retval_kind = kind = fco->getDispName();
		if ( !fco->isToBeEx()) 
		{
			FCO * ext_anc = fco->getExtedAnc();
			if ( ext_anc)
				retval_kind = ext_anc->getDispName();
			else
				retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
		}
	}
	else if ( !common_kind.empty()) // using the common_kind if set
		retval_kind = kind = "BON::" + common_kind;
	else // not intended for usage in such cases
		ASSERT(0);

	Method m;

	std::string src, rtv, sgn;

	rtv  = indent(h_ind + 0) + "template <class T>\n";
	rtv += indent(h_ind + 0) + "std::set<" + retval_kind + ">";
	sgn  = cont->setGetterTemplate( fco) + "(" + (dummy_par?" int dummy, ":"") + "TDP)";
	src  = indent(h_ind + 0) + "{\n";
	src += indent(h_ind + 1) +   "std::set<" + retval_kind + "> res;\n";
	src += indent(h_ind + 1) +   "std::set<BON::FCO> elems = getMembers();\n";
	src += indent(h_ind + 1) +   "std::set<BON::FCO>::iterator elem = elems.begin();\n";
	src += indent(h_ind + 1) +   "for( ; elem != elems.end(); ++elem)\n";
	src += indent(h_ind + 1) +   "{\n";
	src += indent(h_ind + 2) +     retval_kind + " r( *elem);\n";

	if ( fco)
	{
		if ( !aggreg) // not aggregated getter
		{
			src += indent(h_ind + 2) +   "if ( r && r->getObjectMeta().name() == \"" + fco->getDispName() + "\")\n";
		}
		else // aggregated getter, casting to the common base, which is not a common kind
		{
			src += indent(h_ind + 2) + "if ( r)\n";
		}
	}
	else // aggregated getter casting to the common kind
		src += indent(h_ind + 2) +   "if ( r)\n";

	src += indent(h_ind + 3) +       "res.insert( r);\n";
	src += indent(h_ind + 1) +   "}\n";
	src += indent(h_ind + 1) +   "return res;\n";
	src += indent(h_ind + 0) + "}\n";

	m.m_virtual = false;
	m.m_template = true;
	m.m_returnValue = rtv;
	m.m_signature = sgn;
	m.m_implementation = src;
	m.m_container = cont;
	if ( !aggreg)
		m.m_comment = "specialized getter for " + fco->getDispName() + " setmembers";
	else //aggreg
		m.m_comment = "aggregated getter for setmembers";

	return m;
}


Index: Any.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Any.cpp	6 May 2004 22:30:26 -0000	1.8
--- Any.cpp	16 Jun 2004 18:35:02 -0000	1.9
***************
*** 6,9 ****
--- 6,11 ----
  #include "Any.h"
  #include "CodeGen.h"
+ #include "Method.h"
+ #include "Dumper.h"
  
  #include "algorithm"
***************
*** 238,244 ****
--- 240,267 ----
  
  
+ void Any::prepareIniFin()
+ {
+ 	Method i;
+ 
+ 	i.m_container = this;
+ 	i.m_virtual = true;
+ 	i.m_returnValue = "void";
+ 	i.m_signature = "initialize() { }";
+ 	i.m_implementation = "";
+ 	i.m_comment = "";
+ 
+ 
+ 	if ( Dumper::m_bGenInit)		m_inifinMethods.push_back( i);
+ 
+ 	i.m_signature = "finalize() { }";
+ 
+ 	if ( Dumper::m_bGenFinalize)	m_inifinMethods.push_back( i);
+ }
+ 
+ 
  void Any::prepare()
  {
  	prepareMacros();
+ 	prepareIniFin();
  }
  
***************
*** 267,270 ****
--- 290,296 ----
  	h_file += "class " + getDispNameImpl();
  	h_file += dumpClassHeader() + "{\npublic:\n";
+ 
+ 	for( unsigned int k = 0; k < m_inifinMethods.size(); ++k)
+ 		h_file += m_inifinMethods[k].getHeader() + "\n";
  }
  
***************
*** 281,285 ****
  	// to prevent confusing with predefinitions like "class X;"
  	// the canonical form is "class X :"
! 	return " :\n  public BON::" + getMyKindStr() + "Impl\n";
  	//return " :\n  public /*Ex*/ BON::" + getMyKindStr() + "Impl\n";
  }
--- 307,311 ----
  	// to prevent confusing with predefinitions like "class X;"
  	// the canonical form is "class X :"
! 	return " :\n\t  public BON::" + getMyKindStr() + "Impl\n";
  	//return " :\n  public /*Ex*/ BON::" + getMyKindStr() + "Impl\n";
  }

Index: Any.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Any.h	17 Mar 2004 00:24:14 -0000	1.5
--- Any.h	16 Jun 2004 18:35:02 -0000	1.6
***************
*** 9,13 ****
  #include "vector"
  #include "logger.h"
! 
  /** This class is the abstract base of all kinds of parts/FCOs that can occur during a modeling process. */
  class Any;
--- 9,13 ----
  #include "vector"
  #include "logger.h"
! class Method;
  /** This class is the abstract base of all kinds of parts/FCOs that can occur during a modeling process. */
  class Any;
***************
*** 79,82 ****
--- 79,83 ----
  	virtual void prepare();
  	virtual void prepareMacros();
+ 	virtual void prepareIniFin();
  
  	void dumpGlobals();
***************
*** 108,111 ****
--- 109,113 ----
  	bool m_toEx;
  
+ 	std::vector< Method > m_inifinMethods;
  	std::string m_globalHeader;
  	std::string m_globalSource;

Index: AttributeRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/AttributeRep.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AttributeRep.cpp	11 Mar 2004 15:53:21 -0000	1.7
--- AttributeRep.cpp	16 Jun 2004 18:35:02 -0000	1.8
***************
*** 28,33 ****
  bool AttributeRep::isGlobal()
  {
! 	BON::FCO bon_ptr = static_cast<BON::FCO>(this->m_ptr);
! 	return bon_ptr->getAttribute("GlobalScope")->getBooleanValue();
  }
  
--- 28,32 ----
  bool AttributeRep::isGlobal()
  {
! 	return m_ptr->getAttribute("GlobalScope")->getBooleanValue();
  }
  
***************
*** 35,40 ****
  bool AttributeRep::isViewable()
  {
! 	BON::FCO bon_ptr = static_cast<BON::FCO>(this->m_ptr);
! 	return bon_ptr->getAttribute("IsViewable")->getBooleanValue();
  }
  
--- 34,38 ----
  bool AttributeRep::isViewable()
  {
! 	return m_ptr->getAttribute("IsViewable")->getBooleanValue();
  }
  
***************
*** 42,47 ****
  std::string AttributeRep::getPrompt()
  {
! 	BON::FCO bon_ptr = static_cast<BON::FCO>(this->m_ptr);
! 	return bon_ptr->getAttribute("Prompt")->getStringValue();
  }
  
--- 40,44 ----
  std::string AttributeRep::getPrompt()
  {
! 	return m_ptr->getAttribute("Prompt")->getStringValue();
  }
  
***************
*** 94,100 ****
  elem4,				-global_vars.error case
  */
! 	BON::FCO bon_ptr = static_cast<BON::FCO>(this->m_ptr);
! 
! 	std::string items = bon_ptr->getAttribute("MenuItems")->getStringValue();
  
  	items += '\n'; // like an EOF sign
--- 91,95 ----
  elem4,				-global_vars.error case
  */
! 	std::string items = m_ptr->getAttribute("MenuItems")->getStringValue();
  
  	items += '\n'; // like an EOF sign
***************
*** 166,170 ****
  	}
  
! 	std::string def_item = bon_ptr->getAttribute("DefaultItem")->getStringValue();
  
  	bool found ( false);
--- 161,165 ----
  	}
  
! 	std::string def_item = m_ptr->getAttribute("DefaultItem")->getStringValue();
  
  	bool found ( false);
***************
*** 204,207 ****
--- 199,208 ----
  
  
+ /*virtual*/ std::string EnumAttributeRep::getSetMethodName()
+ {
+ 	return "set" + getNameToUse();
+ }
+ 
+ 
  Method EnumAttributeRep::createMethodForAttr( FCO * container)
  {
***************
*** 228,232 ****
  	mmm += "\n" + CodeGen::indent(1) + "} " + EnumAttributeRep::enumTypeName( this) + ";\n";
  
!   container->addClassGlobal( mmm);
  
  	std::string src;
--- 229,233 ----
  	mmm += "\n" + CodeGen::indent(1) + "} " + EnumAttributeRep::enumTypeName( this) + ";\n";
  
! 	container->addClassGlobal( mmm);
  
  	std::string src;
***************
*** 271,274 ****
--- 272,312 ----
  
  
+ Method EnumAttributeRep::createSetMethodForAttr( FCO * container)
+ {
+ 	// we presume that the getter generator is called before this setter generator
+ 	// for getMenuItems() 's sake
+ 	Method m2;
+ 	if (m_noOfItems == 0) return m2;//throw("Enumtype is empty");
+ 
+ 	std::string src;
+ 
+ 	src  = CodeGen::indent(0) + "{\n";
+ 	src += CodeGen::indent(1) + "std::string str_val = \"\";\n\n";
+ 
+ 	for( int i = 0; i < m_noOfItems; ++i)
+ 	{
+ 		std::string item_i = m_itemsVal[i] + '_' + EnumAttributeRep::enumTypeName( this);
+ 		if ( !Any::checkIfValidName( item_i))
+ 			Any::convertToValidName( item_i);
+ 
+ 		src += CodeGen::indent(1);
+ 		if ( i != 0) src += "else ";
+ 		src += "if ( val == " + item_i + ") str_val = \"" + m_itemsVal[i] + "\";\n";
+ 	}
+ 	src += CodeGen::indent(1) + "else throw(\"None of the possible items\");\n";
+ 	src += "\n";
+ 	src += CodeGen::indent(1) + "FCOImpl::getAttribute(\"" + getName() + "\")->setStringValue( str_val);\n";
+ 	src += "}\n\n\n";
+ 
+ 	m2.m_returnValue = "void";
+ 	m2.m_signature = getSetMethodName() + "( " + container->getDispNameImpl() + "::" + EnumAttributeRep::enumTypeName( this) + " val)";
+ 	m2.m_container = container;
+ 	m2.m_implementation = src;
+ 	m2.m_comment = "";
+ 
+ 	return m2;
+ }
+ 
+ 
  /*virtual*/ std::string EnumAttributeRep::doDumpErroneousAttrHdr()
  {
***************
*** 279,282 ****
--- 317,330 ----
  	hdr += " }\n";
  
+ 	// the signature has to match the parent's getter's in order to override it
+ 	hdr += "\n";
+ 	//hdr += CodeGen::indent(1) + "/*virtual*/ inline void " + getSetMethodName() + "(" + container->getDispNameImpl() + "::" + EnumAttributeRep::enumTypeName( this) + " val)";
+ 	// but the container ptr is not available here, we presume that the current object has the enum values
+ 	// inherited in its own scope
+ 	hdr += CodeGen::indent(1) + "/*virtual*/ inline void " + getSetMethodName() + "(" + EnumAttributeRep::enumTypeName( this) + " val)";
+ 	hdr += "{ ";
+ 	hdr += "throw std::string(\"Interface inherited kind. \" + getName() + \" doesn't have " + getNameToUse() + " attribute\");";
+ 	hdr += " }\n";
+ 
  	return hdr;
  }
***************
*** 295,298 ****
--- 343,352 ----
  
  
+ /*virtual*/ std::string BoolAttributeRep::getSetMethodName()
+ {
+ 	return "set" + getNameToUse();
+ }
+ 
+ 
  Method BoolAttributeRep::createMethodForAttr( FCO * container)
  {
***************
*** 305,309 ****
  
  	m.m_returnValue = "bool";
! 	m.m_signature = getMethodName() + "()";
  	m.m_implementation = src;
  	m.m_container = container;
--- 359,380 ----
  
  	m.m_returnValue = "bool";
! 	m.m_signature = getMethodName() + "() ";
! 	m.m_implementation = src;
! 	m.m_container = container;
! 	m.m_comment = "";
! 	return m;
! }
! 
! 
! Method BoolAttributeRep::createSetMethodForAttr( FCO * container)
! {
! 	Method m;
! 	std::string src;
! 	src  = CodeGen::indent(0) + "{\n";
! 	src += CodeGen::indent(1) +   "FCOImpl::getAttribute(\"" + getName() + "\")->setBooleanValue( val);\n";
! 	src += CodeGen::indent(0) + "}\n\n\n";
! 
! 	m.m_returnValue = "void";
! 	m.m_signature = getSetMethodName() + "( bool val)";
  	m.m_implementation = src;
  	m.m_container = container;
***************
*** 321,324 ****
--- 392,403 ----
  	hdr += "}\n";
  
+ 	// the signature has to match the parent's getter's in order to override it
+ 	hdr += "\n";
+ 	hdr += CodeGen::indent(1) + "/*virtual*/ inline void " + getSetMethodName() + "( bool) ";
+ 	hdr += "{";
+ 	hdr += "throw std::string(\"Interface inherited kind. \" + getName() + \" doesn't have " + getNameToUse() + " attribute\");";
+ 	hdr += "}\n";
+ 
+ 
  	return hdr;
  }
***************
*** 338,345 ****
  
  
  std::string FieldAttributeRep::getTypeStr()
  {
! 	BON::FCO bon_ptr = static_cast<BON::FCO>(this->m_ptr);
! 	std::string val_type = bon_ptr->getAttribute("DataType")->getStringValue();
  	if ( val_type == "integer")
  		return "long";
--- 417,429 ----
  
  
+ /*virtual*/ std::string FieldAttributeRep::getSetMethodName()
+ {
+ 	return "set" + getNameToUse();
+ }
+ 
+ 
  std::string FieldAttributeRep::getTypeStr()
  {
! 	std::string val_type = m_ptr->getAttribute("DataType")->getStringValue();
  	if ( val_type == "integer")
  		return "long";
***************
*** 349,353 ****
  		return "std::string";
  
! 	return "global_vars.error";
  }
  
--- 433,451 ----
  		return "std::string";
  
! 	return "Error";
! }
! 
! 
! std::string FieldAttributeRep::getSetTypeStr()
! {
! 	std::string val_type = m_ptr->getAttribute("DataType")->getStringValue();
! 	if ( val_type == "integer")
! 		return "const long";
! 	else if ( val_type == "double")
! 		return "const double";
! 	else if ( val_type == "string")
! 		return "const std::string&";
! 
! 	return "Error";
  }
  
***************
*** 355,360 ****
  std::string FieldAttributeRep::getMethodStr()
  {
! 	BON::FCO bon_ptr = static_cast<BON::FCO>(this->m_ptr);
! 	std::string val_type = bon_ptr->getAttribute("DataType")->getStringValue();
  	if ( val_type == "integer")
  		return "Integer";
--- 453,457 ----
  std::string FieldAttributeRep::getMethodStr()
  {
! 	std::string val_type = m_ptr->getAttribute("DataType")->getStringValue();
  	if ( val_type == "integer")
  		return "Integer";
***************
*** 364,368 ****
  		return "String";
  
! 	return "global_vars.error";
  }
  
--- 461,465 ----
  		return "String";
  
! 	return "Error";
  }
  
***************
*** 378,382 ****
  
  	m.m_returnValue = getTypeStr();
! 	m.m_signature = getMethodName() + "()";
  	m.m_implementation = src;
  	m.m_container = container;
--- 475,497 ----
  
  	m.m_returnValue = getTypeStr();
! 	m.m_signature = getMethodName() + "() ";
! 	m.m_implementation = src;
! 	m.m_container = container;
! 	m.m_comment = "";
! 
! 	return m;
! }
! 
! 
! Method FieldAttributeRep::createSetMethodForAttr( FCO * container)
! {
! 	Method m;
! 	std::string src;
! 	src  = CodeGen::indent(0) + "{\n";
! 	src += CodeGen::indent(1) +   "FCOImpl::getAttribute(\"" + getName() + "\")->set" + getMethodStr() + "Value( val);\n";
! 	src += CodeGen::indent(0) + "}\n\n\n";
! 
! 	m.m_returnValue = "void";
! 	m.m_signature = getSetMethodName() + "( " + getSetTypeStr() + " val)";
  	m.m_implementation = src;
  	m.m_container = container;
***************
*** 391,394 ****
--- 506,516 ----
  	std::string hdr;
  	hdr  = CodeGen::indent(1) + "/*virtual*/ inline " + getTypeStr() + " " + getMethodName() + "() ";
+ 	hdr += "{";
+ 	hdr += "throw std::string(\"Interface inherited kind. \" + getName() + \" doesn't have " + getNameToUse() + " attribute\");";
+ 	hdr += "}\n";
+ 
+ 	// the signature has to match the parent's getter's in order to override it
+ 	hdr += "\n";
+ 	hdr += CodeGen::indent(1) + "/*virtual*/ inline void " + getSetMethodName() + "( " + getSetTypeStr() + ") ";
  	hdr += "{";
  	hdr += "throw std::string(\"Interface inherited kind. \" + getName() + \" doesn't have " + getNameToUse() + " attribute\");";

Index: AttributeRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/AttributeRep.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AttributeRep.h	10 Mar 2004 17:42:16 -0000	1.4
--- AttributeRep.h	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 21,24 ****
--- 21,25 ----
  	/*virtual*/ std::string doDump() { return ""; }
  	virtual Method createMethodForAttr( FCO* ) = 0;
+ 	virtual Method createSetMethodForAttr( FCO* ) = 0;
  	virtual std::string doDumpErroneousAttrHdr() = 0;
  	virtual std::string doDumpErroneousAttrSrc( FCO*) = 0;
***************
*** 31,34 ****
--- 32,36 ----
  	std::string getNameToUse();
  	virtual std::string getMethodName() = 0;
+ 	virtual std::string getSetMethodName() = 0;
  
  	void addOwner( FCO * owner_fco);
***************
*** 55,59 ****
--- 57,63 ----
  	/*virtual*/ std::string doDumpErroneousAttrSrc( FCO*);
  	/*virtual*/ Method createMethodForAttr( FCO* );
+ 	/*virtual*/ Method createSetMethodForAttr( FCO* );
  	/*virtual*/ std::string getMethodName();
+ 	/*virtual*/ std::string getSetMethodName();
  	/*static*/ std::string enumTypeName( EnumAttributeRep * a);
  protected:
***************
*** 73,77 ****
--- 77,83 ----
  	/*virtual*/ std::string doDumpErroneousAttrSrc( FCO*);
  	/*virtual*/ Method createMethodForAttr( FCO* );
+ 	/*virtual*/ Method createSetMethodForAttr( FCO* );
  	/*virtual*/ std::string getMethodName();
+ 	/*virtual*/ std::string getSetMethodName();
  };
  
***************
*** 85,91 ****
--- 91,100 ----
  	/*virtual*/ std::string doDumpErroneousAttrSrc( FCO*);
  	/*virtual*/ Method createMethodForAttr( FCO* );
+ 	/*virtual*/ Method createSetMethodForAttr( FCO* );
  	std::string getTypeStr();
+ 	std::string getSetTypeStr();
  	std::string getMethodStr();
  	/*virtual*/ std::string getMethodName();
+ 	/*virtual*/ std::string getSetMethodName();
  };
  

Index: CodeGen.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGen.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CodeGen.cpp	17 Mar 2004 00:24:14 -0000	1.4
--- CodeGen.cpp	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 1,4 ****
--- 1,8 ----
  #include "stdafx.h"
  #include "CodeGen.h"
+ #include "Dumper.h"
+ 
+ /*const*/ int h_ind = 1;
+ /*const*/ int s_ind = 0;
  
  /*static*/ std::string CodeGen::indent( int tabs /* = 0*/)
***************
[...962 lines suppressed...]
- 	{
- 		mmm  = indent(0) + "{\n";
- 		mmm += indent(1) +   "BON::ConnectionEnd ce = ConnectionImpl::getDst();\n";
- 		mmm += indent(1) +   oper2_lcd + " sp( ce);\n";
- 		mmm += indent(1) +   "if ( sp)\n";
- 		mmm += indent(2) +     "return sp;\n";
- 		mmm += indent(0) + "\n";
- 		mmm += indent(1) +   oper2_lcd + " empty;\n";
- 		mmm += indent(1) +   "return empty;\n";
- 		mmm += indent(0) + "}\n\n\n";
- 
- 		m.m_signature = "getDst()";
- 		m.m_returnValue = oper2_lcd;
- 		m.m_container = conn;
- 		m.m_implementation = mmm;
- 		m.m_comment = "getDst() return value is a ConnectionEnd casted to " + oper2_lcd;
- 	}
  	return m;
  }
--- 398,401 ----

Index: CodeGen.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGen.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CodeGen.h	17 Mar 2004 00:24:14 -0000	1.2
--- CodeGen.h	16 Jun 2004 18:35:02 -0000	1.3
***************
*** 10,13 ****
--- 10,15 ----
  #include "Method.h"
  
+ //#include "vector"
+ 
  class CodeGen
  {
***************
*** 20,30 ****
  	 * Folder related generators
  	 */
! 	static void dumpKindGetter( FCO* fco, FolderRep * cont);
  	static void dumpFoldGetter( FolderRep* sub, FolderRep *fold);
  
  
  	/**
  	 * Model related generators
  	 */
  	static void dumpRoleGetter( FCO* fco, RoleRep * role, ModelRep *);
  
--- 22,56 ----
  	 * Folder related generators
  	 */
! 	static void folderGetter( const std::string& retval_folderkind, const std::string& sub_name, const std::string& method_name, bool extended, Any * cont, Method& m);
! 	static void folderGetterGeneric( const std::string& retval_folderkind, const std::string& sub_name, const std::string& method_name, bool extended, Any * cont, Method& m);
! 
  	static void dumpFoldGetter( FolderRep* sub, FolderRep *fold);
  
+ 	static void kindGetter1( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m);
+ 	static void kindGetter2( const std::string& retval_kind, const std::string& kind, const std::vector< std::string>& kind_vec, const std::string& method_name, Any * cont, Method& m);	
+ 	static void kindGetter3( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m);
+ 
+ 	static void kindGetter1Generic( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m);
+ 	static void kindGetter2Generic( const std::string& retval_kind, const std::string& kind, const std::vector< std::string>& kind_vec, const std::string& method_name, Any * cont, Method& m);	
+ 	static void kindGetter3Generic( const std::string& retval_kind, const std::string& kind, const std::string& method_name, Any * cont, Method& m);
+ 
+ 	static void dumpKindGetter( FCO* fco, FolderRep * cont);
+ 
  
  	/**
  	 * Model related generators
  	 */
+ 	static void roleGetter1( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& m);
+ 	static void roleGetter1Generic( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& m);
+ 
+ 	static void roleGetter2( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& m);
+ 	static void roleGetter2Generic( const std::string& retval_kind, const std::string& inquire, const std::string& method_name, const std::string& fco_name, Any * cont, Method& m);
+ 
+ 	static void roleGetter3( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& role_name, const std::vector< std::string > & roles, const std::string& dummy_str, Any * cont, Method& m);
+ 	static void roleGetter3Generic( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name,  const std::string& role_name, const std::vector< std::string > & roles, const std::string& dummy_str, Any * cont, Method& m);
+ 
+ 	static void roleGetter4( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& desc_k_name, const std::string& role_name, Any * cont, Method& m);
+ 	static void roleGetter4Generic( const std::string& retval_kind, const std::string& method_name, const std::string& fco_name, const std::string& desc_k_name, const std::string& role_name, Any * cont, Method& m);
+ 
  	static void dumpRoleGetter( FCO* fco, RoleRep * role, ModelRep *);
  
***************
*** 33,37 ****
--- 59,65 ----
  	 * Set related generators
  	 */
+ 	
  	static Method dumpSetGetter( SetRep * cont, const FCO * fco, const std::string& comm_kind, bool aggreg = false, bool dummy_par = false);
+ 	static Method dumpSetGetterGeneric( SetRep * cont, const FCO * fco, const std::string& comm_kind, bool aggreg = false, bool dummy_par = false);
  
  	/**
***************
*** 50,53 ****
--- 78,85 ----
  	static Method dumpGetOutConnectionLinks( FCO *fco, ConnectionRep * conn);
  	static Method dumpGetBothConnectionLinks( FCO *fco, ConnectionRep * conn);
+ 	
+ 	static Method dumpGetInConnectionLinksGeneric( FCO *fco, ConnectionRep * conn);
+ 	static Method dumpGetOutConnectionLinksGeneric( FCO *fco, ConnectionRep * conn);
+ 	static Method dumpGetBothConnectionLinksGeneric( FCO *fco, ConnectionRep * conn);
  
  	// get<In, Out>ConnectionEnd
***************
*** 56,59 ****
--- 88,95 ----
  	static Method dumpGetBothConnectionEnd( FCO *fco, FCO* peer, ConnectionRep * conn, bool refport);
  	
+ 	static Method dumpGetInConnectionEndGeneric( FCO *fco, FCO* peer, ConnectionRep * conn, bool refport);
+ 	static Method dumpGetOutConnectionEndGeneric( FCO *fco, FCO* peer, ConnectionRep * conn, bool refport);
+ 	static Method dumpGetBothConnectionEndGeneric( FCO *fco, FCO* peer, ConnectionRep * conn, bool refport);
+ 
  	//get<Src, Dst>
  	static Method dumpGetSrc(FCO *fco, ConnectionRep * conn, bool refport);

Index: ConnJoint.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ConnJoint.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConnJoint.cpp	10 Mar 2004 20:03:32 -0000	1.6
--- ConnJoint.cpp	16 Jun 2004 18:35:02 -0000	1.7
***************
*** 394,398 ****
  
  
! bool ConnJoint::createEndGetters()
  {
  	//
--- 394,398 ----
  
  
! bool ConnJoint::createLinkGetters()
  {
  	//
***************
*** 408,414 ****
  				if ( (*op1_it)->isToBeEx())
  				{
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionLinks( *op1_it, m_connPtr));
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionLinks( *op1_it, m_connPtr));
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op1_it, m_connPtr));
  				}
  			}
--- 408,424 ----
  				if ( (*op1_it)->isToBeEx())
  				{
! 					if ( Dumper::m_bGenTemplates)
! 					{
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionLinksGeneric( *op1_it, m_connPtr));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionLinksGeneric( *op1_it, m_connPtr));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinksGeneric( *op1_it, m_connPtr));
! 					}
! 
! 					if ( Dumper::m_bGenRegular)
! 					{
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionLinks( *op1_it, m_connPtr));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionLinks( *op1_it, m_connPtr));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op1_it, m_connPtr));
! 					}
  				}
  			}
***************
*** 421,425 ****
  				if ( (*op1_it)->isToBeEx())
  				{
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionLinks( *op1_it, m_connPtr));
  				}
  			}
--- 431,439 ----
  				if ( (*op1_it)->isToBeEx())
  				{
! 					if ( Dumper::m_bGenTemplates) 
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionLinksGeneric( *op1_it, m_connPtr));
! 
! 					if ( Dumper::m_bGenRegular) 
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionLinks( *op1_it, m_connPtr));
  				}
  			}
***************
*** 429,433 ****
  				if ( (*op2_it)->isToBeEx())
  				{
! 					(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionLinks( *op2_it, m_connPtr));
  				}
  			}
--- 443,451 ----
  				if ( (*op2_it)->isToBeEx())
  				{
! 					if ( Dumper::m_bGenTemplates) 
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionLinksGeneric( *op2_it, m_connPtr));
! 
! 					if ( Dumper::m_bGenRegular) 
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionLinks( *op2_it, m_connPtr));
  				}
  			}
***************
*** 441,445 ****
  			for( ; op1_it != m_oper1.end(); ++op1_it)
  				if ( (*op1_it)->isToBeEx())
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op1_it, m_connPtr));
  		}
  		else // though bidirect, different src and dest
--- 459,469 ----
  			for( ; op1_it != m_oper1.end(); ++op1_it)
  				if ( (*op1_it)->isToBeEx())
! 				{
! 					if ( Dumper::m_bGenTemplates) 
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinksGeneric( *op1_it, m_connPtr));
! 
! 					if ( Dumper::m_bGenRegular) 
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op1_it, m_connPtr));
! 				}
  		}
  		else // though bidirect, different src and dest
***************
*** 448,460 ****
  			for( ; op1_it != m_oper1.end(); ++op1_it)
  				if ( (*op1_it)->isToBeEx())
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op1_it, m_connPtr));
  
  			SDList_Iterator op2_it = m_oper2.begin();
  			for( ; op2_it != m_oper2.end(); ++op2_it)
  				if ( (*op2_it)->isToBeEx())
! 					(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op2_it, m_connPtr));
  		}
  	}
! 	
  	//
  	// 2nd task
--- 472,501 ----
  			for( ; op1_it != m_oper1.end(); ++op1_it)
  				if ( (*op1_it)->isToBeEx())
! 				{
! 					if ( Dumper::m_bGenTemplates)
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinksGeneric( *op1_it, m_connPtr));
! 
! 					if ( Dumper::m_bGenRegular)
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op1_it, m_connPtr));
! 				}
  
  			SDList_Iterator op2_it = m_oper2.begin();
  			for( ; op2_it != m_oper2.end(); ++op2_it)
  				if ( (*op2_it)->isToBeEx())
! 				{
! 					if ( Dumper::m_bGenTemplates)
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinksGeneric( *op2_it, m_connPtr));
! 
! 					if ( Dumper::m_bGenRegular)
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionLinks( *op2_it, m_connPtr));
! 				}
  		}
  	}
! 	return true;
! }
! 
! 
! bool ConnJoint::createSrcDstGetters()
! {	
  	//
  	// 2nd task
***************
*** 488,492 ****
--- 529,538 ----
  		}
  	}
+ 	return true;
+ }
+ 
  
+ bool ConnJoint::createEndGetters()
+ {
  	//
  	// 3rd task
***************
*** 512,520 ****
  							peer_ptr = (*peer_it)->getExtedAnc();
  
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
  					}
  				}
  				else // no common denom (lcd) of dst nodes
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
  			}
  		}
--- 558,576 ----
  							peer_ptr = (*peer_it)->getExtedAnc();
  
! 						if ( Dumper::m_bGenTemplates)
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 
! 						if ( Dumper::m_bGenRegular)
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
  					}
  				}
  				else // no common denom (lcd) of dst nodes
! 				{
! 					if ( Dumper::m_bGenTemplates)
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 
! 					if ( Dumper::m_bGenRegular)
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 				}
  			}
  		}
***************
*** 536,544 ****
  							peer_ptr = (*peer_it)->getExtedAnc();
  
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  					}
  				}
  				else // no common denom (lcd) of src nodes
! 					(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
  			}
  		}
--- 592,610 ----
  							peer_ptr = (*peer_it)->getExtedAnc();
  
! 						if ( Dumper::m_bGenTemplates)
! 							(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 
! 						if ( Dumper::m_bGenRegular)
! 							(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  					}
  				}
  				else // no common denom (lcd) of src nodes
! 				{
! 					if ( Dumper::m_bGenTemplates)
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 
! 					if ( Dumper::m_bGenRegular)
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 				}
  			}
  		}
***************
*** 564,571 ****
  						if ( (*op1_it)->isToBeEx())
  						{
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  						}
  					}
--- 630,648 ----
  						if ( (*op1_it)->isToBeEx())
  						{
! 							if ( Dumper::m_bGenTemplates)
! 							{
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 							}
! 
! 							if ( Dumper::m_bGenRegular)
! 							{
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 							}
  						}
  					}
***************
*** 588,595 ****
  						if ( (*op1_it)->isToBeEx())
  						{
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
  
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 							(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
  						}
  					}
--- 665,683 ----
  						if ( (*op1_it)->isToBeEx())
  						{
! 							if ( Dumper::m_bGenTemplates)
! 							{
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
  
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 							}
! 
! 							if ( Dumper::m_bGenRegular)
! 							{
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 								(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, peer_ptr, m_connPtr, m_oper2IsAnyReferencePort));
! 							}
  						}
  					}
***************
*** 600,607 ****
  						if ( (*op2_it)->isToBeEx())
  						{
! 							(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  
! 							(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 							(*op2_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  						}
  					}
--- 688,706 ----
  						if ( (*op2_it)->isToBeEx())
  						{
! 							if ( Dumper::m_bGenTemplates)
! 							{
! 								(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionEndGeneric( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
  
! 								(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 								(*op2_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 							}
! 
! 							if ( Dumper::m_bGenRegular)
! 							{
! 								(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 
! 								(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 								(*op2_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op2_it, peer_ptr, m_connPtr, m_oper1IsAnyReferencePort));
! 							}
  						}
  					}
***************
*** 616,622 ****
  				if ( (*op1_it)->isToBeEx())
  				{
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 					(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
  				}
  			}
--- 715,731 ----
  				if ( (*op1_it)->isToBeEx())
  				{
! 					if ( Dumper::m_bGenTemplates)
! 					{
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEndGeneric( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 					}
! 					
! 					if ( Dumper::m_bGenRegular)
! 					{
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 						(*op1_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op1_it, 0, m_connPtr, m_oper2IsAnyReferencePort));
! 					}
  				}
  			}
***************
*** 627,633 ****
  				if ( (*op2_it)->isToBeEx())
  				{
! 					(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 					(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 					(*op2_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
  				}
  			}
--- 736,752 ----
  				if ( (*op2_it)->isToBeEx())
  				{
! 					if ( Dumper::m_bGenTemplates)
! 					{
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionEndGeneric( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEndGeneric( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetOutConnectionEndGeneric( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 					}
! 
! 					if ( Dumper::m_bGenRegular)
! 					{
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetBothConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetInConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 						(*op2_it)->addConnMethod( CodeGen::dumpGetOutConnectionEnd( *op2_it, 0, m_connPtr, m_oper1IsAnyReferencePort));
! 					}
  				}
  			}

Index: ConnJoint.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ConnJoint.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ConnJoint.h	10 Mar 2004 02:50:18 -0000	1.4
--- ConnJoint.h	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 56,59 ****
--- 56,62 ----
  
  	bool calcLCD();
+ 
+ 	bool createLinkGetters();
+ 	bool createSrcDstGetters();
  	bool createEndGetters();
  

Index: ConnectionRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/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:50:18 -0000	1.4
--- ConnectionRep.cpp	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 64,84 ****
  	// implementation inheritance
  	// not needed since the inheritance provides the needed functionality
- 	/*std::vector<FCO*> conn_descendants;
- 	this->getImpDescendants( conn_descendants);
- 	//conn_descendants.push_back( this); nn because the owner will be first filled
- 
- 	std::vector<FCO*>::iterator conn_it = conn_descendants.begin();
- 	for( ; conn_it != conn_descendants.end(); ++conn_it)
- 	{
- 		std::list<ConnJoint>::iterator joint_it = m_jointList.begin();
- 		for( ; joint_it != m_jointList.end(); ++joint_it )
- 		{
- 			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);
- 		}
- 	}*/
  }
  
--- 64,67 ----
***************
*** 141,145 ****
--- 124,132 ----
  	std::list<ConnJoint>::iterator joint_it = m_jointList.begin();
  	for( ; joint_it != m_jointList.end(); ++joint_it )
+ 	{
+ 		joint_it->createLinkGetters();
+ 		joint_it->createSrcDstGetters();
  		joint_it->createEndGetters();
+ 	}
  	return true;
  }

Index: Dumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Dumper.cpp	17 Mar 2004 00:24:14 -0000	1.10
--- Dumper.cpp	16 Jun 2004 18:35:02 -0000	1.11
***************
*** 13,16 ****
--- 13,28 ----
  
  #include "SelConf.h"
+ #include "OptionsDlg.h"
+ 
+ bool Dumper::m_bParsePrev = false;
+ bool Dumper::m_bGenInit = false;
+ bool Dumper::m_bGenFinalize = false;
+ bool Dumper::m_bGenTemplates = false;
+ bool Dumper::m_bGenTemplVersion6 = true;
+ bool Dumper::m_bGenRegular = true;
+ bool Dumper::m_bGenVisitor = false;
+ bool Dumper::m_bSafetyBackup = true;
+ 
+ 
  
  Sheet * Dumper::getInstance()
***************
*** 93,97 ****
--- 105,111 ----
  	std::string t = m_projName;
  	Any::convertToValidName( t);
+ 
  	MakeVisitor m_visitor( t);
+ 
  	// connections
  	{std::vector<ConnectionRep*>::const_iterator it_cn = m_connList.begin();
***************
*** 212,226 ****
  	}
  
! 	std::ofstream visitorh( global_vars.m_visitorHeaderFileName.c_str());
! 	std::ofstream visitors( global_vars.m_visitorSourceFileName.c_str());
  
! 	std::string mmm = m_visitor.dumpVisitorHeader();
! 	visitorh.write( mmm.c_str(), mmm.length());
  
! 	std::string nnn = m_visitor.dumpVisitorSource();
! 	visitors.write( nnn.c_str(), nnn.length());
  
! 	visitorh.close();
! 	visitors.close();
  }
  
--- 226,243 ----
  	}
  
! 	if ( m_bGenVisitor)
! 	{
! 		std::ofstream visitorh( global_vars.m_visitorHeaderFileName.c_str());
! 		std::ofstream visitors( global_vars.m_visitorSourceFileName.c_str());
  
! 		std::string mmm = m_visitor.dumpVisitorHeader();
! 		visitorh.write( mmm.c_str(), mmm.length());
  
! 		std::string nnn = m_visitor.dumpVisitorSource();
! 		visitors.write( nnn.c_str(), nnn.length());
  
! 		visitorh.close();
! 		visitors.close();
! 	}
  }
  
***************
*** 292,300 ****
  	DMP_H("#include \"BON.h\"\n#include \"BONImpl.h\"\n#include \"Extensions.h\"\n\n");
  
  	DMP_H( Any::m_startUPToken + "\n" + global_user_part1 + Any::m_endUPToken + "\n\n");
  
  	global_vars.m_namespace_name = getNamespaceName();
  
! 	DMP_H("namespace " + getNamespaceName() + "\n{\n");
  	
  	DMP_S("\nnamespace BON\n{\n\n");
--- 309,338 ----
  	DMP_H("#include \"BON.h\"\n#include \"BONImpl.h\"\n#include \"Extensions.h\"\n\n");
  
+ 	if ( m_bGenTemplates)
+ 	{
+ 		DMP_H("//\n");
+ 		DMP_H("// this dummy template parameter is needed by VC6 to deduct the return type\n");
+ 		DMP_H("// VC7 users can modify this macro to a value like \"int _dummy = 0\"\n");
+ 		DMP_H("// TDP standing for TEMPLATE DUMMY PAR\n");
+ 
+ 		if ( m_bGenTemplVersion6)
+ 		{
+ 			DMP_H("//#define TDP int _dummy = 0			// recommended for VC7 users\n");
+ 			DMP_H("#define TDP const T & _dummyComp		// recommended for VC6 users\n");
+ 		}
+ 		else
+ 		{
+ 			DMP_H("#define TDP int _dummy = 0			// recommended for VC7 users\n");
+ 			DMP_H("//#define TDP const T & _dummyComp		// recommended for VC6 users\n");
+ 		}
+ 
+ 		DMP_H("\n");
+ 	}
+ 
  	DMP_H( Any::m_startUPToken + "\n" + global_user_part1 + Any::m_endUPToken + "\n\n");
  
  	global_vars.m_namespace_name = getNamespaceName();
  
! 	DMP_H("namespace " + getNamespaceName() + "\n{\n\n");
  	
  	DMP_S("\nnamespace BON\n{\n\n");
***************
*** 307,310 ****
--- 345,349 ----
  	dumpGlobals( sorted);
  
+ 	DMP_H("\n\n");
  	DMP_S("\n\n}; // end namespace BON\n\n");
  	DMP_S("namespace " + getNamespaceName() + "\n{\n");
***************
*** 502,510 ****
  		for( ; i != ch.end(); ++i)
  		{
! 			//std::string one_config( (*i)->getName()); //<!>
! 			std::string one_config( (*i)->getPath()); // instead of getName 
! 			int last_slash = one_config.rfind("/");
! 			if ( last_slash != std::string::npos && last_slash + 1 < one_config.length())
! 				one_config = one_config.substr( last_slash + 1);
  
  			if ( (*i)->getIntegerValue() == 1
--- 541,545 ----
  		for( ; i != ch.end(); ++i)
  		{
! 			std::string one_config( (*i)->getName()); // previously getPath used
  
  			if ( (*i)->getIntegerValue() == 1
***************
*** 602,770 ****
  
  
! /*static*/ int Dumper::selectOutputFiles( const std::string& proj_name_to_be_checked)
  {
! 	std::string proj_name = proj_name_to_be_checked;
! 	Any::convertToValidName( proj_name);
! 	global_vars.output_directory_name = "";
! 	global_vars.source_file_name = proj_name;
! 	global_vars.err_file_name = proj_name + "BONExt.log";
! 	global_vars.m_visitorHeaderFileName = proj_name + "Visitor.h";
! 	global_vars.m_visitorSourceFileName = proj_name + "Visitor";
! 
! 	// header file name selection
! 	try {
! 		CString def_name = proj_name.c_str();
! 		def_name += "BonExtension.h";
! 		CFileDialog dlg2(FALSE, "h", def_name,
! 			OFN_EXPLORER | OFN_HIDEREADONLY //| OFN_OVERWRITEPROMPT
! 			,"C++ header files (*.h)|*.h|All Files (*.*)|*.*||");
! 		if( dlg2.DoModal() == IDOK) 
! 		{
! 			global_vars.header_file_name = (LPCTSTR) dlg2.GetPathName();
! 			global_vars.source_file_name = (LPCTSTR) dlg2.GetFileName();
! 			int p = global_vars.source_file_name.rfind( ".");
! 			if ( p != std::string::npos)
! 				global_vars.source_file_name = global_vars.source_file_name.substr( 0, p);
! 			
! 			p = global_vars.header_file_name.rfind('\\');
! 			if ( p != std::string::npos)
! 				global_vars.output_directory_name = global_vars.header_file_name.substr( 0, p + 1);
! 		}
! 		else // IDCANCEL , using default name
! 		{
! 			//global_vars.header_file_name = (LPCTSTR) def_name;
! 			return 4;
! 		}
! 	}	catch (...)	{
! 		global_vars.err << "Exception caught! Using default filenames.\n";
! 		global_vars.header_file_name = proj_name + "BonExtension.h";
! 	}
! 
! 	if ( existsFile( global_vars.header_file_name.c_str())) // make a copy of the header
  	{
! 		global_vars.header_backup_name = global_vars.header_file_name + ".copy";
! 		int res = makeFileCopy( global_vars.header_file_name.c_str(), global_vars.header_backup_name.c_str());
  		if ( res == 2)
  		{
! 			TO("During backup process could not read file: " + global_vars.header_file_name);
  			return 2;
  		}
  		else if ( res == 3)
  		{
! 			TO("Cannot create backup file: " + global_vars.header_backup_name);
  			return 3;
  		}
- 
- 		CString msg = CString("A file with ") + global_vars.header_file_name.c_str() + " name already exists." +
- 			"\nWould you like the user part extracted from this file?";
- 		if ( AfxMessageBox( msg, MB_YESNO | MB_ICONQUESTION) != IDYES)
- 			global_vars.header_backup_name = ""; // notify the dumper NOT to search for UP (user part) declarations
  	}
  
- 	// source file name selection
- 	try {
- 		CString def_name = global_vars.source_file_name.c_str();
- 		def_name += ".cpp";
- 		CFileDialog dlg2(FALSE, "cpp", def_name,
- 			OFN_EXPLORER //| OFN_HIDEREADONLY //| OFN_OVERWRITEPROMPT,
- 			,"C++ source files (*.cpp)|*.cpp|All Files (*.*)|*.*||");
- 		if(dlg2.DoModal() == IDOK) 
- 		{
- 			global_vars.source_file_name = (LPCTSTR) dlg2.GetPathName();
- 		}
- 		else // IDCANCEL , using default name
- 		{
- 			global_vars.source_file_name = (LPCTSTR) def_name;
- 		}
- 	}	catch (...)	{
- 		global_vars.err << "Exception caught! Using default filenames.\n";
- 		global_vars.source_file_name = proj_name + "BonExtension.cpp";
- 	}
  
! 	if ( existsFile( global_vars.source_file_name.c_str())) // make a copy of the source
  	{
! 		std::string src_backup = global_vars.source_file_name + ".copy";
! 		int res = makeFileCopy( global_vars.source_file_name.c_str(), src_backup.c_str());
! 		if ( res == 2)
! 		{
! 			TO("During backup process could not read the file: " + global_vars.source_file_name);
! 			return 2;
! 		}
! 		else if ( res == 3)
! 		{
! 			TO("Cannot create backup file: " + src_backup);
! 			return 3;
! 		}
  	}
  
! 	// visitor header file name selection
! 	try {
! 		CString def_name = global_vars.m_visitorHeaderFileName.c_str();
! 		CFileDialog dlg2(FALSE, "h", def_name,
! 			OFN_EXPLORER //| OFN_HIDEREADONLY //| OFN_OVERWRITEPROMPT
! 			,"C++ header files (*.h)|*.h|All Files (*.*)|*.*||");
! 		if( dlg2.DoModal() == IDOK) 
! 		{
! 			global_vars.m_visitorHeaderFileName = (LPCTSTR) dlg2.GetPathName();
! 			global_vars.m_visitorSourceFileName = (LPCTSTR) dlg2.GetFileName();
! 			int p = global_vars.m_visitorSourceFileName.rfind( ".");
! 			if ( p != std::string::npos)
! 				global_vars.m_visitorSourceFileName = global_vars.m_visitorSourceFileName.substr( 0, p);
  
! 		}
! 	}	catch (...)	{
! 		global_vars.err << "Exception caught! Using default filenames for visitor header.\n";
! 	}
  
! 	if ( existsFile( global_vars.m_visitorHeaderFileName.c_str())) // make a copy of the visitor header
  	{
! 		std::string visitor_hdr_backup = global_vars.m_visitorHeaderFileName + ".copy";
! 		int res = makeFileCopy( global_vars.m_visitorHeaderFileName.c_str(), visitor_hdr_backup.c_str());
! 		if ( res == 2)
! 		{
! 			TO("During backup process could not read the file: " + global_vars.m_visitorHeaderFileName);
! 			return 2;
! 		}
! 		else if ( res == 3)
! 		{
! 			TO("Cannot create backup file: " + visitor_hdr_backup);
! 			return 3;
! 		}
  	}
  
! 	// visitor source file name selection
! 	try {
! 		CString def_name = global_vars.m_visitorSourceFileName.c_str();
! 		def_name += ".cpp";
! 		CFileDialog dlg2(FALSE, "cpp", def_name,
! 			OFN_EXPLORER //| OFN_HIDEREADONLY //| OFN_OVERWRITEPROMPT,
! 			,"C++ source files (*.cpp)|*.cpp|All Files (*.*)|*.*||");
! 		if(dlg2.DoModal() == IDOK) 
  		{
! 			global_vars.m_visitorSourceFileName = (LPCTSTR) dlg2.GetPathName();
  		}
! 	}	catch (...)	{
! 		global_vars.err << "Exception caught! Using default filenames for visitor source.\n";
  	}
  
! 	if ( existsFile( global_vars.m_visitorSourceFileName.c_str())) // make a copy of the visitor source
  	{
! 		std::string visitor_src_backup = global_vars.m_visitorSourceFileName + ".copy";
! 		int res = makeFileCopy( global_vars.m_visitorSourceFileName.c_str(), visitor_src_backup.c_str());
! 		if ( res == 2)
! 		{
! 			TO("During backup process could not read the file: " + global_vars.m_visitorSourceFileName);
! 			return 2;
! 		}
! 		else if ( res == 3)
! 		{
! 			TO("Cannot create backup file: " + visitor_src_backup);
! 			return 3;
! 		}
  	}
  
  	return 1;
  }
- 
  
  /*static*/ void Dumper::getGlobalUserParts( std::string& up1, std::string& up2)
--- 637,723 ----
  
  
! /*static*/ int Dumper::backup( const std::string& file_name)
  {
! 	if ( existsFile( file_name.c_str()))
  	{
! 		std::string backup = file_name + ".copy";
! 		int res = makeFileCopy( file_name.c_str(), backup.c_str());
  		if ( res == 2)
  		{
! 			TO("Could not read file during backup process: " + file_name);
  			return 2;
  		}
  		else if ( res == 3)
  		{
! 			TO("Cannot create backup file: " + backup);
  			return 3;
  		}
  	}
+ 	return 1;
+ }
  
  
! /*static*/ int Dumper::selectOutputFiles( const std::string& proj_name_to_be_checked)
! {
! 	std::string proj_name = proj_name_to_be_checked;
! 	Any::convertToValidName( proj_name);
! 
! 	OptionsDlg opt;
! 	opt.m_defName = proj_name.c_str();
! 	if ( opt.DoModal() != IDOK) return 2;
! 	
! 	global_vars.output_directory_name = "";
! 	int i = opt.m_headerName.ReverseFind('\\');
! 	if ( i != -1)
  	{
! 		global_vars.output_directory_name = opt.m_headerName.Left( i);
  	}
  
! 	global_vars.header_file_name = opt.m_headerName;
! 	global_vars.source_file_name = opt.m_sourceName;
! 	global_vars.err_file_name = global_vars.output_directory_name + proj_name + "BONExt.log";
  
! 	m_bGenInit = opt.m_bInit == TRUE;
! 	m_bGenFinalize = opt.m_bFinalize == TRUE;
! 	m_bGenRegular = opt.m_whichStyle != 1; // 0 or 2
! 	m_bGenTemplates = (opt.m_whichStyle > 0); // 1 or 2 ( = both)
! 	m_bGenTemplVersion6 = (opt.m_version71 == 0);
  
! 	m_bGenVisitor = opt.m_bVisitor == TRUE;
! 	if (m_bGenVisitor)
  	{
! 		global_vars.m_visitorHeaderFileName = opt.m_visitorHeaderName;
! 		global_vars.m_visitorSourceFileName = opt.m_visitorSourceName;
  	}
  
! 	m_bSafetyBackup = true;
! 	if ( m_bSafetyBackup)
! 	{
! 		int res1( 1), res2( 1), res3( 1), res4( 1);
! 		res1 = backup( global_vars.header_file_name);
! 		res2 = backup( global_vars.source_file_name);
! 
! 		if ( m_bGenVisitor)
  		{
! 			res3 = backup( global_vars.m_visitorHeaderFileName);
! 			res4 = backup( global_vars.m_visitorSourceFileName);
  		}
! 		if ( res1 != 1 || res2 != 1 || res3 != 1 || res4 != 1)
! 			return 2; // abort execution
  	}
  
! 	m_bParsePrev = opt.m_bParse == TRUE;
! 
! 	global_vars.header_backup_name = ""; // initial value, notifies the dumper NOT to search for UP (user part) declarations
! 	if ( m_bParsePrev)
  	{
! 		if ( existsFile( (LPCTSTR) opt.m_prevHeaderName))
! 			global_vars.header_backup_name = opt.m_prevHeaderName;
! 		else
! 			TO( opt.m_prevHeaderName + " previously generated header file not found.");
  	}
  
  	return 1;
  }
  
  /*static*/ void Dumper::getGlobalUserParts( std::string& up1, std::string& up2)

Index: Dumper.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Dumper.h	10 Mar 2004 02:50:18 -0000	1.6
--- Dumper.h	16 Jun 2004 18:35:02 -0000	1.7
***************
*** 18,23 ****
--- 18,33 ----
  
  	static int selectOutputFiles( const std::string& proj_name);
+ 	static int backup( const std::string& file_name);
  	static void getGlobalUserParts( std::string& up1, std::string& up2);
  
+ 	static bool m_bParsePrev;
+ 	static bool m_bGenInit;
+ 	static bool m_bGenFinalize;
+ 	static bool m_bGenTemplates;
+ 	static bool m_bGenTemplVersion6;
+ 	static bool m_bGenRegular;
+ 	static bool m_bGenVisitor;
+ 	static bool m_bSafetyBackup;
+ 
  protected:
  
***************
*** 42,45 ****
--- 52,56 ----
  protected:
  	void fetchConfigurationNames( std::vector< std::string>& res);
+ 
  };
  

Index: FCO.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** FCO.cpp	6 May 2004 22:30:26 -0000	1.13
--- FCO.cpp	16 Jun 2004 18:35:02 -0000	1.14
***************
*** 739,742 ****
--- 739,743 ----
  {
  	prepareMacros();
+ 	prepareIniFin();
  	prepareAttributes();
  }
***************
*** 828,831 ****
--- 829,833 ----
  	{
  		m_attributeMethods.push_back( (*it)->createMethodForAttr( this));
+ 		m_attributeMethods.push_back( (*it)->createSetMethodForAttr( this));
  	}
  }
***************
*** 836,850 ****
  	// this bool will sign if this is a child of an fco , thus needs to have 
  	// a 'virtual' parent of his kind, to access all features which are needed
  	bool has_ancestor_of_the_same_kind = false;
  	std::string mmm;
! 	/*if (!m_virtualBaseClasses.empty())
! 	{
! 		has_ancestor_of_the_same_kind = has_ancestor_of_the_same_kind || ( (*it)->getMyKind() == getMyKind());
! 		std::vector<FCO *>::iterator it = m_virtualBaseClasses.begin();
! 		for( ; it != m_virtualBaseClasses.end(); ++it)
! 		{
! 			mmm += "  virtual public " + (*it)->getName() + "Impl,\n";
! 		}
! 	}*/
  	std::vector<FCO *>::iterator it = m_parentList[ REGULAR ].begin();
  	for( ; it != m_parentList[ REGULAR ].end(); ++it)
--- 838,867 ----
  	// this bool will sign if this is a child of an fco , thus needs to have 
  	// a 'virtual' parent of his kind, to access all features which are needed
+ 	//
+ 	//         A<<fco>>
+ 	//        /|\
+ 	//         |
+ 	//         B<<model>>
+ 	//   in this case A is derived from BON::FCO
+ 	//   B is derived from A and BON::Model
  	bool has_ancestor_of_the_same_kind = false;
+ 
+ 	// if has private base class (used in case of implementation inheritance in order to prevent casting)
+ 	// then the object must be derived publicly and virtually from its kind again! (thus the cast to BON::Object will succeed)
+ 	// i.e: 
+ 	//         B<<fco>>
+ 	//        /.\
+ 	//         |
+ 	//         C (implementation inheritance between B and C)
+ 	//
+ 	//  in such cases C inherits privately from B, thus upcasting an C* pointer is not allowed
+ 	//  neither to B*, nor to BON::FCO*, nor to BON::Object*
+ 	//  but then the CImpl extension class would not compile with BON::Extension and BON::ExtensionFactory
+ 	//  thus C is derived once more (virtually!) from BON::FCO
+ 	bool has_private_base_class = false;
+ 
  	std::string mmm;
! 	std::vector< std::string> list;
! 
  	std::vector<FCO *>::iterator it = m_parentList[ REGULAR ].begin();
  	for( ; it != m_parentList[ REGULAR ].end(); ++it)
***************
*** 853,861 ****
  		if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
  			m_virtualBaseClasses.end()) // not a virtual base class
! 			mmm += "  public " + (*it)->getDispNameImpl() + ",\n";
! 			//mmm += "  public /*RG*/ " + (*it)->getDispNameImpl() + ",\n";
  		else 
! 			mmm += "  virtual public " + (*it)->getDispNameImpl() + ",\n";
! 			//mmm += "  virtual public /*RG*/ " + (*it)->getDispNameImpl() + ",\n";
  	}
  
--- 870,876 ----
  		if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
  			m_virtualBaseClasses.end()) // not a virtual base class
! 			list.push_back( "public " + (*it)->getDispNameImpl());
  		else 
! 			list.push_back( "virtual public " + (*it)->getDispNameImpl());
  	}
  
***************
*** 863,874 ****
  	for( ; it != m_parentList[ IMPLEMENTATION ].end(); ++it)
  	{
  		has_ancestor_of_the_same_kind = has_ancestor_of_the_same_kind || ( (*it)->getMyKind() == getMyKind());
  		if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
  			m_virtualBaseClasses.end()) // not a virtual base class
! 			mmm += "  private " + (*it)->getDispNameImpl() + ",\n";
! 			//mmm += "  private /*IM*/ " + (*it)->getDispNameImpl() + ",\n";
  		else 
! 			mmm += "  virtual private " + (*it)->getDispNameImpl() + ",\n";
! 			//mmm += "  virtual private /*IM*/ " + (*it)->getDispNameImpl() + ",\n";
  	}
  
--- 878,888 ----
  	for( ; it != m_parentList[ IMPLEMENTATION ].end(); ++it)
  	{
+ 		has_private_base_class = true;
  		has_ancestor_of_the_same_kind = has_ancestor_of_the_same_kind || ( (*it)->getMyKind() == getMyKind());
  		if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
  			m_virtualBaseClasses.end()) // not a virtual base class
! 			list.push_back( "private " + (*it)->getDispNameImpl());
  		else 
! 			list.push_back( "virtual private " + (*it)->getDispNameImpl());
  	}
  
***************
*** 879,887 ****
  		if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
  			m_virtualBaseClasses.end()) // not a virtual base class
! 			mmm += "  public " + (*it)->getDispNameImpl() + ",\n";
! 			//mmm += "  public /*IN*/ " + (*it)->getDispNameImpl() + ",\n";
  		else 
! 			mmm += "  virtual public " + (*it)->getDispNameImpl() + ",\n";
! 			//mmm += "  virtual public /*IN*/ " + (*it)->getDispNameImpl() + ",\n";
  	}
  
--- 893,899 ----
  		if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
  			m_virtualBaseClasses.end()) // not a virtual base class
! 			list.push_back( "public " + (*it)->getDispNameImpl());
  		else 
! 			list.push_back( "virtual public " + (*it)->getDispNameImpl());
  	}
  
***************
*** 890,907 ****
  	// the canonical form is "class X :"
  
! 	if ( !has_ancestor_of_the_same_kind)
! 	{
! 		std::string kind_str = getMyKindStr();
! 		//mmm = " :\n  virtual public /*Ex*/ BON::" + kind_str + "Impl,\n" + mmm;
! 		mmm = " :\n  virtual public BON::" + kind_str + "Impl,\n" + mmm;
! 		mmm[ mmm.length()-2] = ' '; // replace the ,
! 	}
! 	else if (!mmm.empty() && mmm.length() >= 2)
  	{
! 		mmm[mmm.length()-2] = ' '; // replace the ,
! 		mmm = " :\n" + mmm;
  	}
  
! 	return mmm;
  }
  
--- 902,916 ----
  	// the canonical form is "class X :"
  
! 	if ( !has_ancestor_of_the_same_kind || has_private_base_class)
  	{
! 		mmm = " :\n\t  virtual public BON::" + getMyKindStr() + "Impl";
! 		for( unsigned int k = 0; k < list.size(); ++k)
! 			mmm += "\n\t, " + list[k];
  	}
+ 	else
+ 		for( unsigned int k = 0; k < list.size(); ++k)
+ 			mmm += (k == 0?" :\n\t  ":"\n\t, ") + list[k];
  
! 	return mmm + "\n";
  }
  
***************
*** 930,934 ****
  {
  	if (!m_attributeMethods.empty())
! 		h_file += CodeGen::indent(1) + "//\n" + CodeGen::indent(1) + "// attribute getters\n";
  	
  	MethodLexicographicSort lex;
--- 939,943 ----
  {
  	if (!m_attributeMethods.empty())
! 		h_file += CodeGen::indent(1) + "//\n" + CodeGen::indent(1) + "// attribute getters and setters\n";
  	
  	MethodLexicographicSort lex;
***************
*** 964,968 ****
  		h_file += CodeGen::indent(1) + "virtual bool isAbstract() const { return false; } // it is not an abstract class\n";*/
  
! 	h_file += m_classGlobalPart;
  }
  
--- 973,980 ----
  		h_file += CodeGen::indent(1) + "virtual bool isAbstract() const { return false; } // it is not an abstract class\n";*/
  
! 	for( unsigned int k = 0; k < m_inifinMethods.size(); ++k)
! 		h_file += m_inifinMethods[k].getHeader() + "\n";
! 
! 	h_file += m_classGlobalPart + '\n';
  }
  
***************
*** 976,984 ****
  
  
! std::string FCO::expose()
  { 
  	// no need to expose the conn methods because the kind of inheritance (int or imp)
  	// does the right thing from the connections point of view
! 	return /*exposeConnMethods() +*/ exposeAttrMethods();
  }
  
--- 988,996 ----
  
  
! std::string FCO::expose( const std::string& repl)
  { 
  	// no need to expose the conn methods because the kind of inheritance (int or imp)
  	// does the right thing from the connections point of view
! 	return /*exposeConnMethods() +*/ exposeAttrMethods( repl);
  }
  
***************
*** 987,1007 ****
  {
  	std::string hdr, public_part, private_part;
  	std::vector<FCO *>::iterator imp_it = m_parentList[ IMPLEMENTATION ].begin();
  	for( ; imp_it != m_parentList[ IMPLEMENTATION ].end(); ++imp_it)
! 		public_part += (*imp_it)->expose();
  
  	std::vector<FCO *>::iterator int_it = m_parentList[ INTERFACE ].begin();
  	for( ; int_it != m_parentList[ INTERFACE ].end(); ++int_it)
! 		private_part += (*int_it)->hide();
  
  	if ( !private_part.empty())
! 		hdr += "\nprivate: // hide members\n" + private_part;
  	if ( !public_part.empty())
! 		hdr += "\npublic: // expose members\n" + public_part;
  
  	imp_it = m_parentList[ IMPLEMENTATION ].begin();
  	for( ; imp_it != m_parentList[ IMPLEMENTATION ].end(); ++imp_it)
! 		hdr += (*imp_it)->hideAndExpose(); // recursive call to other implementation parents
  	
  	return hdr;
  }
--- 999,1044 ----
  {
  	std::string hdr, public_part, private_part;
+ 
+ 	// handling methods inherited from the parents
  	std::vector<FCO *>::iterator imp_it = m_parentList[ IMPLEMENTATION ].begin();
  	for( ; imp_it != m_parentList[ IMPLEMENTATION ].end(); ++imp_it)
! 		public_part += (*imp_it)->expose(""); // expose methods of the imp parent
  
  	std::vector<FCO *>::iterator int_it = m_parentList[ INTERFACE ].begin();
  	for( ; int_it != m_parentList[ INTERFACE ].end(); ++int_it)
! 		private_part += (*int_it)->hide(); // hide methods of the int parent
  
  	if ( !private_part.empty())
! 		hdr += "\nprivate: // hidden members (interface inherited)\n" + private_part;
  	if ( !public_part.empty())
! 		hdr += "\npublic: // exposed members (implementation inherited)\n" + public_part;
  
+ 	// Handling methods inherited from the ancestors (excluding parents).
+ 	// Those methods are needed to be exposed/hidden which are inherited from 
+ 	// the IMPLEMENTATION and REGULAR parents, grandparents, ... of my
+ 	// IMPLEMENTATION and INTERFACE parents
+ 	// The INTERFACE parents of my parents do not cause problems since my parent
+ 	// has already hidden such methods (are overwritten throwing exceptions)
+ 	// so this behaviour will result if one of my users will call such inherited methods
+ 	
+ 	// on the IMPLEMENTATION parent's way up we need to expose
  	imp_it = m_parentList[ IMPLEMENTATION ].begin();
  	for( ; imp_it != m_parentList[ IMPLEMENTATION ].end(); ++imp_it)
! 	{
! 		std::vector<FCO *>::iterator imp2_it = (*imp_it)->m_ancestors[ IMPLEMENTATION].begin();
! 		for( ; imp2_it != (*imp_it)->m_ancestors[ IMPLEMENTATION].end(); ++imp2_it)
! 			hdr += (*imp2_it)->expose( (*imp_it)->getDispNameImpl()); // instead of "using GrandParent::get..." the "using Parent::get" form has to be used
! 	}
! 
  	
+ 	// on the INTERFACE parent's way up we need to hide
+ 	int_it = m_parentList[ INTERFACE ].begin();
+ 	for( ; int_it != m_parentList[ INTERFACE ].end(); ++int_it)
+ 	{
+ 		std::vector<FCO *>::iterator int2_it = (*int_it)->m_ancestors[ IMPLEMENTATION].begin();
+ 		for( ; int2_it != (*int_it)->m_ancestors[ IMPLEMENTATION].end(); ++int2_it)
+ 			hdr += (*int2_it)->hide();
+ 	}
+ 
  	return hdr;
  }
***************
*** 1010,1013 ****
--- 1047,1051 ----
  std::string FCO::exposeConnMethods()
  {
+ 	// not used currently
  	std::string h_file;
  	if (!m_connectionMethods.empty())
***************
*** 1015,1031 ****
  	std::vector<Method>::iterator i = m_connectionMethods.begin();
  	for( ; i != m_connectionMethods.end(); ++i)
! 		h_file += i->getExposed() + "\n";
  	return h_file;
  }
  
  
! std::string FCO::exposeAttrMethods()
  {
  	std::string h_file;
  	if (!m_attributeMethods.empty())
! 		h_file += CodeGen::indent(1) + "//\n" + CodeGen::indent(1) + "// exposed attribute getters\n";
  	std::vector<Method>::iterator i = m_attributeMethods.begin();
  	for( ; i != m_attributeMethods.end(); ++i)
! 		h_file += i->getExposed() + "\n";
  	return h_file;
  }
--- 1053,1069 ----
  	std::vector<Method>::iterator i = m_connectionMethods.begin();
  	for( ; i != m_connectionMethods.end(); ++i)
! 		h_file += i->getExposed("blabla") + "\n";
  	return h_file;
  }
  
  
! std::string FCO::exposeAttrMethods( const std::string& repl_container)
  {
  	std::string h_file;
  	if (!m_attributeMethods.empty())
! 		h_file += CodeGen::indent(1) + "//\n" + CodeGen::indent(1) + "// exposed attribute getters and setters\n";
  	std::vector<Method>::iterator i = m_attributeMethods.begin();
  	for( ; i != m_attributeMethods.end(); ++i)
! 		h_file += i->getExposed( repl_container) + "\n";
  	return h_file;
  }
***************
*** 1048,1052 ****
  	std::string h_file;
  	if (!m_attributeMethods.empty())
! 		h_file += CodeGen::indent(1) + "//\n" + CodeGen::indent(1) + "// hidden attribute getters\n";
  	std::vector<Method>::iterator i = m_attributeMethods.begin();
  	for( ; i != m_attributeMethods.end(); ++i)
--- 1086,1090 ----
  	std::string h_file;
  	if (!m_attributeMethods.empty())
! 		h_file += CodeGen::indent(1) + "//\n" + CodeGen::indent(1) + "// hidden attribute getters and setters\n";
  	std::vector<Method>::iterator i = m_attributeMethods.begin();
  	for( ; i != m_attributeMethods.end(); ++i)

Index: FCO.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** FCO.h	17 Mar 2004 20:39:08 -0000	1.10
--- FCO.h	16 Jun 2004 18:35:02 -0000	1.11
***************
*** 167,171 ****
  
  	virtual std::string hideAndExpose();
! 	virtual std::string expose(); //specialize this in the ModelRep, SetRep, ReferenceRep
  	virtual std::string hide(); //specialize this in the ModelRep, SetRep, ReferenceRep
  
--- 167,171 ----
  
  	virtual std::string hideAndExpose();
! 	virtual std::string expose( const std::string& repl); //specialize this in the ModelRep, SetRep, ReferenceRep
  	virtual std::string hide(); //specialize this in the ModelRep, SetRep, ReferenceRep
  
***************
*** 250,254 ****
  	// protected methods
  	std::string exposeConnMethods();
! 	std::string exposeAttrMethods();
  	std::string hideConnMethods();
  	std::string hideAttrMethods();
--- 250,254 ----
  	// protected methods
  	std::string exposeConnMethods();
! 	std::string exposeAttrMethods( const std::string& repl_container);
  	std::string hideConnMethods();
  	std::string hideAttrMethods();

Index: MakeVisitor.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/MakeVisitor.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MakeVisitor.cpp	6 May 2004 22:30:26 -0000	1.4
--- MakeVisitor.cpp	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 23,26 ****
--- 23,28 ----
  			short_form_header_file = "insert_your_specialized_header_filename_here.h";
  	}
+ 	else
+ 		short_form_header_file = global_vars.header_file_name;
  
  	std::string capitalized_name = m_className;

Index: Method.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Method.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Method.cpp	10 Mar 2004 16:42:33 -0000	1.5
--- Method.cpp	16 Jun 2004 18:35:02 -0000	1.6
***************
*** 5,8 ****
--- 5,11 ----
  #include "CodeGen.h"
  
+ static const std::string orn = "//********************************************************************************\n";
+ /*const*/ extern int h_ind;
+ /*const*/ extern int s_ind;
  
  bool MethodLexicographicSort::operator()( const Method& op1, const Method& op2) const
***************
*** 17,20 ****
--- 20,24 ----
  	: m_virtual( true)
  	, m_static( false)
+ 	, m_template( false)
  	, m_returnValue()
  	, m_signature()
***************
*** 27,33 ****
  std::string Method::getHeader()
  {
  	std::string ret_val = (m_virtual?"virtual ":"") + m_returnValue;
  	int fill_size = ret_val.size() < 20? 20 - ret_val.size(): ret_val.size() < 40? 40-ret_val.size(): ret_val.size() < 50? 50-ret_val.size():1;
! 	return CodeGen::indent(1) + ret_val + CodeGen::fill( fill_size) + m_signature + ";";
  }
  
--- 31,45 ----
  std::string Method::getHeader()
  {
+ 	if ( m_template)
+ 	{
+ 		return  CodeGen::indent(h_ind) + orn +
+ 				CodeGen::indent(h_ind) + "// " + m_comment + "\n" +
+ 				CodeGen::indent(h_ind) + orn +
+ 				m_returnValue + CodeGen::indent(2) + m_signature + "\n" + m_implementation;
+ 	}
+ 
  	std::string ret_val = (m_virtual?"virtual ":"") + m_returnValue;
  	int fill_size = ret_val.size() < 20? 20 - ret_val.size(): ret_val.size() < 40? 40-ret_val.size(): ret_val.size() < 50? 50-ret_val.size():1;
! 	return CodeGen::indent(h_ind) + ret_val + CodeGen::fill( fill_size) + m_signature + ";";
  }
  
***************
*** 35,46 ****
  std::string Method::getSource()
  {
! 	const std::string orn = "//*******************************************************************\n";
! 	return orn + "// " + m_comment + "\n" + orn + m_returnValue + " " + m_container->getDispNameImpl() + "::" + m_signature + "\n" + m_implementation;
  }
  
  
! std::string Method::getExposed()
  {
! 	return CodeGen::indent(1) + "using " + m_container->getDispNameImpl() + "::" + m_signature.substr(0, m_signature.find('(')) + ";";
  }
  
--- 47,85 ----
  std::string Method::getSource()
  {
! 	if ( m_template || m_implementation.empty()) // templates or dummies like init/finalize
! 		return "";
! 
! 	ASSERT( m_container);
! 	return 
! 		CodeGen::indent(s_ind) + orn + 
! 		CodeGen::indent(s_ind) + "// " + m_comment + "\n" + 
! 		CodeGen::indent(s_ind) + orn + 
! 		CodeGen::indent(s_ind) + m_returnValue + " " + m_container->getDispNameImpl() + "::" + m_signature + "\n" + 
! 		m_implementation;
  }
  
  
! std::string Method::getExposed( const std::string& repl_cont)
  {
! 	// the using directive needs the immediate parent to be specified before the '::'
! 	// so grandparent's name is not allowed
! 	// i.e: 
! 	//         A<>-----r
! 	//        /|\
! 	//         |
! 	//         B<>-----p
! 	//        /.\
! 	//         |
! 	//         C (implementation inheritance between B and C)
! 	//
! 	//  in such cases C inherits privately from A thus hides to its users the 
! 	//  methods inherited like: getr() and getp()
! 	//  these methods needed to be exposed by 
! 	//  using B::getp;
! 	//  using A::getr; directives
! 	//  but the latter i not allowed (A is granparent of C), so 'using B::getr;' has to be used
! 	//  this is valid since B does have getr() method (inherited)
! 	ASSERT( m_container);
! 	return CodeGen::indent(h_ind) + "using " + (repl_cont.empty()?m_container->getDispNameImpl():repl_cont) + "::" + m_signature.substr(0, m_signature.find('(')) + ";";
  }
  
***************
*** 48,52 ****
  std::string Method::getHidden()
  {
! 	return CodeGen::indent(1) + "virtual " + m_returnValue + " " + m_signature + 
  		" { throw std::string(\"Interface inherited kind. \" + getName() + \" doesn't have " + m_signature + " method.\"); }";
  	
--- 87,91 ----
  std::string Method::getHidden()
  {
! 	return CodeGen::indent(h_ind) + (m_template?"":"virtual ") + m_returnValue + " " + m_signature + 
  		" { throw std::string(\"Interface inherited kind. \" + getName() + \" doesn't have " + m_signature + " method.\"); }";
  	

Index: Method.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Method.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Method.h	26 Feb 2004 17:12:46 -0000	1.2
--- Method.h	16 Jun 2004 18:35:02 -0000	1.3
***************
*** 19,22 ****
--- 19,23 ----
  	bool m_virtual;
  	bool m_static;
+ 	bool m_template;
  	std::string m_returnValue;
  	std::string m_signature;
***************
*** 27,32 ****
  	std::string getHeader();
  	std::string getSource();
! 	std::string getExposed();
  	std::string getHidden();
  	Method();
  	operator bool();
--- 28,34 ----
  	std::string getHeader();
  	std::string getSource();
! 	std::string getExposed( const std::string& repl_containter);
  	std::string getHidden();
+ 
  	Method();
  	operator bool();

Index: ModelRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ModelRep.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ModelRep.cpp	17 Mar 2004 00:24:14 -0000	1.10
--- ModelRep.cpp	16 Jun 2004 18:35:02 -0000	1.11
***************
*** 14,18 ****
  #include "globals.h"
  extern Globals global_vars;
! 
  
  ModelRep::ModelRep( BON::FCO& ptr)
--- 14,18 ----
  #include "globals.h"
  extern Globals global_vars;
! extern int h_ind;
  
  ModelRep::ModelRep( BON::FCO& ptr)
***************
*** 110,114 ****
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = static_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
--- 110,114 ----
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = dynamic_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
***************
*** 164,168 ****
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = static_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
--- 164,168 ----
  		if ( ptr->getMyKind() == Any::MODEL)
  		{
! 			ModelRep * mod_ptr = dynamic_cast< ModelRep *> ( ptr);
  			models.push_back( mod_ptr);
  		}
***************
*** 182,186 ****
  		if ( ptr->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * ref_ptr = static_cast< ReferenceRep *> ( ptr);
  			if ( ref_ptr->pointsToModels())
  				refs.push_back( ref_ptr);
--- 182,186 ----
  		if ( ptr->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * ref_ptr = dynamic_cast< ReferenceRep *> ( ptr);
  			if ( ref_ptr->pointsToModels())
  				refs.push_back( ref_ptr);
***************
*** 225,229 ****
  		if ( (*model_it)->getMyKind() != Any::MODEL)
  			global_vars.err << std::string("ERROR: model inherit\n");
! 		ModelRep * mod_desc_ptr = static_cast<ModelRep*>(*model_it);
  		if (!mod_desc_ptr) global_vars.err << std::string("NULL PTR ERROR: model inherit\n");
  		m_name = mod_desc_ptr->getName();
--- 225,229 ----
  		if ( (*model_it)->getMyKind() != Any::MODEL)
  			global_vars.err << std::string("ERROR: model inherit\n");
! 		ModelRep * mod_desc_ptr = dynamic_cast<ModelRep*>(*model_it);
  		if (!mod_desc_ptr) global_vars.err << std::string("NULL PTR ERROR: model inherit\n");
  		m_name = mod_desc_ptr->getName();
***************
*** 339,344 ****
  	for( ; i != m_methods.end(); ++i)
  	{
! 		h_file += i->getHeader() + "\n";
! 		c_file += i->getSource() + "";
  	}
  
--- 339,349 ----
  	for( ; i != m_methods.end(); ++i)
  	{
! 		if ( !i->m_template)
! 		{
! 			h_file += i->getHeader() + "\n";
! 			c_file += i->getSource() + "";
! 		}
! 		else
! 			h_file += i->getHeader() + "\n";
  	}
  
***************
*** 356,369 ****
  
  
! std::string ModelRep::expose()
  {
  	std::string h_file;
! 	h_file += FCO::expose();
  
  	if (!m_methods.empty())
! 		h_file += "  //\n  // exposed kind and role getters\n";
  	std::vector<Method>::iterator i = m_methods.begin();
  	for( ; i != m_methods.end(); ++i)
! 		h_file += i->getExposed() + "\n";
  
  	return h_file;
--- 361,374 ----
  
  
! std::string ModelRep::expose( const std::string& repl_container)
  {
  	std::string h_file;
! 	h_file += FCO::expose( repl_container);
  
  	if (!m_methods.empty())
! 		h_file += CodeGen::indent(h_ind) + "//\n" + CodeGen::indent(h_ind) + "// exposed kind and role getters\n";
  	std::vector<Method>::iterator i = m_methods.begin();
  	for( ; i != m_methods.end(); ++i)
! 		h_file += i->getExposed( repl_container) + "\n";
  
  	return h_file;
***************
*** 377,381 ****
  
  	if (!m_methods.empty())
! 		h_file += "  //\n  // hidden kind and role getters\n";
  	std::vector<Method>::iterator i = m_methods.begin();
  	for( ; i != m_methods.end(); ++i)
--- 382,386 ----
  
  	if (!m_methods.empty())
! 		h_file += CodeGen::indent(h_ind) + "//\n" + CodeGen::indent(h_ind) + "// hidden kind and role getters\n";
  	std::vector<Method>::iterator i = m_methods.begin();
  	for( ; i != m_methods.end(); ++i)

Index: ModelRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/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:50:18 -0000	1.4
--- ModelRep.h	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 57,61 ****
  	void addMethod(Method& m) { m_methods.push_back( m); }
  	void createMethods();
! 	std::string expose();
  	std::string hide();
  
--- 57,61 ----
  	void addMethod(Method& m) { m_methods.push_back( m); }
  	void createMethods();
! 	std::string expose( const std::string& repl_container);
  	std::string hide();
  

Index: ReferenceRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ReferenceRep.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ReferenceRep.cpp	17 Mar 2004 00:24:14 -0000	1.7
--- ReferenceRep.cpp	16 Jun 2004 18:35:02 -0000	1.8
***************
*** 13,17 ****
  #include "globals.h"
  extern Globals global_vars;
! 
  
  ReferenceRep::ReferenceRep( BON::FCO& ptr)
--- 13,17 ----
  #include "globals.h"
  extern Globals global_vars;
! extern int h_ind;
  
  ReferenceRep::ReferenceRep( BON::FCO& ptr)
***************
*** 112,116 ****
  		if ( m_allReferees[i]->getMyKind() == Any::MODEL && !m_allReferees[i]->isAbstract())
  		{
! 			const ModelRep * c_m = static_cast<const ModelRep*>( m_allReferees[i]);
  			if ( std::find( models.begin(), models.end(), c_m) == models.end())
  				models.push_back( c_m);
--- 112,116 ----
  		if ( m_allReferees[i]->getMyKind() == Any::MODEL && !m_allReferees[i]->isAbstract())
  		{
! 			const ModelRep * c_m = dynamic_cast<const ModelRep*>( m_allReferees[i]);
  			if ( std::find( models.begin(), models.end(), c_m) == models.end())
  				models.push_back( c_m);
***************
*** 170,174 ****
  			else
  			{
! 				ReferenceRep* one_refnce = static_cast<ReferenceRep *>(*refnce_it);
  				one_refnce->addFinalReferees( target_ptr); // put at first place the original referee
  				one_refnce->addFinalReferees( refree_descendants); // adding all the interface desc of target_ptr
--- 170,174 ----
  			else
  			{
! 				ReferenceRep* one_refnce = dynamic_cast<ReferenceRep *>(*refnce_it);
  				one_refnce->addFinalReferees( target_ptr); // put at first place the original referee
  				one_refnce->addFinalReferees( refree_descendants); // adding all the interface desc of target_ptr
***************
*** 204,208 ****
  		else if ( all_referees[current]->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * r = static_cast<ReferenceRep *>( all_referees[current]);
  			// get all referees
  			const RefereeList &list = r->getFinalReferees();
--- 204,208 ----
  		else if ( all_referees[current]->getMyKind() == Any::REF)
  		{
! 			ReferenceRep * r = dynamic_cast<ReferenceRep *>( all_referees[current]);
  			// get all referees
  			const RefereeList &list = r->getFinalReferees();
***************
*** 348,362 ****
  
  
! std::string ReferenceRep::expose() 
  { 
  	std::string h_file;
! 	h_file += FCO::expose();
  
  	if (!m_refGetterMethods.empty())
! 		h_file += "  //\n  // exposed ref getters\n";
  	std::vector<Method>::iterator i = m_refGetterMethods.begin();
  	for( ; i != m_refGetterMethods.end(); ++i)
  	{
! 		h_file += i->getExposed() + "\n";
  	}
  
--- 348,362 ----
  
  
! std::string ReferenceRep::expose( const std::string& repl_container)
  { 
  	std::string h_file;
! 	h_file += FCO::expose( repl_container);
  
  	if (!m_refGetterMethods.empty())
! 		h_file += CodeGen::indent(h_ind) + "//\n" + CodeGen::indent(h_ind) + "// exposed ref getters\n";
  	std::vector<Method>::iterator i = m_refGetterMethods.begin();
  	for( ; i != m_refGetterMethods.end(); ++i)
  	{
! 		h_file += i->getExposed( repl_container) + "\n";
  	}
  
***************
*** 371,375 ****
  	
  	if (!m_refGetterMethods.empty())
! 		h_file += "  //\n  // hidden ref getters\n";
  	std::vector<Method>::iterator i = m_refGetterMethods.begin();
  	for( ; i != m_refGetterMethods.end(); ++i)
--- 371,375 ----
  	
  	if (!m_refGetterMethods.empty())
! 		h_file += CodeGen::indent(h_ind) + "//\n" + CodeGen::indent(h_ind) + "// hidden ref getters\n";
  	std::vector<Method>::iterator i = m_refGetterMethods.begin();
  	for( ; i != m_refGetterMethods.end(); ++i)

Index: ReferenceRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ReferenceRep.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ReferenceRep.h	10 Mar 2004 02:50:18 -0000	1.3
--- ReferenceRep.h	16 Jun 2004 18:35:02 -0000	1.4
***************
*** 41,45 ****
  	std::string dumpUsingLine( FCO *);
  	void createMethods();
! 	std::string expose();
  	std::string hide();
  
--- 41,45 ----
  	std::string dumpUsingLine( FCO *);
  	void createMethods();
! 	std::string expose( const std::string& repl_container);
  	std::string hide();
  

Index: SetRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/SetRep.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SetRep.cpp	17 Mar 2004 00:24:14 -0000	1.8
--- SetRep.cpp	16 Jun 2004 18:35:02 -0000	1.9
***************
*** 6,9 ****
--- 6,10 ----
  #include "SetRep.h"
  #include "CodeGen.h"
+ #include "Dumper.h"
  
  #include "logger.h"
***************
*** 13,17 ****
  #include "globals.h"
  extern Globals global_vars;
! 
  
  SetRep::SetRep( BON::FCO& ptr)
--- 14,18 ----
  #include "globals.h"
  extern Globals global_vars;
! extern int h_ind;
  
  SetRep::SetRep( BON::FCO& ptr)
***************
*** 71,75 ****
  	SetMemberList_Iterator it = m_finalMemberList.begin();
  	for( ; it != m_finalMemberList.end(); ++it)
! 		m_setMethods.push_back( CodeGen::dumpSetGetter( this, *it, "", false, false));
  	
  	// aggregated getter with common ancestor of all potential members
--- 72,82 ----
  	SetMemberList_Iterator it = m_finalMemberList.begin();
  	for( ; it != m_finalMemberList.end(); ++it)
! 	{
! 		if ( Dumper::m_bGenRegular)
! 			m_setMethods.push_back( CodeGen::dumpSetGetter( this, *it, "", false, false));
! 
! 		if ( Dumper::m_bGenTemplates)
! 			m_setMethods.push_back( CodeGen::dumpSetGetterGeneric( this, *it, "", false, false));
! 	}
  	
  	// aggregated getter with common ancestor of all potential members
***************
*** 79,83 ****
  		std::vector<FCO*>::iterator c_it = common_anc.begin();
  		if ( c_it != common_anc.end())
! 			m_setMethods.push_back( CodeGen::dumpSetGetter( this, *c_it, "", true, true)); // generate method for only 1 common ancestor and use the dummy trick to avoid name-conflict with plain getters
  	}
  	else if ( common_anc.empty()) // empty, use common_kind
--- 86,96 ----
  		std::vector<FCO*>::iterator c_it = common_anc.begin();
  		if ( c_it != common_anc.end())
! 		{
! 			if ( Dumper::m_bGenRegular)
! 				m_setMethods.push_back( CodeGen::dumpSetGetter( this, *c_it, "", true, true)); // generate method for only 1 common ancestor and use the dummy trick to avoid name-conflict with plain getters
! 
! 			if ( Dumper::m_bGenTemplates)
! 				m_setMethods.push_back( CodeGen::dumpSetGetterGeneric( this, *c_it, "", true, true)); // generate method for only 1 common ancestor and use the dummy trick to avoid name-conflict with plain getters
! 		}
  	}
  	else if ( common_anc.empty()) // empty, use common_kind
***************
*** 85,89 ****
  		std::string common_kind = FCO::lcdKindIntersect( m_finalMemberList);
  		if ( !common_kind.empty())
! 			m_setMethods.push_back( CodeGen::dumpSetGetter( this, 0, common_kind, true, false));
  		//else one solution remained: BON::FCO this is not adding any service to the plain Bon2 getMembers() call, so omitted
  		else
--- 98,109 ----
  		std::string common_kind = FCO::lcdKindIntersect( m_finalMemberList);
  		if ( !common_kind.empty())
! 		{
! 			if ( Dumper::m_bGenRegular)
! 				m_setMethods.push_back( CodeGen::dumpSetGetter( this, 0, common_kind, true, false));
! 
! 			if ( Dumper::m_bGenTemplates)
! 				m_setMethods.push_back( CodeGen::dumpSetGetterGeneric( this, 0, common_kind, true, false));
! 
! 		}
  		//else one solution remained: BON::FCO this is not adding any service to the plain Bon2 getMembers() call, so omitted
  		else
***************
*** 167,181 ****
  
  
! std::string SetRep::expose()
  {
  	std::string h_file;
! 	h_file += FCO::expose();
  
  	if (!m_setMethods.empty())
! 		h_file += "  //\n  // exposed set getters\n";
  	std::vector<Method>::iterator i = m_setMethods.begin();
  	for( ; i != m_setMethods.end(); ++i)
  	{
! 		h_file += i->getExposed() + "\n";
  	}
  
--- 187,201 ----
  
  
! std::string SetRep::expose( const std::string& repl_container)
  {
  	std::string h_file;
! 	h_file += FCO::expose( repl_container);
  
  	if (!m_setMethods.empty())
! 		h_file += CodeGen::indent(h_ind) + "//\n" + CodeGen::indent(h_ind) + "// exposed set getters\n";
  	std::vector<Method>::iterator i = m_setMethods.begin();
  	for( ; i != m_setMethods.end(); ++i)
  	{
! 		h_file += i->getExposed( repl_container) + "\n";
  	}
  
***************
*** 190,194 ****
  
  	if (!m_setMethods.empty())
! 		h_file += "  //\n  // hidden set getters\n";
  	std::vector<Method>::iterator i = m_setMethods.begin();
  	for( ; i != m_setMethods.end(); ++i)
--- 210,214 ----
  
  	if (!m_setMethods.empty())
! 		h_file += CodeGen::indent(h_ind) + "//\n" + CodeGen::indent(h_ind) + "// hidden set getters\n";
  	std::vector<Method>::iterator i = m_setMethods.begin();
  	for( ; i != m_setMethods.end(); ++i)

Index: SetRep.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/SetRep.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SetRep.h	10 Mar 2004 16:42:33 -0000	1.4
--- SetRep.h	16 Jun 2004 18:35:02 -0000	1.5
***************
*** 41,45 ****
  	std::string setGetterTemplate( const FCO * fco);
  	void createMethods();
! 	std::string expose();
  	std::string hide();
  protected:
--- 41,45 ----
  	std::string setGetterTemplate( const FCO * fco);
  	void createMethods();
! 	std::string expose( const std::string& repl_container);
  	std::string hide();
  protected:



More information about the GME-commit mailing list