[GME-commit] GMESRC/GME/Core CoreAttribute.cpp, 1.20, 1.21 CoreBinFile.cpp, 1.19, 1.20 CoreBinFile.h, 1.12, 1.13

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Sep 26 14:32:12 CDT 2007


Update of /project/gme-repository/GMESRC/GME/Core
In directory escher:/tmp/cvs-serv21388

Modified Files:
	CoreAttribute.cpp CoreBinFile.cpp CoreBinFile.h 
Log Message:
New MGA Attribute: FILESTATUS introduced, thus BinaryFiles are updated automatically.

This FILESTATUS attribute is used for SourceControl status notification, and is re-read from Storage layer each time is requested by MGA.
Look for 'BGY' comments in CoreAttribute.cpp



CVS User: Zoltan Molnar, ISIS (zolmol)

Index: CoreBinFile.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Core/CoreBinFile.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** CoreBinFile.cpp	2 Jul 2007 18:37:33 -0000	1.19
--- CoreBinFile.cpp	26 Sep 2007 19:32:10 -0000	1.20
***************
*** 80,84 ****
  }
  
! bool BinObject::HasGuidAttributes()
  {
  	int a1( 0), a2( 0), a3( 0), a4( 0);
--- 80,84 ----
  }
  
! bool BinObject::HasGuidAndStatAttributes( bool* p_guidFound, bool* p_statusFound)
  {
  	int a1( 0), a2( 0), a3( 0), a4( 0);
***************
*** 94,97 ****
--- 94,98 ----
  			case ATTRID_GUID3: ++a3;break;
  			case ATTRID_GUID4: ++a4;break;
+ 			case ATTRID_FILESTATUS: *p_statusFound = true; break;
  		};
  
***************
*** 102,106 ****
  	ASSERT( (a1 == 0 || a1 == 1) && a1 == a2 && a1 == a3 && a1 == a4);
  
! 	return a1 && a2 && a3 && a4;
  }
  
--- 103,108 ----
  	ASSERT( (a1 == 0 || a1 == 1) && a1 == a2 && a1 == a3 && a1 == a4);
  
! 	*p_guidFound = a1 && a2 && a3 && a4;
! 	return *p_guidFound;
  }
  
***************
*** 141,144 ****
--- 143,165 ----
  }
  
+ // this method will create a status attribute for mga objects
+ // loaded from MGA files saved with a previous version of gme
+ void BinObject::CreateStatusAttribute( CCoreBinFile* p_bf)
+ {
+ 	// create BinAttr of LONG type
+ 	BinAttrBase *binattr = BinAttrBase::Create( VALTYPE_LONG);
+ 
+ 	// fill the only public field
+ 	binattr->attrid = ATTRID_FILESTATUS;
+ 
+ 	// set the value
+ 	binattr->Set( p_bf, CComVariant( 0L));
+ 
+ 	// insert the objects into the container
+ 	// these objects will be destructed later 
+ 	// by BinObject::DestroyAttributes
+ 	binattrs.push_back( binattr);
+ }
+ 
  void BinObject::CreateAttributes(ICoreMetaObject *metaobject)
  {
***************
*** 850,858 ****
  		
  		// if the object read is folder or fco and it does NOT have guid attributes (old version mga file)
! 		if( metaid >= DTID_MODEL && metaid <= DTID_FOLDER	// 101 .. 106
! 			&& !opened_object->second.HasGuidAttributes())
  		{
! 			// we will create guid attributes for it
! 			opened_object->second.CreateGuidAttributes( this);
  		}
  	}
--- 871,885 ----
  		
  		// if the object read is folder or fco and it does NOT have guid attributes (old version mga file)
! 		if( metaid >= DTID_MODEL && metaid <= DTID_FOLDER)	// 101 .. 106
  		{
! 			bool stat_found( false), guid_found( false);
! 
! 			opened_object->second.HasGuidAndStatAttributes( &guid_found, &stat_found);
! 
! 			if( !guid_found) // we will create guid attributes for it
! 				opened_object->second.CreateGuidAttributes( this);
! 
! 			if( !stat_found && ( metaid == DTID_MODEL || metaid == DTID_FOLDER)) // we will create status attribute for M and F
! 				opened_object->second.CreateStatusAttribute( this);
  		}
  	}

Index: CoreBinFile.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Core/CoreBinFile.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** CoreBinFile.h	19 May 2006 17:12:52 -0000	1.12
--- CoreBinFile.h	26 Sep 2007 19:32:10 -0000	1.13
***************
*** 45,50 ****
  	bool deleted;
  
! 	bool HasGuidAttributes();
  	void CreateGuidAttributes( CCoreBinFile* p_bf);
  
  	BinAttrBase *Find(attrid_type attrid)
--- 45,51 ----
  	bool deleted;
  
! 	bool HasGuidAndStatAttributes( bool* p_guidFound, bool* p_statusFound);
  	void CreateGuidAttributes( CCoreBinFile* p_bf);
+ 	void CreateStatusAttribute( CCoreBinFile* p_bf);
  
  	BinAttrBase *Find(attrid_type attrid)

Index: CoreAttribute.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Core/CoreAttribute.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** CoreAttribute.cpp	15 Jun 2007 19:22:59 -0000	1.20
--- CoreAttribute.cpp	26 Sep 2007 19:32:10 -0000	1.21
***************
*** 6,9 ****
--- 6,10 ----
  #include "CoreProject.h"
  #include "CoreTerritory.h"
+ #include "..\Mga\MgaGeneric.h"
  
  // --------------------------- Defines
***************
*** 1440,1459 ****
              // BGY: this hack makes sure that the sourcecontrol status is always
              // read from the storage.
!             if( GetValType() == VALTYPE_STRING )
!             {
!                 ICoreStorage *storage = SetStorageThisAttribute();
! 		        ASSERT( storage != NULL );
! 		        COMTHROW( storage->LockObject() );
! 		        CComVariant v;
!                 COMTHROW( storage->get_AttributeValue(&v) );
!                 std::string str;
!                 CopyTo(v,str);
!                 if( strncmp( str.c_str(), "GME_SourceControl_State", 23 ) == 0
!                  || strncmp( str.c_str(), "GME_SourceControl_File_", 23 ) == 0)
!                 {
! 		            COMTHROW( storage->get_AttributeValue(p) );
!                     return S_OK;
!                 }
!             }
          }
  		else
--- 1441,1458 ----
              // BGY: this hack makes sure that the sourcecontrol status is always
              // read from the storage.
! 			if( GetValType() == VALTYPE_LONG)
! 			{
! 				ICoreStorage *storage = SetStorageThisAttribute();
! 				ASSERT( storage != NULL );
! 				COMTHROW( storage->LockObject() );
! 
! 				attrid_type a_id;
! 				COMTHROW( storage->get_AttrID( &a_id));
! 				if( a_id == ATTRID_FILESTATUS)
! 				{
! 					COMTHROW( storage->get_AttributeValue( p));
! 					return S_OK;
! 				}
! 			}
          }
  		else



More information about the GME-commit mailing list