[GME-commit]
GMESRC/Paradigms/MetaGME/BonExtension/Rep Any.cpp,1.5,1.6
Any.h,1.4,1.5 CodeGen.cpp,1.3,1.4 CodeGen.h,1.1,1.2
Dumper.cpp,1.9,1.10 FCO.cpp,1.10,1.11 FCO.h,1.8,1.9
FolderRep.cpp,1.7,1.8 ModelRep.cpp,1.9,1.10
ReferenceRep.cpp,1.6,1.7 SetRep.cpp,1.7,1.8
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Tue Mar 16 18:24:16 CST 2004
Update of /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep
In directory braindrain:/tmp/cvs-serv14394/Rep
Modified Files:
Any.cpp Any.h CodeGen.cpp CodeGen.h Dumper.cpp FCO.cpp FCO.h
FolderRep.cpp ModelRep.cpp ReferenceRep.cpp SetRep.cpp
Log Message:
-Common kind lcd feature introduced (References, Sets)
-Sets have aggregated getters
-Base classes implementing multiple kinds (the non extended ones)
-Log file name changed
Modified Files:
BON2Component.cpp Component.rc Globals.h Rep/Any.cpp Rep/Any.h
Rep/CodeGen.cpp Rep/CodeGen.h Rep/Dumper.cpp Rep/FCO.cpp
Rep/FCO.h Rep/FolderRep.cpp Rep/ModelRep.cpp
Rep/ReferenceRep.cpp Rep/SetRep.cpp
CVS User: zolmol
Index: Any.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Any.cpp 10 Mar 2004 02:50:18 -0000 1.5
--- Any.cpp 17 Mar 2004 00:24:13 -0000 1.6
***************
*** 104,108 ****
if ( this->m_ptr)
{
! return getName();
}
return "NullPtrError";
--- 104,110 ----
if ( this->m_ptr)
{
! std::string nm = getName();
! Any::convertToValidName( nm);
! return nm;
}
return "NullPtrError";
***************
*** 116,120 ****
! std::string Any::dumpMyRoles()
{
return Any::getName();
--- 118,122 ----
! std::string Any::dumpMyKind()
{
return Any::getName();
***************
*** 185,190 ****
error_msg << std::ends;
std::string error_str ( error_msg.str());
! if ( !error_str.empty())
! global_vars.err << "Error in " << p << " at index "<< error_str << ".\n";
return good;
}
--- 187,192 ----
error_msg << std::ends;
std::string error_str ( error_msg.str());
! /*if ( !error_str.empty())
! global_vars.err << "Error in " << p << " at index "<< error_str << ".\n";*/
return good;
}
***************
*** 229,233 ****
h += "\nDECLARE_BONEXTENSION( BON::" + getMyKindStr() + ", " + getDispNameImpl() + ", " + getDispName() + " );\n";
! s = "IMPLEMENT_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName() + ", \"" + dumpMyRoles() + "\" );\n";
m_globalSource += s;
--- 231,235 ----
h += "\nDECLARE_BONEXTENSION( BON::" + getMyKindStr() + ", " + getDispNameImpl() + ", " + getDispName() + " );\n";
! s = "IMPLEMENT_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName() + ", \"" + dumpMyKind() + "\" );\n";
m_globalSource += s;
***************
*** 252,256 ****
{
std::string row;
! row = "// " + getDispNameImpl() + (is_abstract?" abstract":"") + " class\n";
const std::string orn = "//*******************************************************************\n";
--- 254,258 ----
{
std::string row;
! row = "// C L A S S " + getDispNameImpl() + "\n";//(is_abstract?" abstract":"") + " class\n";
const std::string orn = "//*******************************************************************\n";
Index: Any.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Any.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Any.h 10 Mar 2004 02:50:18 -0000 1.4
--- Any.h 17 Mar 2004 00:24:14 -0000 1.5
***************
*** 81,85 ****
void dumpGlobals();
! std::string dumpMyRoles();
std::string dumpOrnament( bool is_abstract = false);
std::string getDispNameImpl();
--- 81,85 ----
void dumpGlobals();
! std::string dumpMyKind();
std::string dumpOrnament( bool is_abstract = false);
std::string getDispNameImpl();
Index: CodeGen.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGen.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CodeGen.cpp 10 Mar 2004 18:45:55 -0000 1.3
--- CodeGen.cpp 17 Mar 2004 00:24:14 -0000 1.4
***************
*** 449,488 ****
*/
! /*static*/ Method CodeGen::dumpSetGetter( SetRep * cont, const FCO * fco, const std::string& lll)
{
Method m;
std::string retval_kind, kind; // the return value cannot be "Compound" if Compound is not extended
! 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()];
}
! std::string mmm;
! mmm = indent(0) + "{\n";
! mmm += indent(1) + "std::set<" + retval_kind + "> res;\n";
! mmm += indent(1) + "std::set<BON::FCO> elems = getMembers();\n";
! mmm += indent(1) + "std::set<BON::FCO>::iterator elem = elems.begin();\n";
! mmm += indent(1) + "for( ; elem != elems.end(); ++elem)\n";
! mmm += indent(1) + "{\n";
! mmm += indent(2) + retval_kind + " r( *elem);\n";
! if( fco->isToBeEx() || fco->getExtedAnc())
mmm += indent(2) + "if ( r)\n";
- else
- mmm += indent(2) + "if ( r && r->getObjectMeta().name() == \"" + fco->getDispName() + "\")\n";
! mmm += indent(3) + "res.insert( r);\n";
! mmm += indent(1) + "}\n";
! mmm += indent(1) + "return res;\n";
! mmm += indent(0) + "}\n\n\n";
m.m_returnValue = "std::set<" + retval_kind + ">";
! m.m_signature = cont->setGetterTemplate( fco) + "()";
m.m_implementation = mmm;
m.m_container = cont;
! m.m_comment = "";
return m;
--- 449,511 ----
*/
! /*static*/ Method CodeGen::dumpSetGetter( SetRep * cont, const FCO * fco, const std::string& common_kind, bool aggreg /*=false*/, bool dummy_par /*=false*/)
{
+ ASSERT( fco || ( aggreg && !common_kind.empty())); //assert if fco is 0 and aggreg is false
Method m;
std::string retval_kind, kind; // the return value cannot be "Compound" if Compound is not extended
!
! if (fco)
{
! retval_kind = kind = fco->getDispName();
! if ( !fco->isToBeEx())
! {
! FCO * ext_anc = fco->getExtedAnc();
! if ( ext_anc)
! retval_kind = ext_anc->getDispName();
! else
! retval_kind = "BON::" + Any::KIND_TYPE_STR[fco->getMyKind()];
! }
}
! else if ( !common_kind.empty()) // using the common_kind if set
! retval_kind = kind = "BON::" + common_kind;
! else // not intended for usage in such cases
! ASSERT(0);
!
! std::string mmm;
! mmm = indent(0) + "{\n";
! mmm += indent(1) + "std::set<" + retval_kind + "> res;\n";
! mmm += indent(1) + "std::set<BON::FCO> elems = getMembers();\n";
! mmm += indent(1) + "std::set<BON::FCO>::iterator elem = elems.begin();\n";
! mmm += indent(1) + "for( ; elem != elems.end(); ++elem)\n";
! mmm += indent(1) + "{\n";
! mmm += indent(2) + retval_kind + " r( *elem);\n";
! if ( fco)
! {
! if ( !aggreg) // not aggregated getter
! {
! /*if( fco->isToBeEx() || fco->getExtedAnc()) mmm += indent(2) + "if ( r)\n";
! else*/ mmm += indent(2) + "if ( r && r->getObjectMeta().name() == \"" + fco->getDispName() + "\")\n";
! }
! else // aggregated getter, casting to the common base, which is not a common kind
! {
! mmm += indent(2) + "if ( r)\n";
! }
! }
! else // aggregated getter casting to the common kind
mmm += indent(2) + "if ( r)\n";
! mmm += indent(3) + "res.insert( r);\n";
! mmm += indent(1) + "}\n";
! mmm += indent(1) + "return res;\n";
! mmm += indent(0) + "}\n\n\n";
m.m_returnValue = "std::set<" + retval_kind + ">";
! m.m_signature = cont->setGetterTemplate( fco) + "(" + (dummy_par?" int dummy":"") + ")";
m.m_implementation = mmm;
m.m_container = cont;
! if ( !aggreg)
! m.m_comment = "specialized getter for " + fco->getDispName() + " setmembers";
! else //aggreg
! m.m_comment = "aggregated getter for setmembers";
return m;
***************
*** 495,501 ****
*/
! /*static*/ Method CodeGen::dumpRefGetter( ReferenceRep * cont, FCO * fco, const std::string& lll)
{
! Method m;
std::string mmm, kind, retval_kind;
if (fco)
--- 518,524 ----
*/
! /*static*/ Method CodeGen::dumpRefGetter( ReferenceRep * cont, FCO * fco, const std::string& common_kind)
{
! Method m;
std::string mmm, kind, retval_kind;
if (fco)
***************
*** 511,514 ****
--- 534,539 ----
}
}
+ else if ( !common_kind.empty()) // using the common_kind if set
+ retval_kind = kind = "BON::" + common_kind;
else
retval_kind = kind = "BON::FCO";
***************
*** 556,560 ****
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "getIn" + conn->getName() + "Links()";
m.m_returnValue = "std::set<" + conn->getDispName() + ">";
m.m_container = fco;
--- 581,585 ----
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "getIn" + conn->getDispName() + "Links()";
m.m_returnValue = "std::set<" + conn->getDispName() + ">";
m.m_container = fco;
***************
*** 585,589 ****
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "getOut" + conn->getName() + "Links()";
m.m_returnValue = "std::set<" + conn->getDispName() + ">";
m.m_container = fco;
--- 610,614 ----
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "getOut" + conn->getDispName() + "Links()";
m.m_returnValue = "std::set<" + conn->getDispName() + ">";
m.m_container = fco;
***************
*** 614,618 ****
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getName() + "Links()";
m.m_returnValue = "std::set<" + conn->getDispName() + ">";
m.m_container = fco;
--- 639,643 ----
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getDispName() + "Links()";
m.m_returnValue = "std::set<" + conn->getDispName() + ">";
m.m_container = fco;
***************
*** 642,646 ****
nnn += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getName() + "Srcs()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_container = fco;
--- 667,671 ----
nnn += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getDispName() + "Srcs()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_container = fco;
***************
*** 666,670 ****
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getName() + "Srcs()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_container = fco;
--- 691,695 ----
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getDispName() + "Srcs()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_container = fco;
***************
*** 693,697 ****
nnn += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getName() + "Dsts()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_container = fco;
--- 718,722 ----
nnn += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getDispName() + "Dsts()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_container = fco;
***************
*** 715,719 ****
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getName() + "Dsts()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_container = fco;
--- 740,744 ----
mmm += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getDispName() + "Dsts()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_container = fco;
***************
*** 743,747 ****
nnn += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getName() + "Ends()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_container = fco;
--- 768,772 ----
nnn += indent(0) + "}\n\n\n";
! m.m_signature = "get" + conn->getDispName() + "Ends()";
m.m_returnValue = "std::multiset<BON::ConnectionEnd>";
m.m_container = fco;
***************
*** 772,776 ****
mmm += indent(0) + "}\n\n";
! m.m_signature = "get" + conn->getName() + "Ends()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_container = fco;
--- 797,801 ----
mmm += indent(0) + "}\n\n";
! m.m_signature = "get" + conn->getDispName() + "Ends()";
m.m_returnValue = "std::multiset<" + peer_lcd + ">";
m.m_container = fco;
Index: CodeGen.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/CodeGen.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CodeGen.h 26 Feb 2004 17:12:46 -0000 1.1
--- CodeGen.h 17 Mar 2004 00:24:14 -0000 1.2
***************
*** 33,42 ****
* Set related generators
*/
! static Method dumpSetGetter( SetRep * cont, const FCO * fco, const std::string& lll);
/**
* Reference related generators
*/
! static Method dumpRefGetter( ReferenceRep * cont, FCO * fco, const std::string& lll);
--- 33,42 ----
* Set related generators
*/
! static Method dumpSetGetter( SetRep * cont, const FCO * fco, const std::string& comm_kind, bool aggreg = false, bool dummy_par = false);
/**
* Reference related generators
*/
! static Method dumpRefGetter( ReferenceRep * cont, FCO * fco, const std::string& comm_kind);
Index: Dumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/Dumper.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Dumper.cpp 10 Mar 2004 17:42:16 -0000 1.9
--- Dumper.cpp 17 Mar 2004 00:24:14 -0000 1.10
***************
*** 581,585 ****
--- 581,588 ----
}
if ( closest_to_my_level != -1 && selected_extended_anc != 0)
+ {
(*it)->setExtedAnc( selected_extended_anc);
+ selected_extended_anc->addNonExtedDesc( *it);
+ }
}
}
***************
*** 587,590 ****
--- 590,594 ----
}
+
bool Dumper::build()
{
***************
*** 604,608 ****
global_vars.output_directory_name = "";
global_vars.source_file_name = proj_name;
! global_vars.err_file_name = proj_name + ".log";
global_vars.m_visitorHeaderFileName = proj_name + "Visitor.h";
global_vars.m_visitorSourceFileName = proj_name + "Visitor";
--- 608,612 ----
global_vars.output_directory_name = "";
global_vars.source_file_name = proj_name;
! global_vars.err_file_name = proj_name + "BONExt.log";
global_vars.m_visitorHeaderFileName = proj_name + "Visitor.h";
global_vars.m_visitorSourceFileName = proj_name + "Visitor";
***************
*** 771,775 ****
if ( old_f_name.empty()) // means that no previous version existed or the user selected not to parse the old file
{
! up1 = "// add your include files here\n";
up2 = "// add your additional class definitions here\n";
return;
--- 775,779 ----
if ( old_f_name.empty()) // means that no previous version existed or the user selected not to parse the old file
{
! up1 = "// add your include files/class definitions here\n";
up2 = "// add your additional class definitions here\n";
return;
Index: FCO.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** FCO.cpp 11 Mar 2004 15:53:21 -0000 1.10
--- FCO.cpp 17 Mar 2004 00:24:14 -0000 1.11
***************
*** 29,32 ****
--- 29,33 ----
, m_attributeMethods()
, m_extedAnc( 0)
+ , m_nonExtedDescs()
{
for ( int i = 0; i < NUMBER_OF_INHERITANCES; ++i)
***************
*** 58,61 ****
--- 59,63 ----
m_extedAnc = 0;
+ m_nonExtedDescs.clear();
for ( int i = 0; i < NUMBER_OF_INHERITANCES; ++i)
***************
*** 346,349 ****
--- 348,377 ----
+ void FCO::addNonExtedDesc( FCO * ptr)
+ {
+ ASSERT( ptr);
+ m_nonExtedDescs.push_back( ptr);
+ }
+
+
+ std::vector<FCO*> FCO::getNonExtedDescVector() const
+ {
+ return m_nonExtedDescs;
+ }
+
+
+ std::string FCO::dumpNonExtedDescKinds() const
+ {
+ if ( m_nonExtedDescs.empty()) return "";
+ std::string res;
+ std::vector<FCO*>::const_iterator it = m_nonExtedDescs.begin();
+ for( ; it != m_nonExtedDescs.end(); ++it)
+ if ( !(*it)->isAbstract())
+ res += ' ' + (*it)->getName();
+
+ return res;
+ }
+
+
void FCO::setAncestors( INHERITANCE_TYPE type, const std::vector<FCO*> &anc_list)
{
***************
*** 635,641 ****
}
std::string abstract_str = "";
! if ( m_isAbstract) abstract_str = "_ABSTRACT";
!
if ( bases.empty())
{
--- 663,671 ----
}
+ std::string dump_Non_Exted_Desc_Kinds = dumpNonExtedDescKinds(); // this class extends some other classes (descendants)
std::string abstract_str = "";
! if ( m_isAbstract && dump_Non_Exted_Desc_Kinds.empty())
! abstract_str = "_ABSTRACT"; //only if it is not intended to be representant of other kinds
!
if ( bases.empty())
{
***************
*** 668,675 ****
}
! s = "IMPLEMENT" + abstract_str + "_BONEXTENSION( " + global_vars.m_namespace_name + "::" + getDispName();
! if ( !m_isAbstract)
! s += ", \"" + dumpMyRoles() + "\"";
! s += " );\n";
m_globalSource += s;
--- 698,721 ----
}
! 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";
! }
! 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 += ", \"" + dumpMyKind() + dump_Non_Exted_Desc_Kinds + "\"";
! s += " );\n";
! }
m_globalSource += s;
***************
*** 712,718 ****
if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
m_virtualBaseClasses.end()) // not a virtual base class
! mmm += " public /*RG*/ " + (*it)->getDispNameImpl() + ",\n";
else
! mmm += " virtual public /*RG*/ " + (*it)->getDispNameImpl() + ",\n";
}
--- 758,766 ----
if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
m_virtualBaseClasses.end()) // not a virtual base class
! mmm += " public " + (*it)->getDispNameImpl() + ",\n";
! //mmm += " public /*RG*/ " + (*it)->getDispNameImpl() + ",\n";
else
! mmm += " virtual public " + (*it)->getDispNameImpl() + ",\n";
! //mmm += " virtual public /*RG*/ " + (*it)->getDispNameImpl() + ",\n";
}
***************
*** 746,750 ****
{
std::string kind_str = getMyKindStr();
! mmm = " :\n virtual public /*Ex*/ BON::" + kind_str + "Impl,\n" + mmm;
mmm[ mmm.length()-2] = ' '; // replace the ,
}
--- 794,799 ----
{
std::string kind_str = getMyKindStr();
! //mmm = " :\n virtual public /*Ex*/ BON::" + kind_str + "Impl,\n" + mmm;
! mmm = " :\n virtual public BON::" + kind_str + "Impl,\n" + mmm;
mmm[ mmm.length()-2] = ' '; // replace the ,
}
***************
*** 810,817 ****
h_file += "class " + getDispNameImpl();
h_file += dumpClassHeader() + "{\npublic:\n";
! if ( isAbstract())
! h_file += CodeGen::indent(1) + "virtual bool isAbstract() { return true; } // it is an abstract class, it will no be instantiated\n";
else
! h_file += CodeGen::indent(1) + "virtual bool isAbstract() { return false; } // it is not an abstract class\n";
h_file += m_classGlobalPart;
--- 859,866 ----
h_file += "class " + getDispNameImpl();
h_file += dumpClassHeader() + "{\npublic:\n";
! /*if ( isAbstract())
! h_file += CodeGen::indent(1) + "virtual bool isAbstract() const { return true; } // it is an abstract class, it will not be instantiated\n";
else
! h_file += CodeGen::indent(1) + "virtual bool isAbstract() const { return false; } // it is not an abstract class\n";*/
h_file += m_classGlobalPart;
***************
*** 957,960 ****
--- 1006,1010 ----
}
+
/*static*/ bool FCO::equal( std::vector<FCO*>& op1, std::vector<FCO*>& op2)
{
***************
*** 971,973 ****
return true;
! }
\ No newline at end of file
--- 1021,1042 ----
return true;
! }
!
!
! /*used at least by the ReferenceRep::createMethods */
! /*static*/ std::string FCO::lcdKindIntersect( const std::vector<FCO*>& elems)
! {
! if ( elems.empty()) return "";
!
!
! std::vector<FCO*>::const_iterator it = elems.begin();
! bool same_kind( true);
! KIND_TYPE kt = (*it)->getMyKind();
!
! for( ++it; it != elems.end() && same_kind ; ++it)
! same_kind = same_kind && ( kt == (*it)->getMyKind());
!
! if (same_kind)
! return Any::KIND_TYPE_STR[ kt];
! return "";
! }
Index: FCO.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** FCO.h 10 Mar 2004 17:42:16 -0000 1.8
--- FCO.h 17 Mar 2004 00:24:14 -0000 1.9
***************
*** 126,129 ****
--- 126,134 ----
FCO * getExtedAnc() const;
+
+ void addNonExtedDesc( FCO * ptr);
+ std::vector<FCO*> getNonExtedDescVector() const;
+ std::string FCO::dumpNonExtedDescKinds() const;
+
// multiple and virtual inheritance detectors
bool multipleInheritanceStep1();
***************
*** 163,166 ****
--- 168,172 ----
static std::vector<FCO *> intersect( const std::vector<FCO*>&, const std::vector<FCO*>&);
static std::vector<FCO *> lcdIntersect( const std::vector<FCO*>&);
+ static std::string lcdKindIntersect( const std::vector<FCO*>&);
static bool equal( std::vector<FCO*>&, std::vector<FCO*>&);
***************
*** 233,237 ****
--- 239,246 ----
std::vector<Method> m_attributeMethods;
+ // stores the youngest ancestor which is extended
FCO * m_extedAnc;
+ // stores the descendants which have this as the extedAnc (the youngest ancestor which is extended)
+ std::vector<FCO *> m_nonExtedDescs;
// protected methods
Index: FolderRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FolderRep.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** FolderRep.cpp 10 Mar 2004 16:42:33 -0000 1.7
--- FolderRep.cpp 17 Mar 2004 00:24:14 -0000 1.8
***************
*** 45,49 ****
std::string FolderRep::getDispName() const
{
! return getName(); //+ "Ex";mod 2/2/2004
}
--- 45,51 ----
std::string FolderRep::getDispName() const
{
! std::string nm = getName();
! Any::convertToValidName( nm);
! return nm; //+ "Ex";mod 2/2/2004
}
***************
*** 150,156 ****
{
#if(LONG_NAMES)
! return "get_Sub_" + fold->getName();
#else
! return "get" + fold->getName();
#endif
}
--- 152,158 ----
{
#if(LONG_NAMES)
! return "get_Sub_" + fold->getDispName();
#else
! return "get" + fold->getDispName();
#endif
}
***************
*** 160,166 ****
{
#if(LONG_NAMES)
! return "get_Kind_" + fco->getName();
#else
! return "get" + fco->getName();
#endif
}
--- 162,168 ----
{
#if(LONG_NAMES)
! return "get_Kind_" + fco->getDispName();
#else
! return "get" + fco->getDispName();
#endif
}
Index: ModelRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ModelRep.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ModelRep.cpp 11 Mar 2004 15:53:21 -0000 1.9
--- ModelRep.cpp 17 Mar 2004 00:24:14 -0000 1.10
***************
*** 286,292 ****
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getName():role->getOnlyRoleName());
#else
! return "get" + (role->getOnlyRoleName().empty()?fco->getName():role->getOnlyRoleName());
#endif
}
--- 286,292 ----
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getDispName():role->getOnlyRoleName());
#else
! return "get" + (role->getOnlyRoleName().empty()?fco->getDispName():role->getOnlyRoleName());
#endif
}
***************
*** 299,305 ****
{
#if(LONG_NAMES)
! return "get_Role_" + (role->getOnlyRoleName().empty()?fco->getName():fco->getName() + role->getOnlyRoleName());
#else
! return "get" + (role->getOnlyRoleName().empty()?fco->getName():fco->getName() + role->getOnlyRoleName());
#endif
}
--- 299,305 ----
{
#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
}
Index: ReferenceRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/ReferenceRep.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ReferenceRep.cpp 10 Mar 2004 20:03:32 -0000 1.6
--- ReferenceRep.cpp 17 Mar 2004 00:24:14 -0000 1.7
***************
*** 234,240 ****
m_refGetterMethods.push_back( CodeGen::dumpRefGetter( this, *c_it, ""));
}
! else if ( common_anc.empty()) // empty, use BON::FCO
{
! m_refGetterMethods.push_back( CodeGen::dumpRefGetter( this, 0, ""));
}
else
--- 234,241 ----
m_refGetterMethods.push_back( CodeGen::dumpRefGetter( this, *c_it, ""));
}
! else if ( common_anc.empty()) // empty, use BON::FCO or common_kind
{
! std::string common_kind = FCO::lcdKindIntersect( m_finalReferees);
! m_refGetterMethods.push_back( CodeGen::dumpRefGetter( this, 0, common_kind));
}
else
***************
*** 335,344 ****
#if(LONG_NAMES)
if (fco)
! return "get" + fco->getName() + "Referred";
else
return "getReferred";
#else
if (fco)
! return "get" + fco->getName();
else
return "getReferred";
--- 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";
Index: SetRep.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/SetRep.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SetRep.cpp 11 Mar 2004 15:53:21 -0000 1.7
--- SetRep.cpp 17 Mar 2004 00:24:14 -0000 1.8
***************
*** 51,58 ****
{
FCO * member_ptr = *member_it;
! std::vector<FCO*> descendants;
! member_ptr->getIntDescendants( descendants);
! std::vector<FCO*>::iterator desc_it = descendants.begin();
! for( ; desc_it != descendants.end(); ++desc_it)
{
FCO * new_member = *desc_it;
--- 51,59 ----
{
FCO * member_ptr = *member_it;
! std::vector<FCO*> family;
! member_ptr->getIntDescendants( family);
! family.push_back( member_ptr);
! std::vector<FCO*>::iterator desc_it = family.begin();
! for( ; desc_it != family.end(); ++desc_it)
{
FCO * new_member = *desc_it;
***************
*** 67,79 ****
void SetRep::createMethods()
{
SetMemberList_Iterator it = m_finalMemberList.begin();
for( ; it != m_finalMemberList.end(); ++it)
{
! m_setMethods.push_back( CodeGen::dumpSetGetter( this, *it, ""));
! std::vector<FCO*> children;
! (*it)->getIntDescendants( children);
! std::vector<FCO*>::iterator ch_it = children.begin();
! for( ; ch_it != children.end(); ++ch_it)
! m_setMethods.push_back( CodeGen::dumpSetGetter( this, *ch_it, ""));
}
}
--- 68,92 ----
void SetRep::createMethods()
{
+ // getter for each potential member
SetMemberList_Iterator it = m_finalMemberList.begin();
for( ; it != m_finalMemberList.end(); ++it)
+ m_setMethods.push_back( CodeGen::dumpSetGetter( this, *it, "", false, false));
+
+ // aggregated getter with common ancestor of all potential members
+ std::vector<FCO*> common_anc = FCO::lcdIntersect( m_finalMemberList); // the set may contain all of these fcos
+ if ( !common_anc.empty())
{
! std::vector<FCO*>::iterator c_it = common_anc.begin();
! if ( c_it != common_anc.end())
! m_setMethods.push_back( CodeGen::dumpSetGetter( this, *c_it, "", true, true)); // generate method for only 1 common ancestor and use the dummy trick to avoid name-conflict with plain getters
! }
! else if ( common_anc.empty()) // empty, use common_kind
! {
! std::string common_kind = FCO::lcdKindIntersect( m_finalMemberList);
! if ( !common_kind.empty())
! m_setMethods.push_back( CodeGen::dumpSetGetter( this, 0, common_kind, true, false));
! //else one solution remained: BON::FCO this is not adding any service to the plain Bon2 getMembers() call, so omitted
! else
! global_vars.err << "Note: " << getName() << "Impl::getAllReferred() omitted since it can return only what the SetImpl::getMembers() does."<< "\n";
}
}
***************
*** 137,146 ****
}
std::string SetRep::setGetterTemplate( const FCO * fco)
{
#if(LONG_NAMES)
! return "get" + fco->getName() + "Members";
#else
! return "get" + fco->getName() + "s";
#endif
}
--- 150,166 ----
}
+
std::string SetRep::setGetterTemplate( const FCO * fco)
{
#if(LONG_NAMES)
! if (fco)
! return "get" + fco->getDispName() + "Members";
! else
! return "getAllMembers";
#else
! if (fco)
! return "get" + fco->getDispName() + "s";
! else
! return "getAllMembers";
#endif
}
More information about the GME-commit
mailing list