[GME-commit]
GMESRC/GME/Mga MgaLibRefr.cpp,1.5,1.6 MgaLibRefr.h,1.3,1.4
MgaLibOps.cpp,1.17,1.18 MgaLibOps.h,1.6,1.7
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Mon Feb 12 18:24:32 CST 2007
- Previous message: [GME-commit] GMESRC/GME/Mga MgaFCO.h,1.27,1.28 MgaFCO.cpp,1.37,1.38
MgaLibOps.h,1.5,1.6 MgaLibOps.cpp,1.16,1.17 MgaLibRefr.h,1.2,1.3
MgaLibRefr.cpp,1.4,1.5 MgaTrukk.h,1.20,1.21
- Next message: [GME-commit] GMESRC/GME/Core CoreProject.h,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /project/gme-repository/GMESRC/GME/Mga
In directory escher:/tmp/cvs-serv396
Modified Files:
MgaLibRefr.cpp MgaLibRefr.h MgaLibOps.cpp MgaLibOps.h
Log Message:
Code made nicer. Exceptions handled more properly, error messages provided.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: MgaLibOps.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaLibOps.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** MgaLibOps.cpp 2 Feb 2007 21:00:18 -0000 1.17
--- MgaLibOps.cpp 12 Feb 2007 18:24:30 -0000 1.18
***************
*** 8,11 ****
--- 8,12 ----
#include "MgaLibRefr.h"
#include "../interfaces/Parser.h"
+ #include <algorithm>
/*static*/ const wchar_t* Ozer::StorageMgr::INCLUDES_STR = L"_includes";
***************
*** 124,137 ****
/* *************************** Attach ********************************************* */
[...1340 lines suppressed...]
! p_valueList.Append( it.getCurrentBstr());
}
}
***************
*** 1290,1294 ****
}
! // copy dependencies from the old lib to the newer libs
void Ozer::copyIncludedBy( CoreObj& p_oldLib
, CoreObj& p_newLib)
--- 1371,1378 ----
}
!
! // copy dependencies from the old lib to the newer libs:
! // if libX included oldlib, then libX will include newlib too
! // that is why IncludedBy of newlib must be copied from oldlib
void Ozer::copyIncludedBy( CoreObj& p_oldLib
, CoreObj& p_newLib)
Index: MgaLibRefr.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaLibRefr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MgaLibRefr.h 2 Feb 2007 21:00:18 -0000 1.3
--- MgaLibRefr.h 12 Feb 2007 18:24:30 -0000 1.4
***************
*** 564,587 ****
}
! static CoreObj findLibraryWithId( CoreObj& p_folder, PROJ_ID& p_libId)
{
! ITERATE_THROUGH( p_folder[ ATTRID_FCOPARENT + ATTRID_COLLECTION])
{
! metaid_type mi = ITER.GetMetaID();
! if( mi == DTID_FOLDER)
{
! long pm = ITER[ATTRID_PERMISSIONS];
! if( pm & LIBROOT_FLAG)
{
CComBSTR id;
! ObjForCore( ITER)->get_ID( &id);
! if( id == p_libId)
! return ITER;
}
}
}
! return CoreObj();
}
};
--- 564,612 ----
}
! static bool findTopLibInProj( CMgaProject* p_mgaProject
! , const PROJ_ID& p_idOfLib
! , CoreObj& p_libObjCore)
{
! bool all_right = false;
!
! ASSERT( p_idOfLib.Length() == 16); // id like: "id-006a-00000002"
!
! try
{
! CComPtr<IMgaFolder> rf;
! p_mgaProject->get_RootFolder( &rf);
! CoreObj crf = CoreObj( rf);
!
! ITERATE_THROUGH( crf[ ATTRID_FCOPARENT + ATTRID_COLLECTION])
{
! metaid_type mtyp = ITER.GetMetaID();
! if( mtyp == DTID_FOLDER)
{
+ FCO* kid = ObjForCore( ITER);
+ if( !kid) continue;
+
CComBSTR id;
! COMTHROW( kid->get_ID( &id));
!
! if( id == p_idOfLib // equal id
! && !ITER.IsDeleted() // not a zombie
! && ( ITER[ATTRID_PERMISSIONS] & LIBROOT_FLAG)) // a library root
! {
! p_libObjCore = ITER;
! all_right = true;
! break;
! }
}
}
+ }
+ catch( hresult_exception& )
+ {
+ ASSERT(0);
}
! ASSERT( all_right);
! return all_right;
}
+
};
Index: MgaLibRefr.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaLibRefr.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MgaLibRefr.cpp 2 Feb 2007 21:00:18 -0000 1.5
--- MgaLibRefr.cpp 12 Feb 2007 18:24:30 -0000 1.6
***************
*** 2333,2341 ****
if( !m_mgaproject) return;
- CComPtr<IMgaFolder> root_fld;
- COMTHROW( m_mgaproject->get_RootFolder( &root_fld));
- CoreObj root_cor( root_fld);
- ASSERT( root_cor);
-
CComBSTR id; // the refreshed library's id
COMTHROW( ObjForCore( m_newLib)->get_ID( &id));
--- 2333,2336 ----
***************
*** 2345,2371 ****
for( Ozer::DependentIterator it( idlist); !it.isDone(); it.next())
{
! CoreObj libroot = SearchTool::findLibraryWithId( root_cor, it.getCurrentBstr());
! ASSERT( libroot);
! if( libroot)
// this lib may have gotten new elements during refresh
applyLibFlag( libroot);
}
-
- /*for( std::vector<PROJ_ID>::iterator it = m_changedLibs.begin()
- ; it != m_changedLibs.end()
- ; ++it)
- {
- //CoreObj libroot = SearchTool::findLibrary( root_cor, *it);
- CoreObj libroot = SearchTool::findLibraryWithId( root_cor, *it);
- ASSERT( libroot);
- if( libroot)
- {
- // this lib may have gotten new elements during refresh
- applyLibFlag( libroot);
-
- // add the dependency info to the includes list
- //done elsewhere: //Ozer::addIncludes( libroot, id);
- }
- }*/
}
--- 2340,2350 ----
for( Ozer::DependentIterator it( idlist); !it.isDone(); it.next())
{
! CoreObj libroot;
! bool all_right = SearchTool::findTopLibInProj( m_mgaproject, it.getCurrentBstr(), libroot);
! ASSERT( all_right && libroot);
! if( all_right && libroot)
// this lib may have gotten new elements during refresh
applyLibFlag( libroot);
}
}
Index: MgaLibOps.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Mga/MgaLibOps.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MgaLibOps.h 2 Feb 2007 21:00:18 -0000 1.6
--- MgaLibOps.h 12 Feb 2007 18:24:30 -0000 1.7
***************
*** 4,14 ****
#include <vector>
class BinGuid;
! class PointerFixup
{
public: // typedefs
! typedef std::vector< std::pair< CoreObj, CoreObj > > LIBPAIRVEC;
! protected:
coreobjpairhash identity_map;
--- 4,26 ----
#include <vector>
class BinGuid;
+ class Reporter;
! class Typedefs
{
public: // typedefs
! typedef std::vector< CoreObj > LIBVEC;
! typedef LIBVEC::iterator LIBVEC_ITER;
! typedef LIBVEC::const_iterator LIBVEC_CITER;
! typedef std::map< BinGuid, LIBVEC > LIBMAP;
! typedef LIBMAP::iterator LIBMAP_ITER;
! typedef LIBMAP::const_iterator LIBMAP_CITER;
!
! typedef std::vector< std::pair< CoreObj, CoreObj > > LIBPAIRVEC;
! typedef LIBPAIRVEC::iterator LIBPAIRVEC_ITER;
! };
!
! class PointerFixup
! {
coreobjpairhash identity_map;
***************
*** 24,32 ****
bool m_isOptimizing;
! LIBPAIRVEC m_libPairs;
public:
PointerFixup();
! void setLibPairs( LIBPAIRVEC& p_libPairs);
CoreObj findLibRoot( const CoreObj& p_elem);
--- 36,44 ----
bool m_isOptimizing;
! Typedefs::LIBPAIRVEC m_libPairs;
public:
PointerFixup();
! void setLibPairs( Typedefs::LIBPAIRVEC& p_libPairs);
CoreObj findLibRoot( const CoreObj& p_elem);
***************
*** 92,95 ****
--- 104,108 ----
else
{
+ #ifdef _DEBUG
CComBSTR m;
if( i->second.IsFCO())
***************
*** 105,109 ****
m.Append( ".");
}
!
resolve_entry entry;
entry.target = target;
--- 118,122 ----
m.Append( ".");
}
! #endif
resolve_entry entry;
entry.target = target;
***************
*** 114,157 ****
return;
}
- //else
- // ASSERT(0);
- //ASSERT( iseccnpart);//SHOULDN'T IT FAIL if counterpart not found?
}
! if( m_isOptimizing && !iseccnpart)
! {
! int k(0);
! ++k;
! }
! if( iseccnpart)//m_isOptimizing) //iseccnpart
{
! if( iseccnpart)
! {
! created[attrid] = iseccnpart;
! }
! else if( i->second) // iseccnpart = 0, i->second != 0
! {
! CComBSTR nm, id;
! CoreObj mp;
! if( i->second.IsFCO())
! {
! nm = i->second[ATTRID_NAME];
! ObjForCore( i->second)->get_ID( &id);
!
! }
! else if( mp = i->second.GetMgaObj())
! {
! nm = mp[ATTRID_NAME];
! ObjForCore( mp)->get_ID( &id);
! }
! else
! {
! nm = "Null";
! }
! CComBSTR msg( "Resolve error at ");
! msg.Append( nm);
! msg.Append( " with ");
! msg.Append( id);
! }
}
else
--- 127,135 ----
return;
}
}
! if( iseccnpart)
{
! created[attrid] = iseccnpart;
}
else
***************
*** 220,224 ****
--- 198,204 ----
// look for the element's peer in the peer library
if( new_target.IsFCO() && new_target.GetMetaID() != DTID_CONNECTION)
+ {
iseccnpart = findCounterpart( new_target);
+ }
if( new_target.IsFCO() && new_target.GetMetaID() == DTID_CONNECTION)
{
***************
*** 306,343 ****
try
{
-
- //if( !new_target.IsFCO() && new_target.GetMgaObj().GetMetaID() != DTID_CONNECTION)
- //{
- // // this is questionable yet
- // ASSERT(0);
- // int mid = new_target.GetMetaID();
- // int nid = i->created.GetMetaID();
- // if( 511 == i->attrid)
- // {
- // CoreObj g = i->created;
- // CoreObj x1 = g.GetMgaObj();
- // CoreObj x2 = new_target.GetMgaObj();
- // CComBSTR m, i1, i2;
- // ObjForCore( x1)->get_ID( &i1);
- // ObjForCore( x2)->get_ID( &i2);
- // m.Append( x1[ATTRID_NAME]); m.Append( "{");m.Append( i1);m.Append( "}");
- // m.Append( x2[ATTRID_NAME]); m.Append( "{");m.Append( i2);m.Append( "}");
-
- // iseccnpart = findCounterpart( new_target);
- // if( iseccnpart)
- // {
- // i->created[i->attrid] = iseccnpart;
- // }
- // else
- // {
- // i->created[i->attrid] = new_target;
- // }
- // }
- //}
if( !new_target.IsFCO() && new_target.GetMgaObj().GetMetaID() == DTID_CONNECTION)
{
// needs to be dealt with:
// in case of DTID_CONNROLE: XREF and MASTEROBJ
- // in case of DTID_CONNROLESEG: SEGREF
//
int mid = new_target.GetMetaID();
--- 286,293 ----
***************
*** 400,432 ****
#endif
}
- /*else // if we optimize then we don't look back!
- (i->created)[i->attrid] = new_target;*/
}
}
- //if( 108 == nid) // DTID_CONNROLESEG
- //{
- // ASSERT(0);
- // if( 511 == i->attrid)
- // {
- // CComBSTR m;
- // CoreObj ref = new_target[ATTRID_SEGREF];
- // if( ref)
- // {
- // m = ref[ATTRID_NAME];
- // CoreObj ref_tgt = ref[ATTRID_REFERENCE];
- // m.Append( " targets ");
- // if( ref_tgt)
- // m.Append( ref_tgt[ATTRID_NAME]);
- // CoreObj nr = findCounterpart( ref_tgt);
- // if( nr)
- // {
- // }
- // }
- // }
- //}
}
}
catch (...) {
CComBSTR nm, id;
CoreObj mp;
--- 350,360 ----
#endif
}
}
}
}
}
catch (...) {
+ #ifdef _DEBUG
CComBSTR nm, id;
CoreObj mp;
***************
*** 450,453 ****
--- 378,382 ----
msg.Append( " with ");
msg.Append( id);
+ #endif
}
}
***************
*** 482,485 ****
--- 411,431 ----
};
+ class ReplaceDependency // function object
+ : public std::unary_function<CComBSTR, void>
+ {
+ CMgaProject* m_mgaproject;
+ const CComBSTR& m_lib_id_to_remove;
+ const CComBSTR& m_lib_id_to_add;
+ const bool m_incOrIncBy;
+
+ public:
+ ReplaceDependency( CMgaProject* p_mgaproject
+ , const CComBSTR& p_lib_id_to_remove
+ , const CComBSTR& p_lib_id_to_add
+ , bool p_incOrIncBy);
+
+ ReplaceDependency::result_type operator()( ReplaceDependency::argument_type p_arg);
+ };
+
class Ozer //Optimizer
{
***************
*** 509,518 ****
};
! static bool eraseIdFromIdList( const std::string& p_erasableVal
! , std::string& p_valueList);
! static bool findLibObj( CMgaProject* p_mgaProject
! , const std::string& p_idOfLib
! , CoreObj& p_libObjCore);
public:
--- 455,479 ----
};
! protected:
! class AlterRelation
! {
! const CComBSTR& m_libIdToRemove;
! const CComBSTR& m_lidIdToAdd;
! const bool m_incOrIncBy;
! public:
! AlterRelation( const CComBSTR& p_lib_id_to_remove
! , const CComBSTR& p_lib_id_to_add
! , bool p_incOrIncBy)
! : m_libIdToRemove( p_lib_id_to_remove)
! , m_lidIdToAdd ( p_lib_id_to_add)
! , m_incOrIncBy ( p_incOrIncBy)
! {}
!
! bool operator() ( CoreObj& p_library);
! };
!
! static bool removeFromList( const CComBSTR& p_erasableVal
! , CComBSTR& p_valueList);
public:
***************
*** 548,555 ****
, bool& p_libraryBecameFree);
static void copyIncludedBy( CoreObj& p_oldLib
, CoreObj& p_newLib);
! static void syncRelForAll ( CMgaProject* p_mgaproject
, CoreObj& p_rootfolder
, CoreObj& p_libimgroot
--- 509,518 ----
, bool& p_libraryBecameFree);
+ static bool isIncluded( CoreObj& p_fldCore);
+
static void copyIncludedBy( CoreObj& p_oldLib
, CoreObj& p_newLib);
! static void syncAllLibPeers( CMgaProject* p_mgaproject
, CoreObj& p_rootfolder
, CoreObj& p_libimgroot
***************
*** 557,578 ****
, bool p_depsOrIncs);
- static void findReplace( CMgaProject* p_mgaproject
- , CoreObj& p_libimgroot
- , CoreObj& p_newlibimgroot
- , const std::string& p_tokenizable
- , bool p_incOrIncBy);
-
- static bool isIncluded( CoreObj& p_fldCore);
};
class LibWorker
{
- public: // typedefs
-
- typedef std::vector< CoreObj > CORE_VEC;
- typedef CORE_VEC::iterator CORE_VEC_ITER;
- typedef std::map< BinGuid, std::vector< CoreObj > > LIB_MAP;
- typedef LIB_MAP::iterator LIB_MAP_ITER;
-
protected: // members
--- 520,527 ----
***************
*** 581,593 ****
bool m_optimized;
! static void groupTheLibs( CoreObj& p_container
! , LIB_MAP& p_results);
!
! static void discover( int p_recDepth
! , CoreObj& p_container
! , const CComBSTR& p_avoidThisLib
! , LIB_MAP& p_results);
!
! void showDetails( CoreObj& p_container, LIB_MAP& p_results);
public:
--- 530,534 ----
bool m_optimized;
! void showDetails( CoreObj& p_container, Typedefs::LIBMAP& p_results);
public:
***************
*** 603,611 ****
, CoreObj& p_libimgroot);
static void recordLibs( bool p_recordAllLibs
! , CoreObj& p_container
! , LIB_MAP& p_results
! , const CComBSTR& p_avoidThisLibrary = "");
};
--- 544,600 ----
, CoreObj& p_libimgroot);
+ };
+
+
+ class LibImgHelper
+ {
+ static void discover( int p_recDepth
+ , CoreObj& p_container
+ , const CComBSTR& p_avoidThisLib
+ , Typedefs::LIBMAP& p_results);
+
+
+ public:
+ // functor class for replacing ObjTreeCopyFromExt with its countless parameters
+ class DoExtTreeCopy
+ {
+ CMgaProject* m_mgaproject;
+ PointerFixup& m_fixup; // a reference!
+ Typedefs::LIBPAIRVEC& m_libPairs; // a reference!
+ Typedefs::LIBVEC& m_superfluousLibs; // a reference!
+ public:
+ DoExtTreeCopy( CMgaProject* p_mgaproject
+ , PointerFixup& p_fixup
+ , Typedefs::LIBPAIRVEC& p_libPairs
+ , Typedefs::LIBVEC& p_superfluousLibs);
+
+ void operator() ( const CoreObj& p_orig, CoreObj& p_nobj, bool p_indupl);
+ };
+
+
+ static void logCreator( CComBSTR& p_log
+ , const Typedefs::LIBVEC& p_libsToBe
+ , const Typedefs::LIBVEC& p_libsHosted);
+
+ static void matchLibs( const Typedefs::LIBMAP& p_libMap
+ , const Typedefs::LIBMAP& p_projMap
+ , Typedefs::LIBPAIRVEC& p_machingPairs
+ , CComBSTR& p_msgInfo);
+
+ static void deleteSuperfluousLibs( Typedefs::LIBVEC& p_superfluousLibs
+ , Reporter& p_reporter);
+
+ static void createDeps( CoreObj& p_libImageRoot
+ , Typedefs::LIBPAIRVEC& p_matchingInfo
+ , Reporter& p_reporter
+ , CComBSTR& p_includedIdList);
+
+ static void groupTheLibs( CoreObj& p_container
+ , Typedefs::LIBMAP& p_results);
static void recordLibs( bool p_recordAllLibs
! , CoreObj& p_container
! , Typedefs::LIBMAP& p_results
! , const CComBSTR& p_avoidThisLibrary = "");
};
- Previous message: [GME-commit] GMESRC/GME/Mga MgaFCO.h,1.27,1.28 MgaFCO.cpp,1.37,1.38
MgaLibOps.h,1.5,1.6 MgaLibOps.cpp,1.16,1.17 MgaLibRefr.h,1.2,1.3
MgaLibRefr.cpp,1.4,1.5 MgaTrukk.h,1.20,1.21
- Next message: [GME-commit] GMESRC/GME/Core CoreProject.h,1.9,1.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the GME-commit
mailing list