[GME-commit]
GMESRC/Paradigms/MetaGME/BonExtension/Rep FCO.cpp,1.11,1.12
FCO.h,1.9,1.10
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Wed Mar 17 14:39:10 CST 2004
Update of /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep
In directory braindrain:/tmp/cvs-serv19800/Rep
Modified Files:
FCO.cpp FCO.h
Log Message:
Modified dialog yes/no automatisms in order to prevent non-abstract extension of FCO.
Modified Files:
Gui/SelConf.cpp Rep/FCO.cpp Rep/FCO.h
CVS User: zolmol
Index: FCO.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** FCO.cpp 17 Mar 2004 00:24:14 -0000 1.11
--- FCO.cpp 17 Mar 2004 20:39:08 -0000 1.12
***************
*** 355,359 ****
! std::vector<FCO*> FCO::getNonExtedDescVector() const
{
return m_nonExtedDescs;
--- 355,359 ----
! const std::vector<FCO*>& FCO::getNonExtedDescVector() const
{
return m_nonExtedDescs;
***************
*** 418,439 ****
- const FCO::AttributeRepPtrList& FCO::getInitialAttributeRepPtrList() const
- {
- return m_initialAttributeList;
- }
-
-
- void FCO::addInitialAttribute( AttributeRep * attr)
- {
- AttributeRepPtrList_ConstIterator it =
- std::find( m_initialAttributeList.begin(), m_initialAttributeList.end(), attr);
-
- if ( it == m_initialAttributeList.end()) // not found so insert
- m_initialAttributeList.push_back( attr);
- else
- global_vars.err << attr->getName() << " attribute owned by " << getName() << " twice\n";
- }
-
-
std::vector<FCO *> FCO::getAllChildren() const
{
--- 418,421 ----
***************
*** 483,486 ****
--- 465,561 ----
+ void FCO::getRootDescsUntilNonFcoRep( std::vector< FCO *> & family) // here the family contains only the ancestors, when the method exits it will contain some descendants too
+ {
+ // *this is not necessarily and fco_rep
+ std::vector<FCO *> roots;
+ for( std::vector< FCO *>::const_iterator root_it = family.begin(); root_it != family.end(); ++root_it)
+ {
+ if ( (*root_it)->m_ancestors[ INTERFACE].empty() && (*root_it)->m_ancestors[ IMPLEMENTATION].empty()) // root obj
+ roots.push_back( *root_it);
+ }
+
+ if ( roots.empty())
+ roots.push_back( this); // *this is itself a root
+
+ std::vector< FCO*> res;
+ std::vector< FCO*> fco_reps;
+ std::vector< FCO*> nodes = roots;
+
+ bool has_fco_rep( true);
+ while ( has_fco_rep)
+ {
+ has_fco_rep = false;
+ std::vector< FCO *>::iterator it( nodes.begin());
+ for( ; it != nodes.end(); ++it)
+ {
+ if ( std::find( family.begin(), family.end(), *it) == family.end()) //not found
+ family.push_back( *it);
+
+ if ( (*it)->getMyKind() == FCO_REP)
+ {
+ has_fco_rep = has_fco_rep || true;
+ fco_reps.push_back( *it);
+ }
+ }
+ nodes.clear();
+ if ( has_fco_rep)
+ {
+ std::vector< FCO *>::iterator it1 = fco_reps.begin();
+ for( ; it1 != fco_reps.end(); ++it1)
+ {
+ std::vector< FCO*> children_of_fco_rep = (*it1)->getAllChildren();
+ std::vector< FCO*>::iterator it2( children_of_fco_rep.begin());
+ for( ; it2 != children_of_fco_rep.end(); ++it2)
+ {
+ if ( std::find( nodes.begin(), nodes.end(), *it2) == nodes.end()) //not found
+ nodes.push_back( *it2);
+ }
+
+ }
+ fco_reps.clear(); // nodes has the union of fcoreps' children
+ }
+ }
+ }
+
+
+ bool FCO::hasParentOfSameKind()
+ {
+ KIND_TYPE mine = getMyKind();
+ bool has = false;
+ std::vector< FCO *> pars = getAllParents();
+ std::vector< FCO *>::iterator it = pars.begin();
+ for( ; it != pars.end(); ++it)
+ {
+ if ( mine == (*it)->getMyKind())
+ has = true;
+ }
+ return has;
+ }
+
+
+ void FCO::getAllInMyHierarchy( std::vector< FCO *>& family)
+ {
+ std::vector<FCO *> roots, ancests = getAllAncestors();
+ std::vector< FCO *>::const_iterator itc = ancests.begin();
+ for( ; itc != ancests.end(); ++itc)
+ if ( (*itc)->m_ancestors[ INTERFACE].empty() && (*itc)->m_ancestors[ IMPLEMENTATION].empty()) // root obj
+ roots.push_back( *itc);
+
+ if ( roots.empty()) roots.push_back( this); // *this is a root itself
+
+ std::vector<FCO *>::iterator it = roots.begin();
+ for( ; it != roots.end(); ++it) // these are roots
+ {
+ std::vector<FCO *> descs = (*it)->getAllDescendants();
+ descs.push_back( *it); // insert the root too
+ std::vector<FCO *>::iterator it_d = descs.begin();
+ for( ; it_d != descs.end(); ++it_d)
+ if ( std::find( family.begin(), family.end(), *it_d) == family.end()) // not found
+ family.push_back( *it_d);
+
+ }
+ }
+
+
bool FCO::hasExactParent( const FCO * par, INHERITANCE_TYPE type) const
{
***************
*** 492,495 ****
--- 567,588 ----
+ const FCO::AttributeRepPtrList& FCO::getInitialAttributeRepPtrList() const
+ {
+ return m_initialAttributeList;
+ }
+
+
+ void FCO::addInitialAttribute( AttributeRep * attr)
+ {
+ AttributeRepPtrList_ConstIterator it =
+ std::find( m_initialAttributeList.begin(), m_initialAttributeList.end(), attr);
+
+ if ( it == m_initialAttributeList.end()) // not found so insert
+ m_initialAttributeList.push_back( attr);
+ else
+ global_vars.err << attr->getName() << " attribute owned by " << getName() << " twice\n";
+ }
+
+
/*
This method puts all base classes into m_multipleBaseClasses vector
***************
*** 653,658 ****
{
std::string h, s;
! std::string base_list; //, getMyKindStr();
bool has_same_kind_parent = false;
std::vector<FCO*> bases = getAllParents();
std::vector<FCO*>::iterator it = bases.begin();
--- 746,752 ----
{
std::string h, s;
! std::string base_list;
bool has_same_kind_parent = false;
+ std::string abstract_str = "";
std::vector<FCO*> bases = getAllParents();
std::vector<FCO*>::iterator it = bases.begin();
***************
*** 664,668 ****
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
--- 758,761 ----
***************
*** 686,690 ****
--- 779,786 ----
}
else if ( no_of_bases > 3)
+ {
TO("Currently macros do not support cases of more than 3 base classes");
+ global_vars.err << "Serious problem: Currently macros do not support cases of more than 3 base classes. Class : " << getDispName() << "\n";
+ }
}
else //if ( has_same_kind_parent)
***************
*** 697,701 ****
h += "\nDECLARE" + 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
{
--- 793,796 ----
***************
*** 771,777 ****
if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
m_virtualBaseClasses.end()) // not a virtual base class
! mmm += " private /*IM*/ " + (*it)->getDispNameImpl() + ",\n";
else
! mmm += " virtual private /*IM*/ " + (*it)->getDispNameImpl() + ",\n";
}
--- 866,874 ----
if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
m_virtualBaseClasses.end()) // not a virtual base class
! mmm += " private " + (*it)->getDispNameImpl() + ",\n";
! //mmm += " private /*IM*/ " + (*it)->getDispNameImpl() + ",\n";
else
! mmm += " virtual private " + (*it)->getDispNameImpl() + ",\n";
! //mmm += " virtual private /*IM*/ " + (*it)->getDispNameImpl() + ",\n";
}
***************
*** 782,788 ****
if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
m_virtualBaseClasses.end()) // not a virtual base class
! mmm += " public /*IN*/ " + (*it)->getDispNameImpl() + ",\n";
else
! mmm += " virtual public /*IN*/ " + (*it)->getDispNameImpl() + ",\n";
}
--- 879,887 ----
if ( std::find( m_virtualBaseClasses.begin(), m_virtualBaseClasses.end(), *it) ==
m_virtualBaseClasses.end()) // not a virtual base class
! mmm += " public " + (*it)->getDispNameImpl() + ",\n";
! //mmm += " public /*IN*/ " + (*it)->getDispNameImpl() + ",\n";
else
! mmm += " virtual public " + (*it)->getDispNameImpl() + ",\n";
! //mmm += " virtual public /*IN*/ " + (*it)->getDispNameImpl() + ",\n";
}
***************
*** 803,806 ****
--- 902,906 ----
mmm = " :\n" + mmm;
}
+
return mmm;
}
Index: FCO.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/BonExtension/Rep/FCO.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** FCO.h 17 Mar 2004 00:24:14 -0000 1.9
--- FCO.h 17 Mar 2004 20:39:08 -0000 1.10
***************
*** 114,117 ****
--- 114,121 ----
std::vector<FCO *> getAllDescendants() const;
+ void getRootDescsUntilNonFcoRep( std::vector< FCO *> & family);
+ bool hasParentOfSameKind();
+ void getAllInMyHierarchy( std::vector< FCO *>& family);
+
// which level in the hierarchy (INT or IMP only!!!)
void setLevel( INHERITANCE_TYPE type, int);
***************
*** 126,133 ****
FCO * getExtedAnc() const;
!
void addNonExtedDesc( FCO * ptr);
! std::vector<FCO*> getNonExtedDescVector() const;
! std::string FCO::dumpNonExtedDescKinds() const;
// multiple and virtual inheritance detectors
--- 130,137 ----
FCO * getExtedAnc() const;
! // adds a non-extended descendant which has to be included in the IMPLEMENT_BONEXT macro (its kind name)
void addNonExtedDesc( FCO * ptr);
! const std::vector<FCO*>& getNonExtedDescVector() const;
! std::string dumpNonExtedDescKinds() const;
// multiple and virtual inheritance detectors
More information about the GME-commit
mailing list