[GME-commit] GMESRC/GME/Parser MgaDumper.cpp,1.14,1.15 MgaDumper.h,1.9,1.10 MgaParser.cpp,1.19,1.20 mga.dtd,1.6,1.7

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Jun 30 13:50:49 CDT 2004


Update of /var/lib/gme/GMESRC/GME/Parser
In directory braindrain:/tmp/cvs-serv23427/Parser

Modified Files:
	MgaDumper.cpp MgaDumper.h MgaParser.cpp mga.dtd 
Log Message:
Dumper/Parser changed for closure logic:
	-not to dump relids, childrelidscntrs in case of closure dump
	-libreferred and libderivedfrom (soft) attributes added, if the objects are found upon parsing the reference or instantiation is reproduced
Mga:
	-AbsPath property added for MgaObject: gives back the absolute path to an object
	-get_ObjectByPath search implemented for search based on kindnames


CVS User: zolmol

Index: MgaDumper.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/MgaDumper.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** MgaDumper.cpp	11 Jun 2004 14:54:21 -0000	1.14
--- MgaDumper.cpp	30 Jun 2004 17:50:47 -0000	1.15
***************
*** 138,141 ****
--- 138,143 ----
  {
  	CHECK_IN(p);
+ 	m_dumpLibraryStubs = false; // make sure closure logic does not involve in it
+ 
  
  	COMTRY
***************
*** 158,161 ****
--- 160,166 ----
  	// and grandchildren are dumped as well
  
+ 	dumpversion = 2; // no relids dumped
+ 	m_dumpLibraryStubs = false; // make sure closure logic does not involve in it
+ 
  	//CHECK_IN( (int)p | (int)f);
  
***************
*** 474,479 ****
  	Attr("id", folder, IMgaFolder::get_ID);
  	if(dumpversion >= 1) {
! 		LAttr("relid", folder, IMgaFolder::get_RelID);
! 		LAttr("childrelidcntr", folder, IMgaFolder::get_ChildRelIDCounter);
  
  		CComBstrObj libname;
--- 479,487 ----
  	Attr("id", folder, IMgaFolder::get_ID);
  	if(dumpversion >= 1) {
! 		if ( dumpversion != 2)
! 		{
! 			LAttr("relid", folder, IMgaFolder::get_RelID);
! 			LAttr("childrelidcntr", folder, IMgaFolder::get_ChildRelIDCounter);
! 		}
  
  		CComBstrObj libname;
***************
*** 656,664 ****
  				Attr("isprimary", prim != VARIANT_FALSE ? "yes" : "no");
  			}
  			else {
  				lost_basetype = true;
  			}
  		}
! 		if(prim && (dumpversion >= 1) && (!lost_basetype)) LAttr("relid", fco, IMgaFCO::get_RelID);
  	}
  
--- 664,691 ----
  				Attr("isprimary", prim != VARIANT_FALSE ? "yes" : "no");
  			}
+ 			// logic added by ZolMol
+ 			else if ( !isInLibrary( fco) && isInLibrary( derivedfrom) && m_dumpLibraryStubs) { //derived from a type defined in a library
+ 				CComBSTR name;
+ 				COMTHROW( derivedfrom->get_AbsPath( &name));
+ 				string nm;
+ 				CopyTo( name, nm);
+ 				
+ 				Attr("libderivedfrom", nm);
+ 
+ 				VARIANT_BOOL b;
+ 
+ 				COMTHROW( fco->get_IsInstance(&b) );
+ 				Attr("isinstance", b != VARIANT_FALSE ? "yes" : "no");
+ 
+ 				COMTHROW( fco->get_IsPrimaryDerived(&prim) );
+ 				Attr("isprimary", prim != VARIANT_FALSE ? "yes" : "no");
+ 			}
  			else {
  				lost_basetype = true;
  			}
  		}
! 		if(prim && (dumpversion >= 1) && (!lost_basetype)) 
! 			if ( dumpversion != 2)
! 				LAttr("relid", fco, IMgaFCO::get_RelID);
  	}
  
***************
*** 700,704 ****
  
  	DumpFCO(model, true, false, false);	
! 	if(dumpversion >= 1) LAttr("childrelidcntr", model, IMgaModel::get_ChildRelIDCounter);
  	DumpFCO(model, false, true, true);	
  
--- 727,731 ----
  
  	DumpFCO(model, true, false, false);	
! 	if(dumpversion >= 1 && dumpversion != 2) LAttr("childrelidcntr", model, IMgaModel::get_ChildRelIDCounter);
  	DumpFCO(model, false, true, true);	
  
***************
*** 867,872 ****
  	COMTHROW( reference->get_Referred(PutOut(fco)) );
  	
! 	if( (fco != NULL)  && (CheckInClosure(fco)))
! 		Attr("referred", fco, IMgaFCO::get_ID);
  
  
--- 894,912 ----
  	COMTHROW( reference->get_Referred(PutOut(fco)) );
  	
! 	if( fco != NULL)
! 	{
! 		if( CheckInClosure( fco)) // regular dump or the fco is really in the closure
! 			Attr("referred", fco, IMgaFCO::get_ID);
! 		// logic added by ZolMol
! 		else if ( !isInLibrary( reference) && isInLibrary( fco) && m_dumpLibraryStubs) //reference pointing out to a library
! 		{
! 			CComBSTR name;
! 			COMTHROW( fco->get_AbsPath( &name));
! 			string nm;
! 			CopyTo( name, nm);
! 			
! 			Attr("libreferred", nm);
! 		}
! 	}
  
  
***************
*** 1241,1247 ****
  }
  
! STDMETHODIMP CMgaDumper::DumpClos( IMgaFCOs *p_sel_fcos, IMgaFolders *p_sel_folds,  BSTR xmlfile)
  {
  	m_strictDump = true;
  
  	COMTRY
--- 1281,1289 ----
  }
  
! STDMETHODIMP CMgaDumper::DumpClos( IMgaFCOs *p_sel_fcos, IMgaFolders *p_sel_folds,  BSTR xmlfile, int dump_options)
  {
  	m_strictDump = true;
+ 	dumpversion = 2; // no relids dumped
+ 	m_dumpLibraryStubs = (dump_options & 0x1) == 0x1; // dump library stubs ( absolute path used as libreferred or libderivedfrom attribute)
  
  	COMTRY
***************
*** 1293,1300 ****
  
  STDMETHODIMP CMgaDumper::DumpClosR(
! 			IMgaFCOs *p_sel_fcos, IMgaFolders *p_sel_folds,  BSTR xmlfile, 
! 			IMgaFCOs *p_top_fcos, IMgaFolders *p_top_folds )
  {
  	m_strictDump = true;
  
  	COMTRY
--- 1335,1344 ----
  
  STDMETHODIMP CMgaDumper::DumpClosR(
! 			IMgaFCOs *p_sel_fcos, IMgaFolders *p_sel_folds, BSTR xmlfile, 
! 			IMgaFCOs *p_top_fcos, IMgaFolders *p_top_folds, int dump_options)
  {
  	m_strictDump = true;
+ 	dumpversion = 2; // no relids dumped
+ 	m_dumpLibraryStubs = (dump_options & 0x1) == 0x1; // dump library stubs ( absolute path used as libreferred or libderivedfrom attribute)
  
  	COMTRY
***************
*** 1329,1333 ****
  			// this case should be handled by the DumpClos()
  			ASSERT( 0);
! 			return DumpClos( p_sel_fcos, p_sel_folds, xmlfile);
  		}
  
--- 1373,1377 ----
  			// this case should be handled by the DumpClos()
  			ASSERT( 0);
! 			return DumpClos( p_sel_fcos, p_sel_folds, xmlfile, dump_options);
  		}
  

Index: MgaDumper.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/MgaDumper.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** MgaDumper.h	11 Jun 2004 14:54:22 -0000	1.9
--- MgaDumper.h	30 Jun 2004 17:50:47 -0000	1.10
***************
*** 40,44 ****
  {
  public:
! 	CMgaDumper() : dumpversion( 1), m_strictDump( true) { }
  
  DECLARE_REGISTRY_RESOURCEID(IDR_MGADUMPER)
--- 40,44 ----
  {
  public:
! 	CMgaDumper() : dumpversion( 1), m_strictDump( true), m_dumpLibraryStubs(false) { }
  
  DECLARE_REGISTRY_RESOURCEID(IDR_MGADUMPER)
***************
*** 60,65 ****
  	STDMETHOD(DumpProject)(IMgaProject *p, BSTR xmlfile);
  	STDMETHOD(DumpFCOs)(IMgaFCOs *p, IMgaFolders *f, BSTR xmlfile);
! 	STDMETHOD(DumpClos)( IMgaFCOs *sel_fco, IMgaFolders *sel_fold, BSTR xmlfile);
! 	STDMETHOD(DumpClosR)( IMgaFCOs *sel_fco, IMgaFolders *sel_fold, BSTR xmlfile, IMgaFCOs *root_fco, IMgaFolders *root_fold);
  	STDMETHOD(put_FormatVersion)(long p) { dumpversion = p; return S_OK; }
  
--- 60,65 ----
  	STDMETHOD(DumpProject)(IMgaProject *p, BSTR xmlfile);
  	STDMETHOD(DumpFCOs)(IMgaFCOs *p, IMgaFolders *f, BSTR xmlfile);
! 	STDMETHOD(DumpClos)( IMgaFCOs *sel_fco, IMgaFolders *sel_fold, BSTR xmlfile, int lib_stub);
! 	STDMETHOD(DumpClosR)( IMgaFCOs *sel_fco, IMgaFolders *sel_fold, BSTR xmlfile, IMgaFCOs *root_fco, IMgaFolders *root_fold, int lib_stub);
  	STDMETHOD(put_FormatVersion)(long p) { dumpversion = p; return S_OK; }
  
***************
*** 213,219 ****
  
  	long fco_count;
! 	int dumpversion;
  
  	bool m_strictDump; // if true then containers dump their children only if the child is present in the closure collection
  
  	CComObjPtr<IMgaProject>			project;
--- 213,226 ----
  
  	long fco_count;
! 	int dumpversion;// >=1 means new xme format, ==2 means do not dump relids
  
  	bool m_strictDump; // if true then containers dump their children only if the child is present in the closure collection
+ 	bool m_dumpLibraryStubs; // if true the libreferred attribute is dumped
+ 	inline bool isInLibrary( IMgaObject * obj)
+ 	{
+ 		VARIANT_BOOL vbLibrary;
+ 		COMTHROW( obj->get_IsLibObject( &vbLibrary ) );
+ 		return ( vbLibrary ) ? true : false;
+ 	}
  
  	CComObjPtr<IMgaProject>			project;

Index: MgaParser.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/MgaParser.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** MgaParser.cpp	13 May 2004 10:03:42 -0000	1.19
--- MgaParser.cpp	30 Jun 2004 17:50:47 -0000	1.20
***************
*** 795,805 ****
  	if( s == NULL )
  	{
! 		deriv.from.Release();
! 		return;
  	}
  
! 	LookupByID(*s, deriv.from);
! 	if( deriv.from == NULL )
! 		throw pass_exception();
  
  	s = GetByNameX(attributes, "isinstance");
--- 795,823 ----
  	if( s == NULL )
  	{
! 		s = GetByNameX(attributes, "libderivedfrom");
! 		if( s == NULL)
! 		{
! 			deriv.from.Release();
! 			return;
! 		}
! 
! 		CComObjPtr<IMgaObject> obj;
! 		COMTHROW( project->get_ObjectByPath( PutInBstr( *s), PutOut( obj)) );
! 		if ( obj)
! 			COMTHROW( obj.QueryInterface( deriv.from));
! 
! 		if ( deriv.from == NULL) // do not throw exception in case of libderivedfrom
! 		{
! 			deriv.from.Release();
! 			return;
! 		}
  	}
+ 	else
+ 	{
+ 		LookupByID(*s, deriv.from);
  
! 		if( deriv.from == NULL )
! 			throw pass_exception();
! 	}
  
  	s = GetByNameX(attributes, "isinstance");
***************
*** 1188,1191 ****
--- 1206,1220 ----
  		if( referred == NULL )
  			throw pass_exception();
+ 	}
+ 	else // by ZolMol
+ 	{
+ 		s = GetByNameX(attributes, "libreferred");
+ 		if( s != NULL)
+ 		{
+ 			CComObjPtr<IMgaObject> obj;
+ 			COMTHROW( project->get_ObjectByPath( PutInBstr( *s), PutOut( obj)) );
+ 			if ( obj)
+ 				COMTHROW( obj.QueryInterface( referred));
+ 		}
  	}
  

Index: mga.dtd
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/Parser/mga.dtd,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mga.dtd	20 Mar 2002 15:09:00 -0000	1.6
--- mga.dtd	30 Jun 2004 17:50:47 -0000	1.7
***************
*** 45,48 ****
--- 45,49 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
+ 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 57,60 ****
--- 58,62 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
+ 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 68,74 ****
--- 70,78 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
+ 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
  	referred	IDREF		#IMPLIED
+ 	libreferred	CDATA		#IMPLIED
  	isbound		(yes|no)	"no"
  	relid		CDATA		#IMPLIED
***************
*** 81,84 ****
--- 85,89 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
+ 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"
***************
*** 94,97 ****
--- 99,103 ----
  	role		NMTOKEN		#IMPLIED
  	derivedfrom	IDREF		#IMPLIED
+ 	libderivedfrom	CDATA		#IMPLIED
  	isinstance	(yes|no)	"no"
  	isprimary	(yes|no)	"yes"



More information about the GME-commit mailing list