[GME-commit]
GMESRC/Paradigms/MetaGME/BonExtension/Rep Any.cpp,1.15,1.16
Any.h,1.10,1.11 AtomRep.cpp,1.4,1.5 AttributeRep.cpp,1.9,1.10
CodeGen.cpp,1.6,1.7 CodeGen.h,1.3,1.4 CodeGenReg.cpp,1.3,1.4
CodeGenTemplate.cpp,1.4,1.5 ConnectionRep.cpp,1.6,1.7
Dumper.cpp,1.16,1.17 Dumper.h,1.9,1.10 FCO.cpp,1.21,1.22
FCO.h,1.15,1.16 FcoRep.cpp,1.4,1.5 FolderRep.cpp,1.9,1.10
FolderRep.h,1.4,1.5 MakeVisitor.cpp,1.6,1.7 MakeVisitor.h,1.1,1.2
Method.cpp,1.6,1.7 ModelRep.cpp,1.12,1.13 ModelRep.h,1.6,1.7
ReferenceRep.cpp,1.9,1.10 SetRep.cpp,1.11,1.12 Sheet.cpp,1.12,1.13
Sheet.h,1.10,1.11
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Fri Sep 22 17:05:49 CDT 2006
- Previous message: [GME-commit]
GMESRC/Paradigms/MetaGME/BonExtension BON2Component.cpp,1.23,1.24
BON2Component.h,1.10,1.11 BonExt.vcproj,1.2,1.3
Component.rc,1.6,1.7 Globals.h,1.7,1.8 LogStream.cpp,1.2,1.3
compicon.ico,1.4,1.5 logger.cpp,1.3,1.4 logger.h,1.3,1.4
resource.h,1.3,1.4
- Next message: [GME-commit] GMESRC/Tools/GMEMerge Merge.h,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep
In directory escher:/tmp/cvs-serv11565/Rep
Modified Files:
Any.cpp Any.h AtomRep.cpp AttributeRep.cpp CodeGen.cpp
CodeGen.h CodeGenReg.cpp CodeGenTemplate.cpp ConnectionRep.cpp
Dumper.cpp Dumper.h FCO.cpp FCO.h FcoRep.cpp FolderRep.cpp
FolderRep.h MakeVisitor.cpp MakeVisitor.h Method.cpp
ModelRep.cpp ModelRep.h ReferenceRep.cpp SetRep.cpp Sheet.cpp
Sheet.h
Log Message:
BonX made "namespacish".
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: CodeGen.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGen.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CodeGen.h 16 Jun 2004 18:35:02 -0000 1.3
--- CodeGen.h 22 Sep 2006 16:05:47 -0000 1.4
***************
*** 19,22 ****
--- 19,33 ----
static std::string indent( int i = 0);
+
+ /**
+ * Visitor related methods
+ */
+
+ static std::string folderKidsTemplate();
+ static std::string modelKidsTemplate();
+ static Method acceptMethod( Any * any, bool pWithTraversalOfKids, bool pSpecialized, bool pRetValBool);
+ //obsolete static Method folderAcceptMethod( Any * cont, bool pWithTraversalOfKids, bool pSpecialized);
+ //static Method modelAcceptMethod( Any * cont, bool pWithTraversalOfKids, bool pSpecialized);
+
/**
* Folder related generators
***************
*** 50,58 ****
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 *);
-
/**
--- 61,68 ----
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, const std::string& nmsp, 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, const std::string& nmsp, Any * cont, Method& m);
static void dumpRoleGetter( FCO* fco, RoleRep * role, ModelRep *);
/**
Index: Method.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Method.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Method.cpp 16 Jun 2004 18:35:02 -0000 1.6
--- Method.cpp 22 Sep 2006 16:05:47 -0000 1.7
***************
*** 55,59 ****
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;
}
--- 55,59 ----
CodeGen::indent(s_ind) + "// " + m_comment + "\n" +
CodeGen::indent(s_ind) + orn +
! CodeGen::indent(s_ind) + m_returnValue + " " + m_container->getValidNmspc() + Any::NamespaceDelimiter_str + m_container->getValidNameImpl() + "::" + m_signature + "\n" +
m_implementation;
}
***************
*** 81,85 ****
// 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('(')) + ";";
}
--- 81,85 ----
// this is valid since B does have getr() method (inherited)
ASSERT( m_container);
! return CodeGen::indent(h_ind) + "using " + (repl_cont.empty()?m_container->getValidNameImpl():repl_cont) + "::" + m_signature.substr(0, m_signature.find('(')) + ";";
}
Index: ModelRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ModelRep.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ModelRep.cpp 30 Jul 2004 00:37:49 -0000 1.12
--- ModelRep.cpp 22 Sep 2006 16:05:47 -0000 1.13
***************
*** 283,292 ****
used when the long form is NOT needed for role
*/
! /*static*/ std::string ModelRep::roleGetterMethodName2(FCO * fco, RoleRep* role, bool use_fco_name)
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getDispName():role->getOnlyRoleName());
#else
! return "get" + (role->getOnlyRoleName().empty()?fco->getDispName():role->getOnlyRoleName());
#endif
}
--- 283,292 ----
used when the long form is NOT needed for role
*/
! /*static*/ std::string ModelRep::roleGetterMethodName2(FCO * fco, RoleRep* role, bool use_fco_name, const std::string& diff_nmsp)
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getValidName():role->getOnlyRoleName());
#else
! return "get" + diff_nmsp + (role->getOnlyRoleName().empty()?fco->getValidName():role->getOnlyRoleName());
#endif
}
***************
*** 296,305 ****
used when the long form is needed for role
*/
! /*static*/ std::string ModelRep::roleGetterMethodName3(FCO * fco, RoleRep* role, bool use_fco_name)
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getDispName():fco->getDispName() + role->getOnlyRoleName());
#else
! return "get" + (role->getOnlyRoleName().empty()?fco->getDispName():fco->getDispName() + role->getOnlyRoleName());
#endif
}
--- 296,305 ----
used when the long form is needed for role
*/
! /*static*/ std::string ModelRep::roleGetterMethodName3(FCO * fco, RoleRep* role, bool use_fco_name, const std::string& diff_nmsp)
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getValidName():fco->getValidName() + role->getOnlyRoleName());
#else
! return "get" + diff_nmsp + (role->getOnlyRoleName().empty()?fco->getValidName():fco->getValidName() + role->getOnlyRoleName());
#endif
}
***************
*** 352,363 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
}
-
-
-
std::string ModelRep::expose( const std::string& repl_container)
--- 352,360 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
}
std::string ModelRep::expose( const std::string& repl_container)
Index: MakeVisitor.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/MakeVisitor.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MakeVisitor.cpp 6 Jan 2005 21:45:52 -0000 1.6
--- MakeVisitor.cpp 22 Sep 2006 16:05:47 -0000 1.7
***************
*** 1,4 ****
--- 1,5 ----
#include "stdafx.h"
#include "MakeVisitor.h"
+ #include "Dumper.h"
#include "algorithm"
***************
*** 7,11 ****
extern Globals global_vars;
! void MakeVisitor::addEntity( Any::KIND_TYPE kind, const std::string& ent)
{
m_entities[kind].push_back( ent);
--- 8,54 ----
extern Globals global_vars;
! /*static*/ ClassAndNamespace ClassAndNamespace::makeIt( Any *ptr)
! {
! return ClassAndNamespace( ptr->getValidName(), ptr->getValidNmspc(), ptr->getStrictNmspc());
! }
!
! ClassAndNamespace::ClassAndNamespace( const std::string& pName, const std::string& pSpace, const std::string& pStrictSpace)
! : m_name( pName)
! , m_space( pSpace)
! , m_strictSpace( pStrictSpace)
! {
! }
!
! std::string ClassAndNamespace::name() const
! {
! return m_name;
! }
!
! std::string ClassAndNamespace::space() const
! {
! return m_space;
! }
!
! std::string ClassAndNamespace::strictSpace() const
! {
! return m_strictSpace;
! }
!
!
!
! std::string ClassAndNamespace::infoName() const
! {
! if( Dumper::m_iVisitSign == 1) // altered, short form like: visitComp
! return m_name;
! else // more informative: visitPicmlComp (namespace included)
! return m_strictSpace + m_name; // used only in places where the concatenation is informative, but not necessarily correct syntactically
! }
!
! std::string ClassAndNamespace::exactType() const
! {
! return m_space + Any::NamespaceDelimiter_str + m_name;
! }
!
! void MakeVisitor::addEntity( Any::KIND_TYPE kind, const ClassAndNamespace& ent)
{
m_entities[kind].push_back( ent);
***************
*** 41,77 ****
mmm += "{\n";
mmm += "\n";
mmm += "class " + m_className + "\n";
mmm += " : public BON::Visitor\n";
mmm += "{\n";
- mmm += " public :\n";
//mmm += " " + m_className + "();\n"; need any constructor?
//mmm += "\n";
- mmm += " void visitObjectImpl( const BON::Object& object );\n";
- if ( !m_entities[Any::FCO_REP].empty())
- mmm += " void visitFCOImpl( const BON::FCO& fco );\n";
- if ( !m_entities[Any::ATOM].empty())
- mmm += " void visitAtomImpl( const BON::Atom& atom );\n";
- if ( !m_entities[Any::SET].empty())
- mmm += " void visitSetImpl( const BON::Set& set);\n";
- if ( !m_entities[Any::REF].empty())
- mmm += " void visitReferenceImpl( const BON::Reference& ref );\n";
- if ( !m_entities[Any::CONN].empty())
- mmm += " void visitConnectionImpl( const BON::Connection& conn);\n";
- if ( !m_entities[Any::MODEL].empty())
- mmm += " void visitModelImpl( const BON::Model& model );\n";
- if ( !m_entities[Any::FOLDER].empty())
- mmm += " void visitFolderImpl( const BON::Folder& fold );\n";
! mmm += " protected :\n";
! for( unsigned int j = 0; j < HOW_MANY_ITEMS; ++j)
! for( unsigned int i = 0; i != m_entities[j].size(); ++i)
{
! std::string name = m_entities[j][i];
! mmm += " virtual bool visit" + name + "( const " + name + "& object );\n";
}
- mmm += "};\n";
mmm += "\n";
! mmm += "}; // namespace\n";
mmm += "\n";
mmm += "#endif // " + capitalized_name + "_H\n";
--- 84,143 ----
mmm += "{\n";
mmm += "\n";
+
mmm += "class " + m_className + "\n";
mmm += " : public BON::Visitor\n";
mmm += "{\n";
//mmm += " " + m_className + "();\n"; need any constructor?
//mmm += "\n";
! mmm += " public : \n";
! mmm += " " + m_className + "();\n"; // constructor
! mmm += " virtual ~" + m_className + "();\n\n"; // destructor
! if( Dumper::m_bGenAcceptSpeci) // custom visitor
! {
!
! // custom visitor does not need the generic visitors
! mmm += " public :\n";
! for( unsigned int j = 0; j < HOW_MANY_ITEMS; ++j)
! for( unsigned int i = 0; i != m_entities[j].size(); ++i)
! {
! ClassAndNamespace& ent = m_entities[j][i];
! mmm += " virtual bool visit" + ent.infoName() + "( const " + ent.exactType() + "& object );\n";
! }
! mmm += "};\n";
! }
! else
{
! mmm += " public :\n";
!
! mmm += " void visitObjectImpl( const BON::Object& object );\n";
! if ( !m_entities[Any::FCO_REP].empty())
! mmm += " void visitFCOImpl( const BON::FCO& fco );\n";
! if ( !m_entities[Any::ATOM].empty())
! mmm += " void visitAtomImpl( const BON::Atom& atom );\n";
! if ( !m_entities[Any::SET].empty())
! mmm += " void visitSetImpl( const BON::Set& set);\n";
! if ( !m_entities[Any::REF].empty())
! mmm += " void visitReferenceImpl( const BON::Reference& ref );\n";
! if ( !m_entities[Any::CONN].empty())
! mmm += " void visitConnectionImpl( const BON::Connection& conn);\n";
! if ( !m_entities[Any::MODEL].empty())
! mmm += " void visitModelImpl( const BON::Model& model );\n";
! if ( !m_entities[Any::FOLDER].empty())
! mmm += " void visitFolderImpl( const BON::Folder& fold );\n";
!
! mmm += " protected :\n";
!
! for( unsigned int j = 0; j < HOW_MANY_ITEMS; ++j)
! for( unsigned int i = 0; i != m_entities[j].size(); ++i)
! {
! ClassAndNamespace& ent = m_entities[j][i];
! mmm += " virtual bool visit" + ent.infoName() + "( const " + ent.exactType() + "& object );\n";
! }
! mmm += "};\n";
}
mmm += "\n";
! mmm += "} // namespace\n";
mmm += "\n";
mmm += "#endif // " + capitalized_name + "_H\n";
***************
*** 90,102 ****
//mmm += "using namespace BON;\n";
mmm += "\nnamespace " + global_vars.m_namespace_name +"\n{\n\n";
for( unsigned int j = 0; j < HOW_MANY_ITEMS; ++j)
for( unsigned int i = 0; i != m_entities[j].size(); ++i)
{
! std::string name = m_entities[j][i];
! mmm += dumpSpecificMethods( name);
}
! mmm += dumpGenericMethods();
! mmm += "\n}; // namespace BON\n\n";
return mmm;
--- 156,175 ----
//mmm += "using namespace BON;\n";
mmm += "\nnamespace " + global_vars.m_namespace_name +"\n{\n\n";
+
+ // ctors
+ mmm += m_className + "::" + m_className + "() { }\n\n";
+ mmm += m_className + "::~" + m_className + "() { }\n\n";
+
for( unsigned int j = 0; j < HOW_MANY_ITEMS; ++j)
for( unsigned int i = 0; i != m_entities[j].size(); ++i)
{
! ClassAndNamespace& ent = m_entities[j][i];
! mmm += dumpSpecificMethods( ent);
}
!
! if( !Dumper::m_bGenAcceptSpeci) // not a custom visitor
! mmm += dumpGenericMethods();
! mmm += "\n} // namespace\n\n";
return mmm;
***************
*** 104,111 ****
! std::string MakeVisitor::dumpSpecificMethods( const std::string& name)
{
std::string mmm;
! mmm+="bool " + m_className + "::visit" + name + "( const " + name + "& object )\n";
mmm+="{\n";
mmm+=" if ( !object)\n";
--- 177,184 ----
! std::string MakeVisitor::dumpSpecificMethods( const ClassAndNamespace& ent)
{
std::string mmm;
! mmm+="bool " + m_className + "::visit" + ent.infoName() + "( const " + ent.exactType() + "& object )\n";
mmm+="{\n";
mmm+=" if ( !object)\n";
***************
*** 135,139 ****
{
for( unsigned int i = 0; i != m_entities[Any::FCO_REP].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::FCO_REP][i] + "( fco))\n";
}
mmm+=" {\n";
--- 208,212 ----
{
for( unsigned int i = 0; i != m_entities[Any::FCO_REP].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::FCO_REP][i].infoName() + "( fco))\n";
}
mmm+=" {\n";
***************
*** 150,154 ****
{
for( unsigned int i = 0; i != m_entities[Any::ATOM].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::ATOM][i] + "( atom))\n";
}
mmm+=" {\n";
--- 223,227 ----
{
for( unsigned int i = 0; i != m_entities[Any::ATOM].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::ATOM][i].infoName() + "( atom))\n";
}
mmm+=" {\n";
***************
*** 165,169 ****
{
for( unsigned int i = 0; i != m_entities[Any::SET].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::SET][i] + "( set))\n";
}
mmm+=" {\n";
--- 238,242 ----
{
for( unsigned int i = 0; i != m_entities[Any::SET].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::SET][i].infoName() + "( set))\n";
}
mmm+=" {\n";
***************
*** 180,184 ****
{
for( unsigned int i = 0; i != m_entities[Any::REF].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::REF][i] + "( ref))\n";
}
mmm+=" {\n";
--- 253,257 ----
{
for( unsigned int i = 0; i != m_entities[Any::REF].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::REF][i].infoName() + "( ref))\n";
}
mmm+=" {\n";
***************
*** 195,199 ****
{
for( unsigned int i = 0; i != m_entities[Any::CONN].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::CONN][i] + "( conn))\n";
}
mmm+=" {\n";
--- 268,272 ----
{
for( unsigned int i = 0; i != m_entities[Any::CONN].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::CONN][i].infoName() + "( conn))\n";
}
mmm+=" {\n";
***************
*** 210,214 ****
{
for( unsigned int i = 0; i != m_entities[Any::MODEL].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::MODEL][i] + "( model))\n";
}
mmm+=" {\n";
--- 283,287 ----
{
for( unsigned int i = 0; i != m_entities[Any::MODEL].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::MODEL][i].infoName() + "( model))\n";
}
mmm+=" {\n";
***************
*** 225,229 ****
{
for( unsigned int i = 0; i != m_entities[Any::FOLDER].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::FOLDER][i] + "( fold))\n";
}
mmm+=" {\n";
--- 298,302 ----
{
for( unsigned int i = 0; i != m_entities[Any::FOLDER].size(); ++i)
! mmm+=" if ( !visit" + m_entities[Any::FOLDER][i].infoName() + "( fold))\n";
}
mmm+=" {\n";
Index: AttributeRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/AttributeRep.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** AttributeRep.cpp 31 Dec 2004 19:51:20 -0000 1.9
--- AttributeRep.cpp 22 Sep 2006 16:05:47 -0000 1.10
***************
*** 253,257 ****
src += "\n" + CodeGen::indent(1) + "else throw(\"None of the possible items\");\n}\n\n\n";
! m2.m_returnValue = container->getDispNameImpl() + "::" + EnumAttributeRep::enumTypeName( this);
m2.m_signature = getMethodName() + "()";
m2.m_container = container;
--- 253,257 ----
src += "\n" + CodeGen::indent(1) + "else throw(\"None of the possible items\");\n}\n\n\n";
! m2.m_returnValue = container->getLValidNameImpl() + "::" + EnumAttributeRep::enumTypeName( this);
m2.m_signature = getMethodName() + "()";
m2.m_container = container;
***************
*** 291,295 ****
m2.m_returnValue = "void";
! m2.m_signature = getSetMethodName() + "( " + container->getDispNameImpl() + "::" + EnumAttributeRep::enumTypeName( this) + " val)";
m2.m_container = container;
m2.m_implementation = src;
--- 291,295 ----
m2.m_returnValue = "void";
! m2.m_signature = getSetMethodName() + "( " + container->getValidNameImpl() + "::" + EnumAttributeRep::enumTypeName( this) + " val)";
m2.m_container = container;
m2.m_implementation = src;
***************
*** 310,314 ****
// 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
--- 310,314 ----
// 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->getValidNameImpl() + "::" + 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
Index: CodeGenReg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGenReg.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CodeGenReg.cpp 22 May 2006 21:20:42 -0000 1.3
--- CodeGenReg.cpp 22 Sep 2006 16:05:47 -0000 1.4
***************
*** 237,241 ****
! /*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;
--- 237,241 ----
! /*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, const std::string& nmsp, Any * cont, Method& m)
{
std::string src, comm;
***************
*** 245,249 ****
src += indent(s_ind + 1) + "std::set<BON::FCO> roles = ModelImpl::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";
--- 245,249 ----
src += indent(s_ind + 1) + "std::set<BON::FCO> roles = ModelImpl::getChildFCOsAs";
src += "(\"";
! src += nmsp + 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";
***************
*** 256,260 ****
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;
--- 256,260 ----
src += indent(s_ind + 0) + "}\n\n\n";
! comm = "getter for role \"" + nmsp + desc_k_name + role_name + "\" among \"" + nmsp + fco_name + "\"s and its descendants";
m.m_virtual = true;
***************
*** 276,285 ****
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";
--- 276,285 ----
mmm = indent(s_ind + 0) + "{\n";
! mmm += indent(s_ind + 1) + "std::set<" + conn->getLValidName() + "> 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->getLValidName() + " c( *it);\n";
mmm += indent(s_ind + 2) + "if (c)\n";
mmm += indent(s_ind + 3) + "result.insert( c);\n";
***************
*** 288,293 ****
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;
--- 288,293 ----
mmm += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "getIn" + conn->getValidName() + "Links()";
! m.m_returnValue = "std::set<" + conn->getLValidName() + ">";
m.m_implementation = mmm;
m.m_container = fco;
***************
*** 306,315 ****
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";
--- 306,315 ----
mmm = indent(s_ind + 0) + "{\n";
! mmm += indent(s_ind + 1) + "std::set<" + conn->getLValidName() + "> 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->getLValidName() + " c( *it);\n";
mmm += indent(s_ind + 2) + "if (c)\n";
mmm += indent(s_ind + 3) + "result.insert( c);\n";
***************
*** 318,323 ****
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;
--- 318,323 ----
mmm += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "getOut" + conn->getValidName() + "Links()";
! m.m_returnValue = "std::set<" + conn->getLValidName() + ">";
m.m_implementation = mmm;
m.m_container = fco;
***************
*** 336,345 ****
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";
--- 336,345 ----
mmm = indent(s_ind + 0) + "{\n";
! mmm += indent(s_ind + 1) + "std::set<" + conn->getLValidName() + "> 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->getLValidName() + " c( *it);\n";
mmm += indent(s_ind + 2) + "if (c)\n";
mmm += indent(s_ind + 3) + "result.insert( c);\n";
***************
*** 348,353 ****
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;
--- 348,353 ----
mmm += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "get" + conn->getValidName() + "Links()";
! m.m_returnValue = "std::set<" + conn->getLValidName() + ">";
m.m_implementation = mmm;
m.m_container = fco;
***************
*** 363,367 ****
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getDispName();
else
peer_lcd = "BON::FCO";
--- 363,367 ----
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getLValidName();
else
peer_lcd = "BON::FCO";
***************
*** 376,380 ****
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;
--- 376,380 ----
nnn += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "get" + conn->getValidName() + "Srcs()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_implementation = nnn;
***************
*** 400,404 ****
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;
--- 400,404 ----
mmm += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "get" + conn->getValidName() + "Srcs()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_implementation = mmm;
***************
*** 416,420 ****
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getDispName();
else
peer_lcd = "BON::FCO";
--- 416,420 ----
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getLValidName();
else
peer_lcd = "BON::FCO";
***************
*** 428,432 ****
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;
--- 428,432 ----
nnn += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "get" + conn->getValidName() + "Dsts()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_implementation = nnn;
***************
*** 450,454 ****
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;
--- 450,454 ----
mmm += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "get" + conn->getValidName() + "Dsts()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_implementation = mmm;
***************
*** 466,470 ****
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getDispName();
else
peer_lcd = "BON::FCO";
--- 466,470 ----
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getLValidName();
else
peer_lcd = "BON::FCO";
***************
*** 478,482 ****
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;
--- 478,482 ----
nnn += indent(s_ind + 0) + "}\n\n\n";
! m.m_signature = "get" + conn->getValidName() + "Ends()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_implementation = nnn;
***************
*** 507,511 ****
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;
--- 507,511 ----
mmm += indent(s_ind + 0) + "}\n\n";
! m.m_signature = "get" + conn->getValidName() + "Ends()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_implementation = mmm;
***************
*** 522,528 ****
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";
--- 522,528 ----
std::string oper1_lcd;
if (fco && fco->isToBeEx())
! oper1_lcd = fco->getLValidName();
else if ( fco && fco->getExtedAnc())
! oper1_lcd = fco->getExtedAnc()->getLValidName();
else
oper1_lcd = "BON::FCO";
***************
*** 569,575 ****
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";
--- 569,575 ----
std::string oper2_lcd;
if (fco && fco->isToBeEx())
! oper2_lcd = fco->getLValidName();
else if ( fco && fco->getExtedAnc())
! oper2_lcd = fco->getExtedAnc()->getLValidName();
else
oper2_lcd = "BON::FCO";
***************
*** 614,627 ****
{
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()];
--- 614,628 ----
{
ASSERT( fco || ( aggreg && !common_kind.empty())); //assert if fco is 0 and aggreg is false
! std::string retval_kind; // the return value cannot be "Compound" if Compound is not extended
if (fco)
{
! retval_kind = fco->getLValidName();
!
if ( !fco->isToBeEx())
{
FCO * ext_anc = fco->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
***************
*** 629,633 ****
}
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);
--- 630,634 ----
}
else if ( !common_kind.empty()) // using the common_kind if set
! retval_kind = common_kind;
else // not intended for usage in such cases
ASSERT(0);
***************
*** 648,652 ****
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
--- 649,653 ----
if ( !aggreg) // not aggregated getter
{
! mmm += indent(s_ind + 2) + "if ( r && r->getObjectMeta().name() == \"" + fco->getLStrictName() + "\")\n";
}
else // aggregated getter, casting to the common base, which is not a common kind
***************
*** 668,672 ****
m.m_container = cont;
if ( !aggreg)
! m.m_comment = "specialized getter for " + fco->getDispName() + " setmembers";
else //aggreg
m.m_comment = "aggregated getter for setmembers";
--- 669,673 ----
m.m_container = cont;
if ( !aggreg)
! m.m_comment = "specialized getter for " + fco->getLValidName() + " setmembers";
else //aggreg
m.m_comment = "aggregated getter for setmembers";
Index: CodeGenTemplate.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGenTemplate.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CodeGenTemplate.cpp 22 May 2006 21:20:42 -0000 1.4
--- CodeGenTemplate.cpp 22 Sep 2006 16:05:47 -0000 1.5
***************
*** 249,253 ****
! /*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;
--- 249,253 ----
! /*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, const std::string& nmsp, Any * cont, Method& tm)
{
std::string src, rtv, sgn, comm;
***************
*** 258,262 ****
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 = ModelImpl::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";
--- 258,262 ----
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 = ModelImpl::getChildFCOsAs(\"" + nmsp + 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";
***************
*** 274,278 ****
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;
--- 274,278 ----
tm.m_implementation = src;
tm.m_container = cont;
! tm.m_comment = "getter for role \"" + nmsp + desc_k_name + role_name + "\" among \"" + nmsp + fco_name + "\"s and its descendants";
return;
***************
*** 287,299 ****
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";
--- 287,299 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
! rtv += indent(h_ind + 0) + "std::set<" + conn->getLValidName() + ", T>";
! sgn = "getIn" + conn->getValidName() + "Links(TDP)";
src = indent(h_ind + 0) + "{\n";
! src += indent(h_ind + 1) + "std::set<" + conn->getLValidName() + ", 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->getLValidName() + " c( *it);\n";
src += indent(h_ind + 2) + "if (c)\n";
src += indent(h_ind + 3) + "result.insert( c);\n";
***************
*** 320,332 ****
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";
--- 320,332 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
! rtv += indent(h_ind + 0) + "std::set<" + conn->getLValidName() + ", T>";
! sgn = "getOut" + conn->getValidName() + "Links(TDP)";
src = indent(h_ind + 0) + "{\n";
! src += indent(h_ind + 1) + "std::set<" + conn->getLValidName() + ", 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->getLValidName() + " c( *it);\n";
src += indent(h_ind + 2) + "if (c)\n";
src += indent(h_ind + 3) + "result.insert( c);\n";
***************
*** 353,365 ****
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";
--- 353,365 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
! rtv += indent(h_ind + 0) + "std::set<" + conn->getLValidName() + ", T>";
! sgn = "get" + conn->getValidName() + "Links(TDP)";
src = indent(h_ind + 0) + "{\n";
! src += indent(h_ind + 1) + "std::set<" + conn->getLValidName() + ", 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->getLValidName() + " c( *it);\n";
src += indent(h_ind + 2) + "if (c)\n";
src += indent(h_ind + 3) + "result.insert( c);\n";
***************
*** 385,389 ****
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getDispName();
else
peer_lcd = "BON::FCO";
--- 385,389 ----
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getLValidName();
else
peer_lcd = "BON::FCO";
***************
*** 396,400 ****
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 = BON::ConnectionEndImpl::getInConnEnds(\"" + conn->getName() + "\");\n";
--- 396,400 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
rtv += indent(h_ind + 0) + "std::multiset<BON::ConnectionEnd, T>";
! sgn = "get" + conn->getValidName() + "Srcs(TDP)";
src = indent(h_ind + 0) + "{\n";
src += indent(h_ind + 1) + "std::multiset<BON::ConnectionEnd> ends = BON::ConnectionEndImpl::getInConnEnds(\"" + conn->getName() + "\");\n";
***************
*** 415,419 ****
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";
--- 415,419 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
rtv += indent(h_ind + 0) + "std::multiset<" + peer_lcd + ", T>";
! sgn = "get" + conn->getValidName() + "Srcs(TDP)";
src = indent(h_ind + 0) + "{\n";
src += indent(h_ind + 1) + "std::multiset<" + peer_lcd + ", T> res;\n";
***************
*** 447,451 ****
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getDispName();
else
peer_lcd = "BON::FCO";
--- 447,451 ----
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getLValidName();
else
peer_lcd = "BON::FCO";
***************
*** 458,462 ****
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 = BON::ConnectionEndImpl::getOutConnEnds(\"" + conn->getName() + "\");\n";
--- 458,462 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
rtv += indent(h_ind + 0) + "std::multiset<BON::ConnectionEnd, T>";
! sgn = "get" + conn->getValidName() + "Dsts(TDP)";
src = indent(h_ind + 0) + "{\n";
src += indent(h_ind + 1) + "std::multiset<BON::ConnectionEnd> ends = BON::ConnectionEndImpl::getOutConnEnds(\"" + conn->getName() + "\");\n";
***************
*** 478,482 ****
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";
--- 478,482 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
rtv += indent(h_ind + 0) + "std::multiset<" + peer_lcd + ", T>";
! sgn = "get" + conn->getValidName() + "Dsts(TDP)";
src = indent(h_ind + 0) + "{\n";
src += indent(h_ind + 1) + "std::multiset<" + peer_lcd + ", T> res;\n";
***************
*** 511,515 ****
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getDispName();
else
peer_lcd = "BON::FCO";
--- 511,515 ----
std::string peer_lcd;
if (peer)
! peer_lcd = peer->getLValidName();
else
peer_lcd = "BON::FCO";
***************
*** 522,526 ****
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 = BON::ConnectionEndImpl::getConnEnds(\"" + conn->getName() + "\");\n";
--- 522,526 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
rtv += indent(h_ind + 0) + "std::multiset<BON::ConnectionEnd, T>";
! sgn = "get" + conn->getValidName() + "Ends(TDP)";
src = indent(h_ind + 0) + "{\n";
src += indent(h_ind + 1) + "std::multiset<BON::ConnectionEnd> ends = BON::ConnectionEndImpl::getConnEnds(\"" + conn->getName() + "\");\n";
***************
*** 541,545 ****
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";
--- 541,545 ----
rtv = indent(h_ind + 0) + "template <class T>\n";
rtv += indent(h_ind + 0) + "std::multiset<" + peer_lcd + ", T>";
! sgn = "get" + conn->getValidName() + "Ends(TDP)";
src = indent(h_ind + 0) + "{\n";
src += indent(h_ind + 1) + "std::multiset<" + peer_lcd + ", T> res;\n";
***************
*** 578,591 ****
{
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()];
--- 578,592 ----
{
ASSERT( fco || ( aggreg && !common_kind.empty())); //assert if fco is 0 and aggreg is false
! std::string retval_kind; // the return value cannot be "Compound" if Compound is not extended
if (fco)
{
! retval_kind = fco->getLValidName();
!
if ( !fco->isToBeEx())
{
FCO * ext_anc = fco->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
***************
*** 593,597 ****
}
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);
--- 594,598 ----
}
else if ( !common_kind.empty()) // using the common_kind if set
! retval_kind = common_kind;
else // not intended for usage in such cases
ASSERT(0);
***************
*** 616,620 ****
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
--- 617,621 ----
if ( !aggreg) // not aggregated getter
{
! src += indent(h_ind + 2) + "if ( r && r->getObjectMeta().name() == \"" + fco->getValidName() + "\")\n";
}
else // aggregated getter, casting to the common base, which is not a common kind
***************
*** 638,642 ****
m.m_container = cont;
if ( !aggreg)
! m.m_comment = "specialized getter for " + fco->getDispName() + " setmembers";
else //aggreg
m.m_comment = "aggregated getter for setmembers";
--- 639,643 ----
m.m_container = cont;
if ( !aggreg)
! m.m_comment = "specialized getter for " + fco->getValidName() + " setmembers";
else //aggreg
m.m_comment = "aggregated getter for setmembers";
Index: FolderRep.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FolderRep.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FolderRep.h 10 Mar 2004 16:42:33 -0000 1.4
--- FolderRep.h 22 Sep 2006 16:05:47 -0000 1.5
***************
*** 40,44 ****
A FolderRep is created by using the id, ptr and resp_ptr which is the object
selected using the SameFolder Selection Mechanism when SameFolder relation is met.
! That is why a folder has to redefine the getName, getDispName operations
*/
FolderRep( BON::FCO& ptr, BON::FCO& resp_ptr);
--- 40,44 ----
A FolderRep is created by using the id, ptr and resp_ptr which is the object
selected using the SameFolder Selection Mechanism when SameFolder relation is met.
! That is why a folder has to redefine the getName operations
*/
FolderRep( BON::FCO& ptr, BON::FCO& resp_ptr);
***************
*** 47,51 ****
/*virtual*/ Any::KIND_TYPE getMyKind() const { return Any::FOLDER; }
/*virtual*/ std::string getName() const;
- /*virtual*/ std::string getDispName() const;
void addFCO( FCO * ptr, const std::string & card);
--- 47,50 ----
***************
*** 60,65 ****
void createMethods();
! static std::string subFolderGetterMethodName(FolderRep * fold);
! static std::string kindGetterMethodName( FCO * fco);
protected:
--- 59,64 ----
void createMethods();
! static std::string subFolderGetterMethodName(FolderRep * fold, const std::string& diff_nmsp);
! static std::string kindGetterMethodName( FCO * fco, const std::string& diff_nmsp);
protected:
Index: Any.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Any.h 21 Oct 2004 02:04:34 -0000 1.10
--- Any.h 22 Sep 2006 16:05:47 -0000 1.11
***************
*** 9,12 ****
--- 9,13 ----
#include "vector"
#include "logger.h"
+ #include <fstream>
class Method;
/** This class is the abstract base of all kinds of parts/FCOs that can occur during a modeling process. */
***************
*** 22,25 ****
--- 23,29 ----
{
public: // constant strings
+ static const std::string NamespaceDispSeparatorBeg_str;//"_"
+ static const std::string NamespaceDispSeparatorEnd_str;//"_"
+ static const std::string NamespaceDelimiter_str;//"::"
static const std::string InRootFolder_str;//"InRootFolder"
static const std::string NameSelectorNode_str; //"myNameIs"
***************
*** 74,84 ****
public:
virtual void initAttributes();
virtual KIND_TYPE getMyKind() const = 0;
std::string getMyKindStr() const;
virtual std::string doDump() = 0;
- virtual std::string getName() const;
- virtual std::string getDispName() const;
BON::FCO getPtr() const { return m_ptr; }
bool isInRootFolder();
--- 78,118 ----
public:
virtual void initAttributes();
+ void initNamespace();
+ void resetNamespace();
+
virtual KIND_TYPE getMyKind() const = 0;
std::string getMyKindStr() const;
virtual std::string doDump() = 0;
+ //
+ // the term 'name' is used in the following ways
+ // validated names: C++ typenames created from the original name, e.g. a return type must be a valid C++ identifier
+ // strict names: metamodel kinds and roles (these are used upon inquiries like getChild, IMPLEMENT_BON macros, and getObjectMeta().name() == "..."
+ //
+ // long names: names prefixed with the namespace
+ // long strict names are meta-conforming kindnames: 'mynamespace::mykind1'
+ // long validated names are valid typenames appearing in the target code: 'mymeta_BONX::mytype' or 'mynamespace::mykind1'
+ // IMPORTANT: if an element in the metamodel is not part of any namespace in the generated BONX it will still be part of
+ // the default main namespace (provided by the user), that is where strict names and validated names will be completely different
+
+ virtual std::string getName() const; // returning the selected name for a kind i.e. "1stNode"
+ std::string getValidName() const; // c++ identifier (validated name) for the kind: "_1stNode"
+ std::string getValidNameImpl() const; // "_1stNodeImpl"
+
+ // short namespace
+ std::string getStrictNmspc() const; // strictly returning the MetaGME def'd namespace (i.e. "NM.1") if defined, otherwise ""
+ std::string getNmspc() const; // the target namespace: "NM.1" if specified in meta, otherwise default namespace "meta5_BONX" (or the user-provided one)
+ std::string getValidNmspc() const; // c++ identifier (validated name) for the namespace "NM.1" -> "NM_1"
+ // LNames = long names: namespace + name
+ std::string getLStrictName() const; // "NM.1::1stNode" or "1stNode"
+ std::string getLName() const; // "NM.1::1stNode" or "meta5_BON::1stNode"
+ std::string getLValidName() const; // "NM_1::_1stNode"
+ std::string getLValidNameImpl() const; // "NM_1::_1stNodeImpl"
+
+ // LNamespace = long namespace: namespace + "::"
+ std::string getLStrictNmspc() const; // "" or "NM.1::"
+ std::string getLNmspc() const; // "NM.1::" or "meta5_BONX::"
+ std::string getLValidNmspc() const; // "NM_1::"
BON::FCO getPtr() const { return m_ptr; }
bool isInRootFolder();
***************
*** 100,107 ****
virtual void prepareIniFin();
void prepareMOF();
void dumpGlobals();
std::string dumpOrnament( bool is_abstract = false);
- std::string getDispNameImpl();
virtual void dumpPre( std::string & h_file, std::string & c_file);
--- 134,141 ----
virtual void prepareIniFin();
void prepareMOF();
+ void createAcceptMethod( bool pWithTraversalOfKids, bool pSpecialized, bool pRetValBool);
void dumpGlobals();
std::string dumpOrnament( bool is_abstract = false);
virtual void dumpPre( std::string & h_file, std::string & c_file);
***************
*** 109,112 ****
--- 143,147 ----
virtual std::string dumpClassHeader();
+
std::string getUserPart();
***************
*** 119,122 ****
--- 154,170 ----
protected:
+ public:
+ void makeBackup();
+ void initOutS();
+ void initOutH( std::string& resu);
+ void finiOutS();
+ void finiOutH();
+ protected:
+ void sendOutS( const std::string& content );
+ void sendOutH( const std::string& content );
+ std::ofstream m_sStream;
+ std::ofstream m_hStream;
+
+ protected:
// pointer of the BON object
BON::FCO m_ptr;
***************
*** 136,139 ****
--- 184,190 ----
std::string m_globalHeader;
std::string m_globalSource;
+
+ // part of this namespace:
+ std::string m_namespace;
private: // forbiding copy
Index: FCO.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** FCO.cpp 26 Sep 2005 20:26:23 -0000 1.21
--- FCO.cpp 22 Sep 2006 16:05:47 -0000 1.22
***************
*** 90,105 ****
- std::string FCO::getDispName() const
- {
- if ( this->m_ptr)
- {
- std::string nm = getName();
- Any::convertToValidName( nm);
- return nm;
- }
- return "NullPtrError";
- }
-
-
void FCO::initAttributes()
{
--- 90,93 ----
***************
*** 437,441 ****
for( ; it != m_nonExtedDescs.end(); ++it)
if ( !(*it)->isAbstract())
! res += ' ' + (*it)->getName();
return res;
--- 425,429 ----
for( ; it != m_nonExtedDescs.end(); ++it)
if ( !(*it)->isAbstract())
! res += ' ' + (*it)->getLStrictNmspc() + (*it)->getName();
return res;
***************
*** 834,838 ****
/*virtual*/ void FCO::prepareMacros()
{
! std::string h, s;
std::string base_list;
bool has_same_kind_parent = false;
--- 822,832 ----
/*virtual*/ void FCO::prepareMacros()
{
! std::string h, s, n = getValidNmspc();
! int c = (n.length() < 15) ? 15-n.length():(
! (n.length() < 30) ? 30-n.length():(
! (n.length() < 45) ? 45-n.length():(
! 0
! )));
!
std::string base_list;
bool has_same_kind_parent = false;
***************
*** 843,847 ****
{
has_same_kind_parent = has_same_kind_parent || ( (*it)->getMyKind() == getMyKind());
! base_list += (*it)->getDispName() + ", ";
}
--- 837,844 ----
{
has_same_kind_parent = has_same_kind_parent || ( (*it)->getMyKind() == getMyKind());
! if( (*it)->getValidNmspc() == n)
! base_list += (*it)->getValidName() + ", ";
! else
! base_list += (*it)->getLValidName() + ", ";
}
***************
*** 850,858 ****
abstract_str = "_ABSTRACT"; //only if it is not intended to be representant of other kinds
if ( bases.empty())
{
! //h = "class " + getDispNameImpl() + ";\n"; commented out on 5/6/2004 not needed
! h = "DECLARE" + abstract_str + "_BONEXTENSION( BON::";
! h += getMyKindStr() + ", " + getDispNameImpl() + ", " + getDispName() + " );\n";
}
else
--- 847,857 ----
abstract_str = "_ABSTRACT"; //only if it is not intended to be representant of other kinds
+ h = "namespace " + n + " { " + std::string( c, ' ');
+
if ( bases.empty())
{
! //h = "class " + getValidNameImpl() + ";\n"; commented out on 5/6/2004 not needed
! h += "DECLARE" + abstract_str + "_BONEXTENSION( BON::";
! h += getMyKindStr() + ", " + getValidNameImpl() + ", " + getValidName() + " ); }\n";
}
else
***************
*** 870,874 ****
{
TO("Currently macros do not support cases of more than 6 base classes");
! global_vars.err << "Serious problem: Currently macros do not support cases of more than 6 base classes. Class : " << getDispName() << "\n";
}
}
--- 869,873 ----
{
TO("Currently macros do not support cases of more than 6 base classes");
! global_vars.err << "Serious problem: Currently macros do not support cases of more than 6 base classes. Class : " << getValidName() << "\n";
}
}
***************
*** 879,891 ****
base_list = "BON::" + getMyKindStr() + ", " + base_list;
}
! //h = "class " + getDispNameImpl() + ";\n"; commented out on 5/6/2004 not needed
! h = "DECLARE" + abstract_str + "_BONEXTENSION" + no_of_bases_str + "( " + base_list + getDispNameImpl() + ", " + getDispName() + " );\n";
}
if ( m_isAbstract && !dump_Non_Exted_Desc_Kinds.empty()) // if abstract and responsible for its descendants
{
// notify the user
! global_vars.err << "Note: " << getDispName() << " is originally an abstract class, but some descendants have it as their only extended ancestor. Abstractness disregarded.\n";
! s = "IMPLEMENT_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName();
s += ", \"" + dump_Non_Exted_Desc_Kinds + "\"";
s += " );\n";
--- 878,890 ----
base_list = "BON::" + getMyKindStr() + ", " + base_list;
}
! //h = "class " + getValidNameImpl() + ";\n"; commented out on 5/6/2004 not needed
! h += "DECLARE" + abstract_str + "_BONEXTENSION" + no_of_bases_str + "( " + base_list + getValidNameImpl() + ", " + getValidName() + " ); }\n";
}
if ( m_isAbstract && !dump_Non_Exted_Desc_Kinds.empty()) // if abstract and responsible for its descendants
{
// notify the user
! global_vars.err << "Note: " << getValidName() << " is originally an abstract class, but some descendants have it as their only extended ancestor. Abstractness disregarded.\n";
! s = "IMPLEMENT_BONEXTENSION( " + getValidNmspc() + Any::NamespaceDelimiter_str + getValidName();
s += ", \"" + dump_Non_Exted_Desc_Kinds + "\"";
s += " );\n";
***************
*** 893,903 ****
else if ( m_isAbstract) // is not responsible for its descendants
{
! s = "IMPLEMENT" + abstract_str + "_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName();
s += " );\n";
}
else // not abstract
{
! s = "IMPLEMENT_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName();
! s += ", \"" + getName() + dump_Non_Exted_Desc_Kinds + "\"";
s += " );\n";
}
--- 892,902 ----
else if ( m_isAbstract) // is not responsible for its descendants
{
! s = "IMPLEMENT" + abstract_str + "_BONEXTENSION( " + getValidNmspc() + Any::NamespaceDelimiter_str + getValidName();
s += " );\n";
}
else // not abstract
{
! s = "IMPLEMENT_BONEXTENSION( " + getValidNmspc() + Any::NamespaceDelimiter_str + getValidName();
! s += ", \"" + getLStrictNmspc() + getName() + dump_Non_Exted_Desc_Kinds + "\"";
s += " );\n";
}
***************
*** 948,951 ****
--- 947,952 ----
// thus C is derived once more (virtually!) from BON::FCO
bool has_private_base_class = false;
+ bool same_nmsp_base = true;
+ std::string my_nmsp = getValidNmspc();
std::string mmm;
***************
*** 955,964 ****
for( ; it != m_parentList[ REGULAR ].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
! list.push_back( "public " + (*it)->getDispNameImpl());
else
! list.push_back( "virtual public " + (*it)->getDispNameImpl());
}
--- 956,966 ----
for( ; it != m_parentList[ REGULAR ].end(); ++it)
{
+ same_nmsp_base = (*it)->getValidNmspc() == my_nmsp;
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( "public " + (same_nmsp_base?(*it)->getValidNameImpl():(*it)->getLValidNameImpl()));
else
! list.push_back( "virtual public " + (same_nmsp_base?(*it)->getValidNameImpl():(*it)->getLValidNameImpl()));
}
***************
*** 966,976 ****
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());
}
--- 968,979 ----
for( ; it != m_parentList[ IMPLEMENTATION ].end(); ++it)
{
+ same_nmsp_base = (*it)->getValidNmspc() == my_nmsp;
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 " + (same_nmsp_base?(*it)->getValidNameImpl():(*it)->getLValidNameImpl()));
else
! list.push_back( "virtual private " + (same_nmsp_base?(*it)->getValidNameImpl():(*it)->getLValidNameImpl()));
}
***************
*** 978,987 ****
for( ; it != m_parentList[ INTERFACE ].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
! list.push_back( "public " + (*it)->getDispNameImpl());
else
! list.push_back( "virtual public " + (*it)->getDispNameImpl());
}
--- 981,991 ----
for( ; it != m_parentList[ INTERFACE ].end(); ++it)
{
+ same_nmsp_base = (*it)->getValidNmspc() == my_nmsp;
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( "public " + (same_nmsp_base?(*it)->getValidNameImpl():(*it)->getLValidNameImpl()));
else
! list.push_back( "virtual public " + (same_nmsp_base?(*it)->getValidNameImpl():(*it)->getLValidNameImpl()));
}
***************
*** 1053,1058 ****
void FCO::dumpPre( std::string & h_file, std::string & c_file)
{
h_file += dumpOrnament( isAbstract());
! h_file += "class " + getDispNameImpl();
h_file += dumpClassHeader() + "{\npublic:\n";
/*if ( isAbstract())
--- 1057,1066 ----
void FCO::dumpPre( std::string & h_file, std::string & c_file)
{
+ // namespace opened in h and cpp files
+ h_file += "namespace " + getValidNmspc() + "\n{\n";
+ //c_file += "namespace " + getValidNmspc() + "\n{\n";
+
h_file += dumpOrnament( isAbstract());
! h_file += "class " + getValidNameImpl();
h_file += dumpClassHeader() + "{\npublic:\n";
/*if ( isAbstract())
***************
*** 1062,1066 ****
--- 1070,1077 ----
for( unsigned int k = 0; k < m_inifinMethods.size(); ++k)
+ {
h_file += m_inifinMethods[k].getHeader() + "\n";
+ c_file += m_inifinMethods[k].getSource();
+ }
h_file += m_classGlobalPart + '\n';
***************
*** 1116,1120 ****
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
}
--- 1127,1131 ----
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)->getValidNameImpl()); // instead of "using GrandParent::get..." the "using Parent::get" form has to be used
}
***************
*** 1264,1268 ****
if (same_kind)
! return Any::KIND_TYPE_STR[ kt];
return "";
}
--- 1275,1279 ----
if (same_kind)
! return "BON::" + Any::KIND_TYPE_STR[ kt];
return "";
}
Index: SetRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/SetRep.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** SetRep.cpp 6 Jan 2005 20:20:43 -0000 1.11
--- SetRep.cpp 22 Sep 2006 16:05:47 -0000 1.12
***************
*** 137,142 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
--- 137,142 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
***************
*** 175,184 ****
#if(LONG_NAMES)
if (fco)
! return "get" + fco->getDispName() + "Members";
else
return "getAllMembers";
#else
if (fco)
! return "get" + fco->getDispName() + "s";
else
return "getAllMembers";
--- 175,190 ----
#if(LONG_NAMES)
if (fco)
! {
! bool same_nmsp = fco->getValidNmspc() == getValidNmspc();
! return "get" + ( same_nmsp ? fco->getValidName() : fco->getValidNmspc() + fco->getValidName())) + "Members";
! }
else
return "getAllMembers";
#else
if (fco)
! {
! bool same_nmsp = fco->getValidNmspc() == getValidNmspc();
! return "get" + ( same_nmsp ? fco->getValidName() : ( fco->getValidNmspc() + fco->getValidName())) + "s";
! }
else
return "getAllMembers";
Index: CodeGen.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGen.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CodeGen.cpp 6 Sep 2005 19:52:06 -0000 1.6
--- CodeGen.cpp 22 Sep 2006 16:05:47 -0000 1.7
***************
*** 2,5 ****
--- 2,7 ----
#include "CodeGen.h"
#include "Dumper.h"
+ #include "MakeVisitor.h"
+
/*const*/ int h_ind = 1;
***************
*** 24,30 ****
/*static*/ void CodeGen::dumpFoldGetter( FolderRep* sub, FolderRep *cont)
{
! std::string method_name = FolderRep::subFolderGetterMethodName( sub);
! std::string retval_folderkind, folderkind;
! retval_folderkind = folderkind = sub->getDispName();
if ( !sub->isToBeEx())
retval_folderkind = "BON::Folder";
--- 26,36 ----
/*static*/ void CodeGen::dumpFoldGetter( FolderRep* sub, FolderRep *cont)
{
! std::string sub_nmsp( sub->getValidNmspc()), fol_nmsp( cont->getValidNmspc()), diff_nmsp( "");
! bool is_diff_nmsp = sub_nmsp != fol_nmsp;
! if( is_diff_nmsp) diff_nmsp = sub_nmsp;
!
! std::string method_name = FolderRep::subFolderGetterMethodName( sub, diff_nmsp);
! std::string retval_folderkind( sub->getLValidName()), folderkind( sub->getLStrictName());
! //retval_folderkind = folderkind = sub->getValidName();
if ( !sub->isToBeEx())
retval_folderkind = "BON::Folder";
***************
*** 44,48 ****
Method m;
! folderGetterGeneric( retval_folderkind, sub->getName(), method_name, sub->isToBeEx(), cont, m);
cont->addMethod( m);
--- 50,54 ----
Method m;
! folderGetterGeneric( retval_folderkind, folderkind, method_name, sub->isToBeEx(), cont, m);
cont->addMethod( m);
***************
*** 53,60 ****
/*static*/ void CodeGen::dumpKindGetter( FCO* fco, FolderRep * cont)
{
! std::string method_name = FolderRep::kindGetterMethodName( fco);
! std::string retval_kind, kind;
! retval_kind = kind = fco->getDispName();
if (!fco->isToBeEx())
--- 59,70 ----
/*static*/ void CodeGen::dumpKindGetter( FCO* fco, FolderRep * cont)
{
! std::string fco_nmsp( fco->getValidNmspc()), fol_nmsp( cont->getValidNmspc()), diff_nmsp( "");
! bool is_diff_nmsp = fco_nmsp != fol_nmsp;
! if( is_diff_nmsp) diff_nmsp = fco_nmsp;
!
! std::string method_name = FolderRep::kindGetterMethodName( fco, diff_nmsp);
! std::string retval_kind( fco->getLValidName()), kind( fco->getLStrictName());
! //retval_kind = kind = fco->getValidName();
if (!fco->isToBeEx())
***************
*** 100,104 ****
if (!(*it)->isAbstract())
{
! kind_vec.push_back( (*it)->getName());
}
}
--- 110,114 ----
if (!(*it)->isAbstract())
{
! kind_vec.push_back( (*it)->getLStrictName());
}
}
***************
*** 160,163 ****
--- 170,179 ----
std::string src, comm;
+
+ std::string fco_nmsp( fco->getValidNmspc()), mod_nmsp( cont->getValidNmspc()), diff_nmsp( "");
+ bool is_diff_nmsp = fco_nmsp != mod_nmsp;
+ if( is_diff_nmsp) diff_nmsp = fco_nmsp;
+
+ std::string l_fco_name = fco->getLName();
std::vector<FCO*> desc;
***************
*** 167,178 ****
if ( !fco->isAbstract())
{
! method_name = ModelRep::roleGetterMethodName2( fco, role, false);
! std::string inquire = role->getSmartRoleName();
! std::string retval_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()];
--- 183,194 ----
if ( !fco->isAbstract())
{
! method_name = ModelRep::roleGetterMethodName2( fco, role, false, diff_nmsp );
! std::string inquire = fco->getLStrictNmspc() + role->getSmartRoleName();
! std::string retval_kind = fco->getLValidName();
if ( !fco->isToBeEx())
{
FCO * ext_anc = fco->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
***************
*** 183,187 ****
Method m;
! roleGetter1( retval_kind, inquire, method_name, fco->getName(), cont, m);
cont->addMethod( m);
--- 199,203 ----
Method m;
! roleGetter1( retval_kind, inquire, method_name, l_fco_name, cont, m);
cont->addMethod( m);
***************
*** 193,197 ****
Method tm;
! roleGetter1Generic( retval_kind, inquire, method_name, fco->getName(), cont, tm);
cont->addMethod( tm);
--- 209,213 ----
Method tm;
! roleGetter1Generic( retval_kind, inquire, method_name, l_fco_name, cont, tm);
cont->addMethod( tm);
***************
*** 202,206 ****
else // has descendants (some of them may be abstract)
{
! method_name = ModelRep::roleGetterMethodName2( fco, role, false);
desc.push_back( fco);
--- 218,222 ----
else // has descendants (some of them may be abstract)
{
! method_name = ModelRep::roleGetterMethodName2( fco, role, false, diff_nmsp);
desc.push_back( fco);
***************
*** 227,238 ****
if ( k >= desc.size()) throw("Index out of bound during dumpRoleGetter");
! method_name = ModelRep::roleGetterMethodName2( desc[k], role, false);
! std::string retval_kind = desc[k]->getDispName();
if( !desc[k]->isToBeEx())
{
FCO * ext_anc = desc[k]->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getDispName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[desc[k]->getMyKind()];
--- 243,254 ----
if ( k >= desc.size()) throw("Index out of bound during dumpRoleGetter");
! method_name = ModelRep::roleGetterMethodName2( desc[k], role, false, diff_nmsp);
! std::string retval_kind = desc[k]->getLValidName();
if( !desc[k]->isToBeEx())
{
FCO * ext_anc = desc[k]->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[desc[k]->getMyKind()];
***************
*** 243,247 ****
//std::string inquire = role->getSmartRoleName();
! std::string inquire = role->getOnlyRoleName().empty()?desc[k]->getName():role->getOnlyRoleName();
if ( Dumper::m_bGenRegular)
--- 259,263 ----
//std::string inquire = role->getSmartRoleName();
! std::string inquire = desc[k]->getLStrictNmspc() + (role->getOnlyRoleName().empty()?desc[k]->getName():role->getOnlyRoleName());
if ( Dumper::m_bGenRegular)
***************
*** 249,253 ****
Method m;
! roleGetter2( retval_kind, inquire, method_name, fco->getName(), cont, m);
cont->addMethod( m);
--- 265,269 ----
Method m;
! roleGetter2( retval_kind, inquire, method_name, l_fco_name, cont, m);
cont->addMethod( m);
***************
*** 259,263 ****
Method tm;
! roleGetter2Generic( retval_kind, inquire, method_name, fco->getName(), cont, tm);
cont->addMethod( tm);
--- 275,279 ----
Method tm;
! roleGetter2Generic( retval_kind, inquire, method_name, l_fco_name, cont, tm);
cont->addMethod( tm);
***************
*** 269,280 ****
// the aggregated can use "short form like" method name
! method_name = ModelRep::roleGetterMethodName2( fco, role, false);
! std::string retval_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()];
--- 285,296 ----
// the aggregated can use "short form like" method name
! method_name = ModelRep::roleGetterMethodName2( fco, role, false, diff_nmsp);
! std::string retval_kind = fco->getLValidName();
if ( !fco->isToBeEx())
{
FCO * ext_anc = fco->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
***************
*** 293,297 ****
if ( !desc[k]->isAbstract())
{
! roles.push_back( desc[k]->getName() + role->getOnlyRoleName());
}
}
--- 309,313 ----
if ( !desc[k]->isAbstract())
{
! roles.push_back( desc[k]->getLStrictNmspc() + desc[k]->getName() + role->getOnlyRoleName());
}
}
***************
*** 301,305 ****
Method m;
! roleGetter3( retval_kind, method_name, fco->getName(), role->getOnlyRoleName(), roles, in_case_of_name_conflict_str, cont, m);
cont->addMethod( m);
--- 317,321 ----
Method m;
! roleGetter3( retval_kind, method_name, l_fco_name, role->getFCOPtr()->getLNmspc() + role->getOnlyRoleName(), roles, in_case_of_name_conflict_str, cont, m);
cont->addMethod( m);
***************
*** 311,315 ****
Method tm;
! roleGetter3Generic( retval_kind, method_name, fco->getName(), role->getOnlyRoleName(), roles, in_case_of_name_conflict_str, cont, tm);
cont->addMethod( tm);
--- 327,331 ----
Method tm;
! roleGetter3Generic( retval_kind, method_name, l_fco_name, role->getFCOPtr()->getLNmspc() + role->getOnlyRoleName(), roles, in_case_of_name_conflict_str, cont, tm);
cont->addMethod( tm);
***************
*** 323,335 ****
if ( !desc[k]->isAbstract())
{
! method_name = ModelRep::roleGetterMethodName3( desc[k], role, false);// separate long form name for each
! std::string retval_kind = desc[k]->getDispName();
if ( !desc[k]->isToBeEx())
{
FCO * ext_anc = desc[k]->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getDispName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[ desc[k]->getMyKind()];
--- 339,351 ----
if ( !desc[k]->isAbstract())
{
! method_name = ModelRep::roleGetterMethodName3( desc[k], role, false, diff_nmsp);// separate long form name for each
! std::string retval_kind = desc[k]->getLValidName();
if ( !desc[k]->isToBeEx())
{
FCO * ext_anc = desc[k]->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[ desc[k]->getMyKind()];
***************
*** 340,344 ****
Method m;
! roleGetter4( retval_kind, method_name, fco->getName(), desc[k]->getName(), role->getOnlyRoleName(), cont, m);
cont->addMethod( m);
--- 356,360 ----
Method m;
! roleGetter4( retval_kind, method_name, fco->getName(), desc[k]->getName(), role->getOnlyRoleName(), fco->getLStrictNmspc(), cont, m);
cont->addMethod( m);
***************
*** 350,354 ****
Method tm;
! roleGetter4Generic( retval_kind, method_name, fco->getName(), desc[k]->getName(), role->getOnlyRoleName(), cont, tm);
cont->addMethod( tm);
--- 366,370 ----
Method tm;
! roleGetter4Generic( retval_kind, method_name, fco->getName(), desc[k]->getName(), role->getOnlyRoleName(), fco->getLStrictNmspc(), cont, tm);
cont->addMethod( tm);
***************
*** 368,380 ****
{
Method m;
! std::string mmm, kind, retval_kind;
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()];
--- 384,397 ----
{
Method m;
! std::string mmm, retval_kind;
if (fco)
{
! retval_kind = fco->getLValidName();
!
if ( !fco->isToBeEx())
{
FCO * ext_anc = fco->getExtedAnc();
if ( ext_anc)
! retval_kind = ext_anc->getLValidName();
else
retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
***************
*** 382,390 ****
}
else if ( !common_kind.empty()) // using the common_kind if set
! retval_kind = kind = "BON::" + common_kind;
else
! retval_kind = kind = "BON::FCO";
- //mmm += kind + " " + getNameImpl() + "::" + refGetterTemplate(fco) + "()\n";
mmm = indent(s_ind + 0) + "{\n";
mmm += indent(s_ind + 1) + "BON::FCO r = BON::ReferenceImpl::getReferred();\n";
--- 399,406 ----
}
else if ( !common_kind.empty()) // using the common_kind if set
! retval_kind = common_kind;
else
! retval_kind = "BON::FCO";
mmm = indent(s_ind + 0) + "{\n";
mmm += indent(s_ind + 1) + "BON::FCO r = BON::ReferenceImpl::getReferred();\n";
***************
*** 400,402 ****
--- 416,595 ----
return m;
}
+
+ /*static*/ std::string CodeGen::folderKidsTemplate()
+ {
+ std::string mmm;
+ mmm = indent(s_ind + 1) + "// then its children\n";
+ mmm += indent(s_ind + 1) + "std::set<BON::Folder> subfolders = BON::FolderImpl::getChildFolders();\n";
+ mmm += indent(s_ind + 1) + "for( std::set<BON::Folder>::const_iterator it = subfolders.begin(); it != subfolders.end(); ++it)\n";
+ mmm += indent(s_ind + 1) + "{\n";
+ mmm += indent(s_ind + 2) + "(*it)->accept( pVisitor);\n";
+ mmm += indent(s_ind + 1) + "}\n\n";
+
+ mmm += indent(s_ind + 1) + "std::set<BON::FCO> children = BON::FolderImpl::getRootFCOs();\n";
+ mmm += indent(s_ind + 1) + "for( std::set<BON::FCO>::const_iterator it = children.begin(); it != children.end(); ++it)\n";
+ mmm += indent(s_ind + 1) + "{\n";
+ mmm += indent(s_ind + 2) + "(*it)->accept( pVisitor);\n";
+ mmm += indent(s_ind + 1) + "}\n";
+
+ return mmm;
+ }
+
+ /*static*/ std::string CodeGen::modelKidsTemplate()
+ {
+ std::string mmm;
+ mmm = indent(s_ind + 1) + "// then its children\n";
+ mmm += indent(s_ind + 1) + "std::set<BON::FCO> children = ModelImpl::getChildFCOs();\n";
+ mmm += indent(s_ind + 1) + "for( std::set<BON::FCO>::const_iterator it = children.begin(); it != children.end(); ++it)\n";
+ mmm += indent(s_ind + 1) + "{\n";
+ mmm += indent(s_ind + 2) + "(*it)->accept( pVisitor);\n";
+ mmm += indent(s_ind + 1) + "}\n";
+
+ return mmm;
+ }
+
+
+ /*static*/ Method CodeGen::acceptMethod( Any * any, bool pWithTraversalOfKids, bool pSpecialized, bool pRetValBool)
+ {
+ std::string kd = any->getMyKindStr();
+ std::string nm = any->getValidName();
+ std::string tp = any->getLValidName();
+ ClassAndNamespace can = ClassAndNamespace::makeIt( any);
+ //std::string sp1 = any->getValidNmspc();
+ //std::string sp2 = any->getNmspc();
+ std::string sp_val = any->getStrictNmspc();
+ Any::convertToValidName( sp_val); // validated namespace name
+
+ Method m;
+ std::string mmm;
+
+ // pWithTraversalOfKids is ignored
+ mmm = indent(s_ind + 0) + "{\n";
+ if( pSpecialized)
+ {
+ mmm += indent(s_ind + 1) + "// visit the " + tp + "\n";
+ //mmm += indent(s_ind + 1) + "pVisitor->visit" + ( Dumper::m_iVisitSign == 1?"":sp_val) + nm + "( " + tp + "( this));\n\n"; // for example: "pVisitor->visitTwoCompound( Two::Compound( this))"
+ if( pRetValBool)
+ {
+ mmm += indent(s_ind + 1) + "bool rv = pVisitor->visit" + can.infoName() + "( " + can.exactType() + "( this));\n";
+ }
+ else
+ {
+ mmm += indent(s_ind + 1) + "pVisitor->visit" + can.infoName() + "( " + can.exactType() + "( this));\n";
+ }
+
+ if( pWithTraversalOfKids) // models
+ {
+ if( any->getMyKind() == Any::MODEL)
+ {
+ mmm += "\n" + modelKidsTemplate();
+ }
+ else if( any->getMyKind() == Any::FOLDER)
+ {
+ mmm += "\n" + folderKidsTemplate();
+ }
+ }
+
+ if( pRetValBool)
+ {
+ mmm += indent(s_ind + 1) + "return rv;\n";
+ }
+ } else
+ {
+ mmm += indent(s_ind + 1) + "// visit the " + kd + "\n";
+ mmm += indent(s_ind + 1) + "pVisitor->visit" + kd + "( BON::" + kd + "( this));\n\n"; // for example: "pVisitor->visitModel( BON::Model( this))"
+
+ if( pWithTraversalOfKids)
+ {
+ if( any->getMyKind() == Any::MODEL)
+ {
+ mmm += modelKidsTemplate();
+ }
+ else if( any->getMyKind() == Any::FOLDER)
+ {
+ mmm += folderKidsTemplate();
+ }
+ }
+ }
+ mmm += indent(s_ind + 0) + "}\n\n\n";
+
+
+ m.m_virtual = true;
+ if( pSpecialized) //accept( SpecVisitor *pVisitor)
+ {
+ m.m_returnValue = pRetValBool ? "bool":"void";
+ m.m_signature = "accept( " + global_vars.m_namespace_name + Any::NamespaceDelimiter_str + MakeVisitor::getVisitorName( Dumper::getInstance()->getValidName()) + " *pVisitor)";
+ }
+ else
+ {
+ m.m_returnValue = "void";
+ m.m_signature = "accept( BON::Visitor *pVisitor)";
+ }
+ m.m_implementation = mmm;
+ m.m_container = any;
+ m.m_comment = "";
+
+
+ return m;
+ }
+
+ ///*obsolete*/
+ ///*static*/ Method CodeGen::folderAcceptMethod( Any * cont, bool pWithTraversalOfKids, bool pSpecialized)
+ //{
+ // Method m;
+ // std::string mmm;
+ //
+ // mmm = indent(s_ind + 0) + "{\n";
+ // mmm += indent(s_ind + 1) + "// visit first the folder\n";
+ // mmm += indent(s_ind + 1) + "pVisitor->visitFolder( BON::Folder( this));\n\n";
+ //
+ // mmm += indent(s_ind + 1) + "// then its children\n";
+ // mmm += indent(s_ind + 1) + "std::set<BON::Folder> subfolders = BON::FolderImpl::getChildFolders();\n";
+ // mmm += indent(s_ind + 1) + "for( std::set<BON::Folder>::const_iterator it = subfolders.begin(); it != subfolders.end(); ++it)\n";
+ // mmm += indent(s_ind + 1) + "{\n";
+ // mmm += indent(s_ind + 2) + "(*it)->accept( pVisitor);\n";
+ // mmm += indent(s_ind + 1) + "}\n\n";
+ //
+ // mmm += indent(s_ind + 1) + "std::set<BON::FCO> children = BON::FolderImpl::getRootFCOs();\n";
+ // mmm += indent(s_ind + 1) + "for( std::set<BON::FCO>::const_iterator it = children.begin(); it != children.end(); ++it)\n";
+ // mmm += indent(s_ind + 1) + "{\n";
+ // mmm += indent(s_ind + 2) + "(*it)->accept( pVisitor);\n";
+ // mmm += indent(s_ind + 1) + "}\n";
+ // mmm += indent(s_ind + 0) + "}\n\n\n";
+ //
+ // m.m_virtual = true;
+ // m.m_returnValue = "void";
+ // m.m_signature = "accept( BON::Visitor *pVisitor)";
+ // m.m_implementation = mmm;
+ // m.m_container = cont;
+ // m.m_comment = "";
+ //
+ // return m;
+ //}
+ //
+ ///*static*/ Method CodeGen::modelAcceptMethod( Any * cont, bool pWithTraversalOfKids, bool pSpecialized)
+ //{
+ // Method m;
+ // std::string mmm;
+ //
+ // mmm = indent(s_ind + 0) + "{\n";
+ // mmm += indent(s_ind + 1) + "// visit first the model\n";
+ // mmm += indent(s_ind + 1) + "pVisitor->visitModel( BON::Model( this));\n\n";
+ // mmm += indent(s_ind + 1) + "// then its children\n";
+ // mmm += indent(s_ind + 1) + "std::set<BON::FCO> children = ModelImpl::getChildFCOs();\n";
+ // mmm += indent(s_ind + 1) + "for( std::set<BON::FCO>::const_iterator it = children.begin(); it != children.end(); ++it)\n";
+ // mmm += indent(s_ind + 1) + "{\n";
+ // mmm += indent(s_ind + 2) + "(*it)->accept( pVisitor);\n";
+ // mmm += indent(s_ind + 1) + "}\n";
+ // mmm += indent(s_ind + 0) + "}\n\n\n";
+ //
+ // m.m_virtual = true;
+ // m.m_returnValue = "void";
+ // m.m_signature = "accept( BON::Visitor *pVisitor)";
+ // m.m_implementation = mmm;
+ // m.m_container = cont;
+ // m.m_comment = "";
+ //
+ // return m;
+ //}
Index: FcoRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FcoRep.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FcoRep.cpp 30 Jul 2004 00:37:49 -0000 1.4
--- FcoRep.cpp 22 Sep 2006 16:05:47 -0000 1.5
***************
*** 24,29 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
--- 24,29 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
Index: AtomRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/AtomRep.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AtomRep.cpp 30 Jul 2004 00:37:49 -0000 1.4
--- AtomRep.cpp 22 Sep 2006 16:05:47 -0000 1.5
***************
*** 24,29 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
--- 24,29 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
Index: ConnectionRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ConnectionRep.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ConnectionRep.cpp 30 Jul 2004 00:37:49 -0000 1.6
--- ConnectionRep.cpp 22 Sep 2006 16:05:47 -0000 1.7
***************
*** 93,98 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
--- 93,98 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
Index: ModelRep.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ModelRep.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ModelRep.h 30 Jul 2004 00:37:49 -0000 1.6
--- ModelRep.h 22 Sep 2006 16:05:47 -0000 1.7
***************
*** 60,65 ****
std::string hide();
! static std::string roleGetterMethodName2( FCO * fco, RoleRep* role, bool use_fco_name);
! static std::string roleGetterMethodName3( FCO * fco, RoleRep* role, bool use_fco_name);
protected:
--- 60,65 ----
std::string hide();
! static std::string roleGetterMethodName2( FCO * fco, RoleRep* role, bool use_fco_name, const std::string& diff_nmsp);
! static std::string roleGetterMethodName3( FCO * fco, RoleRep* role, bool use_fco_name, const std::string& diff_nmsp);
protected:
Index: FCO.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** FCO.h 26 Sep 2005 20:26:23 -0000 1.15
--- FCO.h 22 Sep 2006 16:05:47 -0000 1.16
***************
*** 46,50 ****
/*virtual*/ std::string getName() const;
- /*virtual*/ std::string getDispName() const;
/*virtual*/ void initAttributes();
--- 46,49 ----
Index: Dumper.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** Dumper.cpp 26 Sep 2005 20:26:23 -0000 1.16
--- Dumper.cpp 22 Sep 2006 16:05:47 -0000 1.17
***************
*** 14,25 ****
--- 14,46 ----
#include "SelConf.h"
#include "OptionsDlg.h"
+ #include "MakeVisitor.h"
+
+ const char* Dumper::m_strBonExtenderOptions = "BonExtender_Options";
+ const char* Dumper::Yes_Str = "yes";
+ const char* Dumper::Only_Str = "only";
+ const char* Dumper::No_Str = "no";
+ const char* Dumper::m_strGenVisitor = "GenerateVisitor";
+ const char* Dumper::m_strVisitorSignature = "VisitorSignature";
+ const char* Dumper::m_strGenInitMethod = "GenerateInitMethod";
+ const char* Dumper::m_strGenFiniMethod = "GenerateFiniMethod";
+ const char* Dumper::m_strGenAcceptWithTraversal = "GenerateAcceptMethodWithTraversal";
+ const char* Dumper::m_strGenAcceptSpecialized = "GenerateAcceptMethodSpecialized";
+ const char* Dumper::m_strSpecAcceptRetVal = "SpecializedAcceptReturnValue";
+ const char* Dumper::m_strVCVersion6 = "VCVersion6";
+ const char* Dumper::m_strTemplateGetter = "TemplateGetter";
+ const char* Dumper::m_strOutputInSeparateFile = "OutputInSeparateFile";
+ const char* Dumper::m_strTgtNamespace = "GenerateElementsIntoNamespace";
bool Dumper::m_bParsePrev = false;
bool Dumper::m_bGenInit = false;
bool Dumper::m_bGenFinalize = false;
+ bool Dumper::m_bGenAcceptTrave = false;
+ bool Dumper::m_bGenAcceptSpeci = false;
bool Dumper::m_bGenTemplates = false;
bool Dumper::m_bGenTemplVersion6 = true;
bool Dumper::m_bGenRegular = true;
bool Dumper::m_bGenVisitor = false;
+ int Dumper::m_iVisitSign = 0;
+ int Dumper::m_iSpecAcceptRetVal = 0;
bool Dumper::m_bSafetyBackup = true;
***************
*** 95,101 ****
std::string Dumper::getNamespaceName()
{
! std::string t = m_projName + "_BON";
! Any::convertToValidName( t);
! return t;
}
--- 116,122 ----
std::string Dumper::getNamespaceName()
{
! //std::string t = m_projName + "_BON";
! //Any::convertToValidName( t);
! return m_validProjName + "_BON";
}
***************
*** 103,110 ****
void Dumper::createMethods()
{
! std::string t = m_projName;
! Any::convertToValidName( t);
! MakeVisitor m_visitor( t);
// connections
--- 124,131 ----
void Dumper::createMethods()
{
! //std::string t = m_projName;
! //Any::convertToValidName( t);
! MakeVisitor m_visitor( m_validProjName);
// connections
***************
*** 122,126 ****
//if ( !(*it_cn)->isAbstract())
! m_visitor.addEntity( Any::CONN, (*it_cn)->getDispName());
}
}
--- 143,147 ----
//if ( !(*it_cn)->isAbstract())
! m_visitor.addEntity( Any::CONN, ClassAndNamespace::makeIt(*it_cn));
}
}
***************
*** 138,142 ****
(*it_b)->createMethods();
! m_visitor.addEntity( Any::FOLDER, (*it_b)->getDispName());
}
}
--- 159,163 ----
(*it_b)->createMethods();
! m_visitor.addEntity( Any::FOLDER, ClassAndNamespace::makeIt(*it_b));
}
}
***************
*** 153,157 ****
//if ( !(*it_b)->isAbstract())
! m_visitor.addEntity( Any::FCO_REP, (*it_b)->getDispName());
}
}
--- 174,178 ----
//if ( !(*it_b)->isAbstract())
! m_visitor.addEntity( Any::FCO_REP, ClassAndNamespace::makeIt(*it_b));
}
}
***************
*** 170,174 ****
//if ( !(*it_b)->isAbstract())
! m_visitor.addEntity( Any::ATOM, (*it_b)->getDispName());
}
}
--- 191,195 ----
//if ( !(*it_b)->isAbstract())
! m_visitor.addEntity( Any::ATOM, ClassAndNamespace::makeIt(*it_b));
}
}
***************
*** 187,191 ****
//if ( !(*it_c)->isAbstract())
! m_visitor.addEntity( Any::SET, (*it_c)->getDispName());
}
}
--- 208,212 ----
//if ( !(*it_c)->isAbstract())
! m_visitor.addEntity( Any::SET, ClassAndNamespace::makeIt(*it_c));
}
}
***************
*** 204,208 ****
//if ( !(*it_ref)->isAbstract())
! m_visitor.addEntity( Any::REF, (*it_ref)->getDispName());
}
}
--- 225,229 ----
//if ( !(*it_ref)->isAbstract())
! m_visitor.addEntity( Any::REF, ClassAndNamespace::makeIt(*it_ref));
}
}
***************
*** 221,225 ****
//if ( !(*it_m)->isAbstract())
! m_visitor.addEntity( Any::MODEL, (*it_m)->getDispName());
}
}
--- 242,246 ----
//if ( !(*it_m)->isAbstract())
! m_visitor.addEntity( Any::MODEL, ClassAndNamespace::makeIt(*it_m));
}
}
***************
*** 284,289 ****
std::string res;
! std::set<BON::Model>::iterator it = m_setOfParadigmSheets.begin();
! for( ; it != m_setOfParadigmSheets.end(); ++it)
{
BON::RegistryNode rn = (*it)->getRegistry();
--- 305,310 ----
std::string res;
! std::set<BON::Model>::iterator it = m_setOfParadigmSheets2.begin();
! for( ; it != m_setOfParadigmSheets2.end(); ++it)
{
BON::RegistryNode rn = (*it)->getRegistry();
***************
*** 301,304 ****
--- 322,391 ----
}
+ void Dumper::initOutFiles( std::vector<FCO*>& s, std::string& resu)
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS)
+ {
+ // first make a backup of every file ( move )
+
+ std::vector<FolderRep*>::const_iterator it_b = m_folderList.begin();
+ for( ; it_b != m_folderList.end(); ++it_b)
+ if ( (*it_b)->isToBeEx())
+ {
+ (*it_b)->makeBackup();
+ }
+
+ std::vector<FCO*>::iterator it = s.begin();
+ for( ; it != s.end(); ++it)
+ if ( (*it)->isToBeEx())
+ {
+ (*it)->makeBackup();
+ }
+
+ { // then open files for append
+ std::vector<FolderRep*>::const_iterator it_b = m_folderList.begin();
+ for( ; it_b != m_folderList.end(); ++it_b)
+ if ( (*it_b)->isToBeEx())
+ {
+ (*it_b)->initOutH( resu);
+ (*it_b)->initOutS();
+ }
+ }
+
+ {
+ std::vector<FCO*>::iterator it = s.begin();
+ for( ; it != s.end(); ++it)
+ if ( (*it)->isToBeEx())
+ {
+ (*it)->initOutH( resu);
+ (*it)->initOutS();
+ }
+ }
+ }
+ }
+
+ void Dumper::finiOutFiles( std::vector<FCO*>& s)
+ {
+ {
+ std::vector<FolderRep*>::const_iterator it_b = m_folderList.begin();
+ for( ; it_b != m_folderList.end(); ++it_b)
+ if ( (*it_b)->isToBeEx())
+ {
+ (*it_b)->finiOutH();
+ (*it_b)->finiOutS();
+ }
+ }
+
+ {
+ std::vector<FCO*>::iterator it = s.begin();
+ for( ; it != s.end(); ++it)
+ if ( (*it)->isToBeEx())
+ {
+ (*it)->finiOutH();
+ (*it)->finiOutS();
+ }
+ }
+ }
+
+
void Dumper::doDump()
{
***************
*** 315,318 ****
--- 402,409 ----
std::vector<FCO*> sorted = sortBasedOnLevels();
+ selConf( sorted); // select configuration ->set the toBeDumped member to T/F
+
+ CWaitCursor w;
+
std::string short_name_header_file = shortFileName( global_vars.header_file_name);
std::string capitalized = capitalizeString( cutExtension( short_name_header_file));
***************
*** 321,326 ****
Dumper::getGlobalUserParts( global_user_part1, global_user_part2);
DMP_S("#include \"stdafx.h\"\n");
! DMP_S("#include \"" + short_name_header_file + "\"\n\n");
//DMP_S("using namespace BON;\n\n");
--- 412,424 ----
Dumper::getGlobalUserParts( global_user_part1, global_user_part2);
+ std::string global_includes;
+ initOutFiles( sorted, global_includes);
+
DMP_S("#include \"stdafx.h\"\n");
! DMP_S("#include \"" + short_name_header_file + "\"\n");
! if( Dumper::m_bGenAcceptSpeci)
! DMP_S("#include \"" + shortFileName( global_vars.m_visitorHeaderFileName) + "\"\n");
! DMP_S("\n");
!
//DMP_S("using namespace BON;\n\n");
***************
*** 346,349 ****
--- 444,455 ----
DMP_H("//#define TDP const T & _dummyComp // recommended for VC6 users\n");
}
+ DMP_H("\n// sample less-than comparator (functor)\n");
+ DMP_H("// class Lt { public: bool operator()( const BON::Object& x, const BON::Object& y) { return x->getName().compare( y->getName()) < 0; } };\n");
+ DMP_H("// can be used as follows\n");
+ DMP_H("// std::set< MyObj, Lt > myObjs = c->getMyObj( Lt()); // in VC6\n");
+ DMP_H("// std::set< MyObj, Lt > myObjs = c->getMyObj(); // in VC7.1 and above\n");
+ DMP_H("// beware: must be a partial ordering (implemented like a 'less than') having the following three properties: \n");
+ DMP_H("// A) x < y => !(y < x), B) x < x must be false C) x < y && y < z => x < z\n");
+
DMP_H("\n");
***************
*** 352,364 ****
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");
! selConf( sorted); // select configuration ->set the toBeDumped member to T/F
! CWaitCursor w;
createMethods();
--- 458,472 ----
DMP_H( Any::m_startUPToken + "\n" + global_user_part1 + Any::m_endUPToken + "\n\n");
! //global_vars.m_namespace_name = getNamespaceName();
!
! //DMP_H("namespace " + global_vars.m_namespace_name + "\n{\n\n");
! if( Dumper::m_bGenAcceptSpeci)
! DMP_H("namespace " + global_vars.m_namespace_name + " { class " + MakeVisitor::getVisitorName( m_validProjName) + "; }\n");
DMP_S("\nnamespace BON\n{\n\n");
! //selConf( sorted); // select configuration ->set the toBeDumped member to T/F
! //CWaitCursor w;
createMethods();
***************
*** 366,371 ****
DMP_H("\n\n");
! DMP_S("\n\n}; // end namespace BON\n\n");
! DMP_S("namespace " + getNamespaceName() + "\n{\n");
dumpGlobalMOF();
--- 474,495 ----
DMP_H("\n\n");
!
! if( !global_includes.empty())
! {
! DMP_H( global_includes);
! DMP_H( "\n");
! }
!
! if( Dumper::m_bGenAcceptSpeci)
! DMP_H( "#include \"" + shortFileName( global_vars.m_visitorHeaderFileName) + "\"\n\n");
! // DMP_H("namespace " + global_vars.m_namespace_name + " { class " + MakeVisitor::getVisitorName( m_validProjName) + "; }\n");
! //if( Dumper::m_bGenAcceptSpeci && 0) // if special accept is generated then special visitor header included
! // m_sStream << "#include \"" << shortFileName( global_vars.m_visitorHeaderFileName) << "\"" << std::endl;
!
!
! DMP_S("\n\n} // namespace BON\n\n");
! //DMP_H("\n}; // namespace " + global_vars.m_namespace_name + "\n\n"); // freshly introd'd
! // commented out
! //DMP_S("namespace " + global_vars.m_namespace_name + "\n{\n");
dumpGlobalMOF();
***************
*** 373,377 ****
dumpMain( sorted);
! DMP_H("\n}; // namespace " + getNamespaceName() + "\n\n");
DMP_H( Any::m_startUPToken + "\n" + global_user_part2 + Any::m_endUPToken + "\n\n");
--- 497,502 ----
dumpMain( sorted);
! // commented out
! //DMP_H("\n}; // namespace " + global_vars.m_namespace_name + "\n\n");
DMP_H( Any::m_startUPToken + "\n" + global_user_part2 + Any::m_endUPToken + "\n\n");
***************
*** 379,383 ****
DMP_H("#endif // " + capitalized + "_H\n");
! DMP_S("\n}; // namespace " + getNamespaceName() + "\n\n");
}
--- 504,510 ----
DMP_H("#endif // " + capitalized + "_H\n");
! // commented out
! //DMP_S("\n}; // namespace " + global_vars.m_namespace_name + "\n\n");
! finiOutFiles( sorted);
}
***************
*** 556,560 ****
void Dumper::fetchConfigurationNames( std::vector< std::string>& res)
{
! BON::RegistryNode rn = Sheet::m_BON_Project_Root_Folder->getRegistry()->getChild("BonExtender/SavedConfigurations");
if ( rn)
{
--- 683,687 ----
void Dumper::fetchConfigurationNames( std::vector< std::string>& res)
{
! BON::RegistryNode rn = m_BON_Project_Root_Folder2->getRegistry()->getChild("BonExtender/SavedConfigurations");
if ( rn)
{
***************
*** 588,602 ****
for( std::vector<FolderRep*>::const_iterator it_b = m_folderList.begin(); it_b != m_folderList.end(); ++it_b)
{
! CString name = (*it_b)->getName().c_str();
std::string regVal = (*it_b)->getMyRegistry()->getValueByPath( "/Configs/Default");
! if ( regVal == "false")
! last_id = sc.addEntry( name, 'f', 0, false, "", *it_b);
else
! last_id = sc.addEntry( name, 'f', 0, true, "", *it_b);
}
for( std::vector< FCO *>::iterator it = s.begin(); it != s.end(); ++it)
{
! CString name = (*it)->getName().c_str();
const char kinds[] = "AMCSRF f";
char kind = ' ';
--- 715,730 ----
for( std::vector<FolderRep*>::const_iterator it_b = m_folderList.begin(); it_b != m_folderList.end(); ++it_b)
{
! CString name = (*it_b)->getLStrictName().c_str();
std::string regVal = (*it_b)->getMyRegistry()->getValueByPath( "/Configs/Default");
!
! if( global_vars.silent_mode)
! (*it_b)->toBeEx( regVal != "false");
else
! last_id = sc.addEntry( name, 'f', 0, regVal != "false", "", *it_b);
}
for( std::vector< FCO *>::iterator it = s.begin(); it != s.end(); ++it)
{
! CString name = (*it)->getLStrictName().c_str();
const char kinds[] = "AMCSRF f";
char kind = ' ';
***************
*** 606,610 ****
std::string regVal = (*it)->getMyRegistry()->getValueByPath( "/Configs/Default");
std::string rspVal = (*it)->getMyRegistry()->getValueByPath( "/Configs/Default/Resp");
! if( !(*it)->findRspPtr( rspVal)) // valid info in Responsible registry?
{
rspVal = "";
--- 734,739 ----
std::string regVal = (*it)->getMyRegistry()->getValueByPath( "/Configs/Default");
std::string rspVal = (*it)->getMyRegistry()->getValueByPath( "/Configs/Default/Resp");
! FCO* resp_ptr = (*it)->findRspPtr( rspVal);
! if( !resp_ptr) // valid info in Responsible registry?
{
rspVal = "";
***************
*** 612,619 ****
}
! last_id = sc.addEntry( name, kind, clique, regVal != "false", rspVal.c_str(), *it);
}
! if ( sc.DoModal() == IDOK)
{
wait.Restore();
--- 741,756 ----
}
! if( global_vars.silent_mode)
! {
! (*it)->toBeEx( regVal != "false");
! (*it)->setExtedAnc( resp_ptr);
! }
! else
! {
! last_id = sc.addEntry( name, kind, clique, regVal != "false", rspVal.c_str(), *it);
! }
}
! if ( !global_vars.silent_mode && sc.DoModal() == IDOK)
{
wait.Restore();
***************
*** 621,654 ****
{
std::string path = "/BonExtender/SavedConfigurations/" + sc.m_currSelConfigStr;
! Sheet::m_BON_Project_Root_Folder->getRegistry()->setValueByPath( path, "1");
! }
! // try to select extedAnc for each non to be extended fco
! for( std::vector< FCO *>::iterator it = s.begin(); it != s.end(); ++it)
! {
! /*if ( !(*it)->isToBeEx() && (*it)->isFCO())
! {
! int my_level = (*it)->getLevel( FCO::INTERFACE);
! int closest_to_my_level = -1;
! FCO * selected_extended_anc = 0;
! std::vector< FCO*> ancestors;
! (*it)->getIntAncestors( ancestors);
! std::vector< FCO*>::iterator anc_it = ancestors.begin();
! for( ; anc_it != ancestors.end(); ++anc_it)
! {
! int level_of_ancestor = (*anc_it)->getLevel( FCO::INTERFACE);
! if ( (*anc_it)->isToBeEx() && // it is extended
! level_of_ancestor < my_level && // it is above the *it
! level_of_ancestor > closest_to_my_level ) // better than others
! {
! closest_to_my_level = level_of_ancestor;
! selected_extended_anc = *anc_it;
! }
! }
! if ( closest_to_my_level != -1 && selected_extended_anc != 0)
! {
! (*it)->setExtedAnc( selected_extended_anc);
! selected_extended_anc->addNonExtedDesc( *it);
! }
! }*/
}
}
--- 758,762 ----
{
std::string path = "/BonExtender/SavedConfigurations/" + sc.m_currSelConfigStr;
! m_BON_Project_Root_Folder2->getRegistry()->setValueByPath( path, "1");
}
}
***************
*** 671,675 ****
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)
--- 779,783 ----
if ( existsFile( file_name.c_str()))
{
! std::string backup = file_name + ".bak";
int res = makeFileCopy( file_name.c_str(), backup.c_str());
if ( res == 2)
***************
*** 688,722 ****
! /*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+1);
! }
! 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;
}
--- 796,922 ----
! /*static*/ int Dumper::selectOutputFiles( const std::string& proj_name_to_be_checked, BON::RegistryNode& optRn)
{
std::string proj_name = proj_name_to_be_checked;
Any::convertToValidName( proj_name);
! if( global_vars.m_namespace_name.empty())
! global_vars.m_namespace_name = proj_name + "_BON"; // default namespace provided first time
!
!
! global_vars.header_file_name = proj_name + "BonX.h";;
! global_vars.source_file_name = proj_name + "BonX.cpp";
! global_vars.m_visitorHeaderFileName = proj_name + "Visitor.h";
! global_vars.m_visitorSourceFileName = proj_name + "Visitor.cpp";
! global_vars.header_backup_name = ""; //global_vars.header_file_name + ".bak";
!
!
! // load stored options from registry
! std::string _visitor = optRn->getChild( Dumper::m_strGenVisitor)->getValue();
! std::string _vissign = optRn->getChild( Dumper::m_strVisitorSignature)->getValue();
! std::string _initmtd = optRn->getChild( Dumper::m_strGenInitMethod)->getValue();
! std::string _finimtd = optRn->getChild( Dumper::m_strGenFiniMethod)->getValue();
! std::string _acceptT = optRn->getChild( Dumper::m_strGenAcceptWithTraversal)->getValue();
! std::string _acceptS = optRn->getChild( Dumper::m_strGenAcceptSpecialized)->getValue();
! std::string _acSRetV = optRn->getChild( Dumper::m_strSpecAcceptRetVal)->getValue();
! std::string _vcVers6 = optRn->getChild( Dumper::m_strVCVersion6)->getValue();
! std::string _templGt = optRn->getChild( Dumper::m_strTemplateGetter)->getValue();
! std::string _outSepF = optRn->getChild( Dumper::m_strOutputInSeparateFile)->getValue();
! std::string _tgtNmsp = optRn->getChild( Dumper::m_strTgtNamespace)->getValue();
!
! // set the values of the variables based on registry values, defaulting to the obvious/most common ones in some cases
! m_bGenVisitor = _visitor == Yes_Str;
! m_iVisitSign = _vissign == "1"? 1 : 0;
! m_bGenInit = _initmtd == Yes_Str;
! m_bGenFinalize = _finimtd == Yes_Str;
! m_bGenAcceptTrave = _acceptT == Yes_Str;
! m_bGenAcceptSpeci = _acceptS == Yes_Str;
! m_iSpecAcceptRetVal = _acSRetV == "1"? 1 : 0;
! m_bGenTemplVersion6 = _vcVers6 == Yes_Str;
! if( _templGt == Yes_Str) { m_bGenTemplates = TRUE; m_bGenRegular = TRUE; }
! else if( _templGt == Only_Str) { m_bGenTemplates = TRUE; m_bGenRegular = FALSE; }
! else { m_bGenTemplates = FALSE; m_bGenRegular = TRUE; }
! global_vars.m_outputMethod = _outSepF == Yes_Str ? Globals::OUTPUTMETHOD_ENUM::PERCLASS : Globals::OUTPUTMETHOD_ENUM::ALLTOGETHER;
! global_vars.m_namespace_name = _tgtNmsp.empty() ? global_vars.m_namespace_name : _tgtNmsp; // overwrite the project namespace setting if option found
! if( !global_vars.silent_mode) // show dialog only in verbose mode
{
! OptionsDlg opt;
! opt.m_headerName = global_vars.header_file_name.c_str();
! opt.m_sourceName = global_vars.source_file_name.c_str();
! opt.m_visitorHeaderName = global_vars.m_visitorHeaderFileName.c_str();
! opt.m_visitorSourceName = global_vars.m_visitorSourceFileName.c_str();
! opt.m_prevHeaderName = opt.m_headerName + ".bak";
! // set the values of the variables based on registry values, defaulting to the obvious/most common ones in some cases
! opt.m_bVisitor = m_bGenVisitor;
! opt.m_visitorSignature = m_iVisitSign;
! opt.m_bInit = m_bGenInit;
! opt.m_bFinalize = m_bGenFinalize;
! opt.m_bAcceptTrave = m_bGenAcceptTrave;
! opt.m_bAcceptSpeci = m_bGenAcceptSpeci;
! opt.m_specAcceptRetVal = m_iSpecAcceptRetVal;
! opt.m_version60 = m_bGenTemplVersion6;
! opt.m_whichStyle = m_bGenRegular && m_bGenTemplates ? 2 : m_bGenTemplates?1:0;
! opt.m_methodOfOutput = global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS ? 1 : 0;
! opt.m_namespaceName = global_vars.m_namespace_name.c_str();
!
! if ( opt.DoModal() != IDOK) return 2;
!
! m_bParsePrev = opt.m_bParse == TRUE;
! m_bGenVisitor = opt.m_bVisitor == TRUE;
! m_iVisitSign = opt.m_visitorSignature;
! m_bGenInit = opt.m_bInit == TRUE;
! m_bGenFinalize = opt.m_bFinalize == TRUE;
! m_bGenAcceptTrave = opt.m_bAcceptTrave == TRUE;
! m_bGenAcceptSpeci = opt.m_bAcceptSpeci == TRUE;
! m_iSpecAcceptRetVal = opt.m_specAcceptRetVal;
! m_bGenTemplVersion6 = opt.m_version60 == TRUE;
! m_bGenRegular = opt.m_whichStyle != 1; // 0 or 2
! m_bGenTemplates = opt.m_whichStyle > 0; // 1 or 2 ( = both)
!
! global_vars.m_outputMethod = opt.m_methodOfOutput == 0 ? Globals::OUTPUTMETHOD_ENUM::ALLTOGETHER: Globals::OUTPUTMETHOD_ENUM::PERCLASS;
! global_vars.m_namespace_name = opt.m_namespaceName.IsEmpty() ? "std" : (LPCTSTR) opt.m_namespaceName;
!
! // save options to registry
! optRn->getChild( Dumper::m_strGenVisitor )->setValue( m_bGenVisitor ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strVisitorSignature )->setValue( m_iVisitSign == 1 ? "1" : "0");
! optRn->getChild( Dumper::m_strGenInitMethod )->setValue( m_bGenInit ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strGenFiniMethod )->setValue( m_bGenFinalize ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strGenAcceptWithTraversal)->setValue( m_bGenAcceptTrave ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strGenAcceptSpecialized )->setValue( m_bGenAcceptSpeci ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strSpecAcceptRetVal )->setValue( m_iSpecAcceptRetVal == 1 ? "1" : "0");
! optRn->getChild( Dumper::m_strVCVersion6 )->setValue( m_bGenTemplVersion6 ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strTemplateGetter )->setValue( m_bGenTemplates && m_bGenRegular ? Yes_Str : m_bGenTemplates ? Only_Str : No_Str);
! optRn->getChild( Dumper::m_strOutputInSeparateFile )->setValue( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS ? Yes_Str : No_Str);
! optRn->getChild( Dumper::m_strTgtNamespace )->setValue( global_vars.m_namespace_name);
!
! global_vars.output_directory_name = "";
! int i = opt.m_headerName.ReverseFind('\\');
! if ( i != -1)
! {
! global_vars.output_directory_name = opt.m_headerName.Left( i+1);
! }
!
! 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";
!
! if (m_bGenVisitor)
! {
! global_vars.m_visitorHeaderFileName = opt.m_visitorHeaderName;
! global_vars.m_visitorSourceFileName = opt.m_visitorSourceName;
! }
!
! 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.");
! }
}
***************
*** 735,749 ****
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.");
}
--- 935,938 ----
Index: MakeVisitor.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/MakeVisitor.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MakeVisitor.h 4 Dec 2003 16:45:26 -0000 1.1
--- MakeVisitor.h 22 Sep 2006 16:05:47 -0000 1.2
***************
*** 8,24 ****
#define HOW_MANY_ITEMS 8
class MakeVisitor
{
public:
! MakeVisitor( const std::string& name) { m_className = name + "Visitor"; }
const std::string& getClassName() { return m_className; }
! void addEntity( Any::KIND_TYPE , const std::string&);
std::string dumpVisitorHeader();
std::string dumpVisitorSource();
! std::string dumpSpecificMethods( const std::string& name);
std::string dumpGenericMethods();
protected:
! std::vector<std::string> m_entities[HOW_MANY_ITEMS];
std::string m_className;
};
--- 8,42 ----
#define HOW_MANY_ITEMS 8
+ class ClassAndNamespace
+ {
+ public:
+ static ClassAndNamespace makeIt( Any *);
+
+ ClassAndNamespace( const std::string& pName, const std::string& pSpace, const std::string& pStrictSpace);
+ std::string name() const;
+ std::string space() const;
+ std::string strictSpace() const;
+ std::string infoName() const; // gives back a NMSPKIND form (informative name)
+ std::string exactType() const;// gives back a type NMPS::KIND form (exact C++ type name)
+ private:
+ std::string m_name;
+ std::string m_space;
+ std::string m_strictSpace;
+ };
+
class MakeVisitor
{
public:
! static std::string getVisitorName( const std::string& name) { return name + "Visitor"; }
! MakeVisitor( const std::string& name) { m_className = getVisitorName( name); }
const std::string& getClassName() { return m_className; }
! void addEntity( Any::KIND_TYPE , const ClassAndNamespace&);
std::string dumpVisitorHeader();
std::string dumpVisitorSource();
! std::string dumpSpecificMethods( const ClassAndNamespace& name);
std::string dumpGenericMethods();
protected:
! std::vector< ClassAndNamespace > m_entities[HOW_MANY_ITEMS];
std::string m_className;
};
Index: Sheet.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Sheet.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Sheet.h 3 Nov 2005 19:35:59 -0000 1.10
--- Sheet.h 22 Sep 2006 16:05:47 -0000 1.11
***************
*** 34,37 ****
--- 34,38 ----
virtual bool finalize();
void setProject( BON::Project& project );
+ std::string getValidName() { return m_validProjName; }
FcoRep* createFcoRep( BON::FCO& ptr, BON::FCO& resp_ptr);
***************
*** 51,57 ****
Any* findAny( const BON::FCO& ptr);
! static BON::Folder m_BON_Project_Root_Folder;
! static std::set<BON::Model> m_setOfParadigmSheets;
protected:
--- 52,60 ----
Any* findAny( const BON::FCO& ptr);
! std::string getNamespace() { return m_projNamespace; }
! BON::Folder m_BON_Project_Root_Folder2;
!
! std::set<BON::Model> m_setOfParadigmSheets2;
protected:
***************
*** 95,98 ****
--- 98,104 ----
std::string m_projName;
+ std::string m_validProjName;
+ std::string m_projNamespace;
+ std::string m_validProjNamespace;
RootFolder m_rootFolder;
Index: ReferenceRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ReferenceRep.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ReferenceRep.cpp 30 Jul 2004 00:37:49 -0000 1.9
--- ReferenceRep.cpp 22 Sep 2006 16:05:47 -0000 1.10
***************
*** 278,283 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
--- 278,283 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
***************
*** 336,345 ****
#if(LONG_NAMES)
if (fco)
! return "get" + fco->getDispName() + "Referred";
else
return "getReferred";
#else
if (fco)
! return "get" + fco->getDispName();
else
return "getReferred";
--- 336,348 ----
#if(LONG_NAMES)
if (fco)
! return "get" + fco->getValidName() + "Referred";
else
return "getReferred";
#else
if (fco)
! {
! bool same_nmsp = fco->getValidNmspc() == getValidNmspc();
! return "get" + ( same_nmsp ? fco->getValidName() : ( fco->getValidNmspc() + fco->getValidName()));
! }
else
return "getReferred";
Index: Sheet.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Sheet.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Sheet.cpp 15 Feb 2006 17:58:34 -0000 1.12
--- Sheet.cpp 22 Sep 2006 16:05:47 -0000 1.13
***************
*** 10,18 ****
Sheet * Sheet::m_theOnlyInstance = 0;
- /*static*/ BON::Folder Sheet::m_BON_Project_Root_Folder = BON::Folder(); // important: clear its content upon destruction
- /*static*/ std::set<BON::Model> Sheet::m_setOfParadigmSheets; // do the same as above
Sheet::Sheet()
: m_projName(""),
m_rootFolder(),
m_fcoRepList(),
--- 10,19 ----
Sheet * Sheet::m_theOnlyInstance = 0;
Sheet::Sheet()
: m_projName(""),
+ m_validProjName(""),
+ m_projNamespace(""),
+ m_validProjNamespace(""),
m_rootFolder(),
m_fcoRepList(),
***************
*** 110,115 ****
m_attributeList.clear();
! Sheet::m_BON_Project_Root_Folder = BON::Folder();
! Sheet::m_setOfParadigmSheets.clear();
}
--- 111,119 ----
m_attributeList.clear();
!
! m_BON_Project_Root_Folder2 = BON::Folder();
!
! m_setOfParadigmSheets2.erase( m_setOfParadigmSheets2.begin(), m_setOfParadigmSheets2.end());
! m_setOfParadigmSheets2.clear();
}
***************
*** 117,121 ****
void Sheet::setProject( BON::Project& project)
{
! m_projName = project->getName();
}
--- 121,133 ----
void Sheet::setProject( BON::Project& project)
{
! m_validProjName = m_projName = project->getName();
! Any::convertToValidName( m_validProjName);
!
! BON::RegistryNode rn = project->getRootFolder()->getRegistry()->getChild( "Namespace");
! if( rn) m_validProjNamespace = m_projNamespace = rn->getValue();
! else m_validProjNamespace = m_projNamespace = "";
!
! // convert the namespace specified (can be empty) to a valid identifier
! Any::convertToValidName( m_validProjNamespace);
}
***************
*** 143,146 ****
--- 155,159 ----
for( ; it0 != m_fcoRepList.end(); ++it0 )
{
+ (*it0)->initNamespace();
(*it0)->initAttributes();
if ( isInRootFolder( *it0)) m_rootFolder.addRootElement( *it0);
***************
*** 150,153 ****
--- 163,167 ----
for( ; it1 != m_atomList.end(); ++it1 )
{
+ (*it1)->initNamespace();
(*it1)->initAttributes();
if ( isInRootFolder( *it1)) m_rootFolder.addRootElement( *it1);
***************
*** 157,160 ****
--- 171,175 ----
for( ; it2 != m_modelList.end(); ++it2 )
{
+ (*it2)->initNamespace();
(*it2)->initAttributes();
if ( isInRootFolder( *it2)) m_rootFolder.addRootElement( *it2);
***************
*** 164,167 ****
--- 179,183 ----
for( ; it3 != m_connList.end(); ++it3 )
{
+ (*it3)->initNamespace();
(*it3)->initAttributes();
if ( isInRootFolder( *it3)) m_rootFolder.addRootElement( *it3);
***************
*** 171,174 ****
--- 187,191 ----
for( ; it4 != m_setList.end(); ++it4 )
{
+ (*it4)->initNamespace();
(*it4)->initAttributes();
if ( isInRootFolder( *it4)) m_rootFolder.addRootElement( *it4);
***************
*** 178,181 ****
--- 195,199 ----
for( ; it5 != m_refList.end(); ++it5 )
{
+ (*it5)->initNamespace();
(*it5)->initAttributes();
if ( isInRootFolder( *it5)) m_rootFolder.addRootElement( *it5);
***************
*** 185,191 ****
--- 203,216 ----
for( ; it6 != m_folderList.end(); ++it6 )
{
+ (*it6)->initNamespace();
(*it6)->initAttributes();
if ( isInRootFolder( *it6)) m_rootFolder.addSubFolder( *it6);
}}
+
+ {AttributeRep_Iterator it7 = m_attributeList.begin();
+ for( ; it7 != m_attributeList.end(); ++it7 )
+ {
+ (*it7)->initNamespace();
+ }}
}
***************
*** 859,861 ****
}
return true;
! }
\ No newline at end of file
--- 884,886 ----
}
return true;
! }
Index: FolderRep.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FolderRep.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** FolderRep.cpp 30 Jul 2004 00:37:49 -0000 1.9
--- FolderRep.cpp 22 Sep 2006 16:05:47 -0000 1.10
***************
*** 57,68 ****
- std::string FolderRep::getDispName() const
- {
- std::string nm = getName();
- Any::convertToValidName( nm);
- return nm; //+ "Ex";mod 2/2/2004
- }
-
-
void FolderRep::addFCO( FCO * ptr, const std::string& card)
{
--- 57,60 ----
***************
*** 156,182 ****
dumpPost( h_file, c_file);
! DMP_H( h_file);
! DMP_S( c_file);
return "";
}
!
! /*static*/ std::string FolderRep::subFolderGetterMethodName(FolderRep * fold)
{
#if(LONG_NAMES)
! return "get_Sub_" + fold->getDispName();
#else
! return "get" + fold->getDispName();
#endif
}
! /*static*/ std::string FolderRep::kindGetterMethodName(FCO * fco)
{
#if(LONG_NAMES)
! return "get_Kind_" + fco->getDispName();
#else
! return "get" + fco->getDispName();
#endif
}
--- 148,173 ----
dumpPost( h_file, c_file);
! sendOutH( h_file);//DMP_H( h_file);
! sendOutS( c_file);//DMP_S( c_file);
return "";
}
! /*static*/ std::string FolderRep::subFolderGetterMethodName(FolderRep * fold, const std::string& diff_nmsp)
{
#if(LONG_NAMES)
! return "get_Sub_" + fold->getValidName();
#else
! return "get" + diff_nmsp + fold->getValidName();
#endif
}
! /*static*/ std::string FolderRep::kindGetterMethodName(FCO * fco, const std::string& diff_nmsp)
{
#if(LONG_NAMES)
! return "get_Kind_" + fco->getValidName();
#else
! return "get" + diff_nmsp + fco->getValidName();
#endif
}
Index: Any.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Any.cpp 21 Jun 2005 20:22:53 -0000 1.15
--- Any.cpp 22 Sep 2006 16:05:47 -0000 1.16
***************
*** 8,11 ****
--- 8,12 ----
#include "Method.h"
#include "Dumper.h"
+ #include "MakeVisitor.h"
#include "algorithm"
***************
*** 17,20 ****
--- 18,24 ----
/*static*/ const std::string Any::m_startUPToken = "///BUP";
/*static*/ const std::string Any::m_endUPToken = "///EUP";
+ /*static*/ const std::string Any::NamespaceDispSeparatorBeg_str = "_";
+ /*static*/ const std::string Any::NamespaceDispSeparatorEnd_str = "_";
+ /*static*/ const std::string Any::NamespaceDelimiter_str = "::";
/*static*/ const std::string Any::InRootFolder_str = "InRootFolder";
/*static*/ const std::string Any::NameSelectorNode_str = "myNameIs";
***************
*** 74,77 ****
--- 78,125 ----
}
+ void Any::initNamespace()
+ {
+ // decide which namespace the object belongs to:
+ if( m_ptr->isInLibrary())
+ {
+ bool all_equivs_in_lib = true;
+ for ( std::set< BON::FCO >::const_iterator it = m_equivs.begin()
+ ; all_equivs_in_lib && it != m_equivs.end()
+ ; ++it)
+ {
+ if ( *it == m_ptr) continue;
+ if ((*it)->getObjectMeta().name().find("Proxy") != std::string::npos) continue;//ignore proxies (from m_equivs) when determining namespace
+ all_equivs_in_lib = (*it)->isInLibrary();
+ }
+
+ if( !all_equivs_in_lib) // it has equivs in the host project
+ resetNamespace(); // so needs to be in the main namespace
+ else
+ {
+ // if object is from a library its m_parentFolder variable holds the librootfolder (a readwriteable object)
+ ASSERT( !m_parentFolder->isInLibrary());
+ BON::Folder parent( m_parentFolder);
+ while( parent && parent->isInLibrary()) {
+ parent = parent->getParentFolder();
+ } // the first parent which is not in the library is the LibRootFolder
+
+ BON::RegistryNode rn;
+ if( parent) rn = parent->getRegistry()->getChild( "Namespace");
+
+ if( rn) m_namespace = rn->getValue();
+ else m_namespace = "";
+ //m_respPointer could be in another library then m_ptr, so the namespace could be different
+ }
+ }
+ else // regular object, init its namespace value from the project's value
+ {
+ resetNamespace();
+ }
+ }
+
+ void Any::resetNamespace()
+ {
+ m_namespace = Dumper::getInstance()->getNamespace();
+ }
// applicable for folders only
***************
*** 133,137 ****
! std::string Any::getDispName() const
{
if ( this->m_ptr)
--- 181,185 ----
! std::string Any::getValidName() const
{
if ( this->m_ptr)
***************
*** 144,153 ****
}
! std::string Any::getDispNameImpl()
{
! return getDispName() + "Impl";
}
std::string Any::getMyKindStr() const
--- 192,257 ----
}
+ std::string Any::getStrictNmspc() const
+ {
+ return m_namespace.empty()?"": m_namespace;
+ }
! std::string Any::getLStrictNmspc() const
{
! return m_namespace.empty()?"": (m_namespace + Any::NamespaceDelimiter_str);
! }
!
! std::string Any::getNmspc() const
! {
! // will return global_vars.m_namespace_name if m_namespace empty
! // i.e. "meta5_BON" or "NSP"
! return m_namespace.empty()?global_vars.m_namespace_name: m_namespace;
! }
!
! std::string Any::getLNmspc() const
! {
! std::string t = getNmspc();
! Any::convertToValidName( t);
! return t + Any::NamespaceDelimiter_str;
! }
!
! std::string Any::getValidNmspc() const
! {
! // returns "_meta5_1" validated form of "1meta5.1"
! std::string t = getNmspc();
! Any::convertToValidName( t);
! return t;
! }
!
! std::string Any::getLStrictName() const
! {
! return getLStrictNmspc() + getName();
! }
!
! std::string Any::getLName() const
! {
! return getLNmspc() + getName();
! }
!
! std::string Any::getLValidNmspc() const
! {
! std::string t = getValidNmspc();
! return t.empty()?"": t + Any::NamespaceDelimiter_str;
! }
!
! std::string Any::getLValidName() const
! {
! return getLValidNmspc() + getValidName();
! }
!
! std::string Any::getValidNameImpl() const
! {
! return getValidName() + "Impl";
}
+ std::string Any::getLValidNameImpl() const
+ {
+ return getLValidNmspc() + getValidNameImpl();
+ }
std::string Any::getMyKindStr() const
***************
*** 262,271 ****
void Any::prepareMacros()
{
! std::string h, s;
! //h = "class " + getDispNameImpl() + ";\n"; removed on 5/6/2004 not needed
! h = "DECLARE_BONEXTENSION( BON::" + getMyKindStr() + ", " + getDispNameImpl() + ", " + getDispName() + " );\n";
! s = "IMPLEMENT_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName() + ", \"" + getName() + "\" );\n";
m_globalSource += s;
--- 366,383 ----
void Any::prepareMacros()
{
! std::string h, s, n = getValidNmspc();
! int c = (n.length() < 15) ? 15-n.length():(
! (n.length() < 30) ? 30-n.length():(
! (n.length() < 45) ? 45-n.length():(
! 0
! )));
! //h = "class " + getValidNameImpl() + ";\n"; removed on 5/6/2004 not needed
! h = "namespace " + n + " { " + std::string( c, ' ');
! h += "DECLARE_BONEXTENSION( BON::" + getMyKindStr() + ", " + getValidNameImpl() + ", " + getValidName() + " ); }\n";
! //h = "DECLARE_BONEXTENSION( BON::" + getMyKindStr() + ", " + getValidNameImpl() + ", " + getValidName() + " );\n";
! //s = "IMPLEMENT_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getValidName() + ", \"" + getNmspc() + "::" + getName() + "\" );\n";
! s = "IMPLEMENT_BONEXTENSION( " + getValidNmspc() + Any::NamespaceDelimiter_str + getValidName() + ", \"" + getLStrictNmspc() + getName() + "\" );\n";
m_globalSource += s;
***************
*** 291,296 ****
--- 403,431 ----
if ( Dumper::m_bGenFinalize) m_inifinMethods.push_back( i);
+
+ // Dumper::m_bGenAcceptTrave: 0 1 0 1
+ // Dumper::m_bGenAcceptSpeci: 0 0 1 1
+ // 0, 0: none
+ // 1, 0: builtin visitor style with traversal
+ // 0, 1: special visitor style without traversal
+ // 1, 1: special visitor style with traversal
+ createAcceptMethod( Dumper::m_bGenAcceptTrave, Dumper::m_bGenAcceptSpeci, Dumper::m_iSpecAcceptRetVal == 1);
+
+ //if ( getMyKind() != FCO_REP && Dumper::m_bGenAcceptTrave)
+ //{
+ // m_inifinMethods.push_back( this->createAcceptMethod());
+ //}
+ //if ( Dumper::m_bGenAcceptSpeci)
+ //{
+ // m_inifinMethods.push_back( this->createSpecAcceptMethod());
+ //}
}
+ void Any::createAcceptMethod( bool pWithTraversalOfKids, bool pSpecialized, bool pRetValBool)
+ {
+ Method m = CodeGen::acceptMethod( this, pWithTraversalOfKids, pSpecialized, pRetValBool);
+ if( pSpecialized || getMyKind() != FCO_REP) // there is no such thing that visitFCO in the built in BON::Visitor
+ m_inifinMethods.push_back( m);
+ }
/*static*/ std::string Any::parseMOFException( const std::string& exc_str)
***************
*** 447,451 ****
{
std::string row;
! row = "// C L A S S " + getDispNameImpl() + "\n";//(is_abstract?" abstract":"") + " class\n";
const std::string orn = "//*******************************************************************\n";
--- 582,586 ----
{
std::string row;
! row = "// C L A S S " + getValidNameImpl() + "\n";//(is_abstract?" abstract":"") + " class\n";
const std::string orn = "//*******************************************************************\n";
***************
*** 457,466 ****
void Any::dumpPre( std::string & h_file, std::string & c_file)
{
h_file += dumpOrnament();
! 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";
}
--- 592,608 ----
void Any::dumpPre( std::string & h_file, std::string & c_file)
{
+ // namespace opened in h and cpp files
+ h_file += "namespace " + getValidNmspc() + "\n{\n";
+ //c_file += "namespace " + getValidNmspc() + "\n{\n";
+
h_file += dumpOrnament();
! h_file += "class " + getValidNameImpl();
h_file += dumpClassHeader() + "{\npublic:\n";
for( unsigned int k = 0; k < m_inifinMethods.size(); ++k)
+ {
h_file += m_inifinMethods[k].getHeader() + "\n";
+ c_file += m_inifinMethods[k].getSource();
+ }
}
***************
*** 477,481 ****
}
! h_file += "};\n\n\n";
}
--- 619,628 ----
}
! //h_file += "};\n\n\n";
! // namespace closed in h and cpp file
! h_file += "}; // class\n";
! h_file += "} // namespace\n";
! h_file += "\n\n";
! //c_file += "}; // nmspc\n";
}
***************
*** 504,508 ****
std::string up, line;
! while( !old_xmp_file.eof() && line.find( "class " + getDispNameImpl() + " :") == std::string::npos)
{
std::getline( old_xmp_file, line);
--- 651,655 ----
std::string up, line;
! while( !old_xmp_file.eof() && line.find( "class " + getValidNameImpl() + " :") == std::string::npos)
{
std::getline( old_xmp_file, line);
***************
*** 544,546 ****
--- 691,860 ----
old_xmp_file.close();
return up;
+ }
+
+ void Any::makeBackup()
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ std::string dirname = getValidNmspc();
+ std::string fname = getName();
+ // check dir for namespace
+ if( !dirname.empty())
+ {
+ bool success = directoryExists( dirname.c_str());
+ if( !success) success = directoryCreate( dirname.c_str());
+
+ if( success) dirname += "\\";
+ else dirname = "";
+ }
+
+ std::string fn = dirname + fname;// + ".cpp";
+ if( !makeFileMove( ( fn + ".h").c_str(), ( fn + ".h.bak").c_str()))
+ global_vars.err << MSG_ERROR << "Could not backup " << ( fn + ".h");
+ if( !makeFileMove( ( fn + ".cpp").c_str(), ( fn + ".cpp.bak").c_str()))
+ global_vars.err << MSG_ERROR << "Could not backup " << ( fn + ".cpp");
+
+ //Dumper::backup( fn_c.c_str()); // makes backup if exists file
+ }
+ }
+
+ void Any::initOutS()
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ std::string dirname = getValidNmspc();
+ std::string fname = getName();
+ // check dir for namespace
+ if( !dirname.empty())
+ {
+ bool success = directoryExists( dirname.c_str());
+ if( !success) success = directoryCreate( dirname.c_str());
+
+ if( success) dirname += "\\";
+ else dirname = "";
+ }
+
+ std::string fn_c = dirname + fname + ".cpp";
+ //Dumper::backup( fn_c.c_str()); // makes backup if exists file
+
+ m_sStream.open( fn_c.c_str(), std::ios_base::out | std::ios_base::app); // append old file
+ m_sStream.seekp( 0, std::ios::end); // go to end
+ int lenf = m_sStream.tellp();
+ if( lenf == ( std::fstream::pos_type) 0)
+ {
+ m_sStream << "#include \"stdafx.h\"" << std::endl;
+ m_sStream << "#include \"" << shortFileName( global_vars.header_file_name) << "\"" << std::endl;
+ //m_sStream << "#include \"" << fname << ".h\"" << std::endl;
+ if( Dumper::m_bGenAcceptSpeci && 0) // if special accept is generated then special visitor header included
+ m_sStream << "#include \"" << shortFileName( global_vars.m_visitorHeaderFileName) << "\"" << std::endl;
+ }
+ else // the file existed, how come it was supposed to be moved to .bak
+ {
+ // it might happen that we have a 'Package' and 'package' class
+ // which is OK in GME, but not for WINDOS: filenames are similar in such a case
+ // we issue a warning and append the new contents
+ global_vars.err << MSG_WARNING << "Methods of class \"" << fname << "\" appended to end of file: " << fn_c << " [Hint: filenames are not case-sensitive, thus might clash!]";
+ }
+
+ m_sStream << std::endl;
+ m_sStream << std::endl;
+ }
+ }
+
+ void Any::initOutH( std::string& resu)
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ std::string dirname = getValidNmspc();
+ std::string fname = getName();
+ std::string cc = capitalizeString( dirname + fname);
+
+ // check dir for namespace
+ if( !dirname.empty())
+ {
+ bool success = directoryExists( dirname.c_str());
+ if( !success) success = directoryCreate( dirname.c_str());
+
+ if( success) dirname += "\\";
+ else dirname = "";
+ }
+
+ std::string fn_h = dirname + fname + ".h";
+ //Dumper::backup( fn_h.c_str()); // makes backup if exists file
+
+ m_hStream.open( fn_h.c_str(), std::ios_base::out | std::ios_base::app); // append old file
+ m_hStream.seekp( 0, std::ios::end); // go to end
+ int lenf = m_hStream.tellp();
+ if( lenf == ( std::fstream::pos_type) 0)
+ {
+ m_hStream << "#ifndef " << cc << "_H" << std::endl;
+ m_hStream << "#define " << cc << "_H" << std::endl;
+ m_hStream << std::endl;
+ m_hStream << "#include \"" << shortFileName( global_vars.header_file_name) << "\"" << std::endl;
+ }
+ else // the file existed, how come it was supposed to be moved to .bak
+ {
+ // it might happen that we have a 'Package' and 'package' class
+ // which is OK in GME, but not for WINDOS: filenames are similar in such a case
+ // we issue a warning and append the new contents with some minor tricks like #if 1 // dummy
+ global_vars.err << MSG_WARNING << "Declaration for class \"" << fname << "\" appended to end of file: " << fn_h << " [Hint: filenames are not case-sensitive, thus might clash!]";
+
+ m_hStream << "#if 1 // dummy" << std::endl; // just to fool finiOutH
+ }
+
+ m_hStream << std::endl;
+ m_hStream << std::endl;
+
+ // repl '\' with '/' if dirname is filled
+ resu += "#include \"" + ( dirname.empty()?"":dirname.substr(0, dirname.length() - 1) + "/") + fname + ".h\"\n";
+ }
+ }
+
+ void Any::finiOutS()
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ m_sStream.close();
+ }
+ }
+
+ void Any::finiOutH()
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ m_hStream << "#endif" << std::endl;
+ m_hStream.close();
+ }
+ }
+
+ void Any::sendOutH( const std::string& content)
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::ALLTOGETHER) // one file policy
+ {
+ DMP_H( content);
+ }
+ else if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ m_hStream << content;//dmp( "this->getname", content);
+ }
+ else if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERNAMESPACE) //
+ {
+ //dmp( "this->getnamespace", content);
+ }
+ }
+
+ void Any::sendOutS( const std::string& content)
+ {
+ if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::ALLTOGETHER) // one file policy
+ {
+ DMP_S( content);
+ }
+ else if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERCLASS) //
+ {
+ m_sStream << content;//dmp( "this->getname", content);
+ }
+ else if( global_vars.m_outputMethod == Globals::OUTPUTMETHOD_ENUM::PERNAMESPACE) //
+ {
+ //dmp( "this->getnamespace", content);
+ }
}
Index: Dumper.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Dumper.h 31 Dec 2004 19:51:20 -0000 1.9
--- Dumper.h 22 Sep 2006 16:05:47 -0000 1.10
***************
*** 7,11 ****
class Dumper : public Sheet {
!
protected:
Dumper();
--- 7,26 ----
class Dumper : public Sheet {
! public:
! static const char* m_strBonExtenderOptions;
! static const char* Yes_Str;
! static const char* Only_Str;
! static const char* No_Str;
! static const char* m_strGenVisitor;
! static const char* m_strVisitorSignature;
! static const char* m_strGenInitMethod;
! static const char* m_strGenFiniMethod;
! static const char* m_strGenAcceptWithTraversal;
! static const char* m_strGenAcceptSpecialized;
! static const char* m_strSpecAcceptRetVal;
! static const char* m_strVCVersion6;
! static const char* m_strTemplateGetter;
! static const char* m_strOutputInSeparateFile;
! static const char* m_strTgtNamespace;
protected:
Dumper();
***************
*** 17,21 ****
bool build();
! 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);
--- 32,36 ----
bool build();
! static int selectOutputFiles( const std::string& proj_name, BON::RegistryNode& optionsRegnode);
static int backup( const std::string& file_name);
static void getGlobalUserParts( std::string& up1, std::string& up2);
***************
*** 26,32 ****
--- 41,51 ----
static bool m_bGenInit;
static bool m_bGenFinalize;
+ static bool m_bGenAcceptTrave;
+ static bool m_bGenAcceptSpeci;
static bool m_bGenTemplates;
static bool m_bGenTemplVersion6;
static bool m_bGenRegular;
+ static int m_iVisitSign;
+ static int m_iSpecAcceptRetVal;
static bool m_bGenVisitor;
static bool m_bSafetyBackup;
***************
*** 45,48 ****
--- 64,69 ----
void dumpMain( std::vector<FCO*>& s);
void doDump();
+ void initOutFiles( std::vector<FCO*>& s, std::string& resu);
+ void finiOutFiles( std::vector<FCO*>& s);
bool checkAll();
- Previous message: [GME-commit]
GMESRC/Paradigms/MetaGME/BonExtension BON2Component.cpp,1.23,1.24
BON2Component.h,1.10,1.11 BonExt.vcproj,1.2,1.3
Component.rc,1.6,1.7 Globals.h,1.7,1.8 LogStream.cpp,1.2,1.3
compicon.ico,1.4,1.5 logger.cpp,1.3,1.4 logger.h,1.3,1.4
resource.h,1.3,1.4
- Next message: [GME-commit] GMESRC/Tools/GMEMerge Merge.h,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the GME-commit
mailing list