[GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2004 BON2Component.cpp,1.26,1.27 BON2Engine.cpp,1.4,1.5 Component.rc,1.10,1.11 entity.h,1.4,1.5

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Thu Apr 7 22:26:26 CDT 2005


Update of /project/gme-repository/GMESRC/Paradigms/MetaGME/MetaInterpreter2004
In directory escher:/tmp/cvs-serv7689

Modified Files:
	BON2Component.cpp BON2Engine.cpp Component.rc entity.h 
Log Message:
Allowing the user to choose a displayed name for equivalent objects also.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: BON2Engine.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/BON2Engine.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BON2Engine.cpp	26 Jan 2005 17:31:05 -0000	1.4
--- BON2Engine.cpp	7 Apr 2005 21:26:24 -0000	1.5
***************
*** 651,654 ****
--- 651,669 ----
  bool Component::nameSelector()
  {
+ 	// imagine an fco has several equivalence relationships
+ 	// the set of names that are considered (mainly for historical , but for practical reasons as well)
+ 	// are the names of the 
+ 	//      -non proxy equivalents
+ 	//      -the operator (Equivalence, SameAspect, SameFolder) itself
+ 	// 
+ 	// but beware that, the operator is chosen sometimes as the ''Name responsible''
+ 	// and this pointer is not among the equivalent objects set ( m_equivs ) 
+ 	// -in such cases the original resp pointer remains unchanged
+ 	// -if another name is selected, than the resp pointer is changed 
+ 	//  with the non-proxy equivalent's pointer
+ 	// 
+ 	// the display name can be selected independently from the name, so that it may come
+ 	// from another equivalent than the name comes from
+ 
  	bool res = true;
  
***************
*** 672,681 ****
  		// it_2->second = m_equivBag[ fco];
  		std::string defname = resp->getName(); // take its name from its name responsible
! 		std::string regname;
  
  		if( fco->getObjectMeta().name() == "Aspect")
  			regname = AspectRep::getMyRegistry( fco, it_1->getParentFolder())->getValueByPath( "/" + Any::NameSelectorNode_str);
  		else
  			regname = Any::getMyRegistry( fco, it_1->getParentFolder())->getValueByPath( "/" + Any::NameSelectorNode_str);
  
  		
--- 687,704 ----
  		// it_2->second = m_equivBag[ fco];
  		std::string defname = resp->getName(); // take its name from its name responsible
! 		std::string defdispname = "";          // initial value = "". This "" value will always be added as a dispname possibility (see NameSpecDlg::GetDispNames method)
! 		std::string regname, regdispname;      // the registry contained name
  
+ 		// load information from registry
  		if( fco->getObjectMeta().name() == "Aspect")
+ 		{
  			regname = AspectRep::getMyRegistry( fco, it_1->getParentFolder())->getValueByPath( "/" + Any::NameSelectorNode_str);
+ 			regdispname = AspectRep::getMyRegistry( fco, it_1->getParentFolder())->getValueByPath( "/" + Any::DisplayedNameSelectorNode_str);
+ 		}
  		else
+ 		{
  			regname = Any::getMyRegistry( fco, it_1->getParentFolder())->getValueByPath( "/" + Any::NameSelectorNode_str);
+ 			regdispname = Any::getMyRegistry( fco, it_1->getParentFolder())->getValueByPath( "/" + Any::DisplayedNameSelectorNode_str);
+ 		}
  
  		
***************
*** 706,712 ****
  			
  			if( is_reg_among_names)	// if valid info in registry use it
! 				dlg->m_dn[ fco] = regname;
  			else					// otherwise use the default name
! 				dlg->m_dn[ fco] = defname;
  
  			if( !is_def_among_names)
--- 729,735 ----
  			
  			if( is_reg_among_names)	// if valid info in registry use it
! 				dlg->m_dn[ fco] = make_pair( regname, regdispname);
  			else					// otherwise use the default name
! 				dlg->m_dn[ fco] = make_pair( defname, defdispname);
  
  			if( !is_def_among_names)
***************
*** 714,718 ****
  				dlg->m_map[ fco].insert( resp);
  			}
! 
  			jt = it_2->second.begin();
  			for( ; jt != it_2->second.end(); ++jt)
--- 737,742 ----
  				dlg->m_map[ fco].insert( resp);
  			}
! 			
! 			// fill up the equiv pointer map , leaving out proxies
  			jt = it_2->second.begin();
  			for( ; jt != it_2->second.end(); ++jt)
***************
*** 743,783 ****
  		{
  			BON::FCO key_fco = it_0->first;
! 			std::string newsel_name = it_0->second;
! 			BON::FCO newsel_resp;
  
  			Entity_Iterator it_1( m_entities.begin());
! 			for( ; it_1 != m_entities.end(); ++it_1 )
  			{
  				if( it_1->isDeleted()) continue;
  
! 				FCO fco( it_1->getPointer());
! 				if( fco == key_fco) // found the entity
  				{
! 					if( fco->getObjectMeta().name() == "Aspect")
! 						AspectRep::getMyRegistry( fco, it_1->getParentFolder())->setValueByPath( "/" + Any::NameSelectorNode_str, newsel_name);
! 					else
! 						Any::getMyRegistry( fco, it_1->getParentFolder())->setValueByPath( "/" + Any::NameSelectorNode_str, newsel_name);
  
! 					//find the new resppointer value in the equivBag
! 					EquivBag_Iterator it_2 = m_equivBag.find( key_fco);
! 					if( it_2 == m_equivBag.end()) continue;
  
! 					std::set < ObjPointer >::iterator it_3 = it_2->second.begin();
! 					for( ; !newsel_resp && it_3 != it_2->second.end(); ++it_3)
  					{
! 						if( !isProxy( *it_3))
  						{
! 							std::string eqname = (*it_3)->getName(); // the name of one equivalent
  
! 							if( eqname == newsel_name)
! 								newsel_resp = *it_3;
  						}
  					}
  
  					if( newsel_resp) // found
  						it_1->setRespPointer( newsel_resp); // set the new name resp
! 					//if not found then the the default resp is in charge, which is correct
  				}
  			}
  		}
  	}
--- 767,840 ----
  		{
  			BON::FCO key_fco = it_0->first;
! 			std::string newsel_name     = it_0->second.first;	// the newly selected name
! 			std::string newsel_dispname = it_0->second.second;	//                    display name
  
+ 			bool found = false;
  			Entity_Iterator it_1( m_entities.begin());
! 			for( ; !found && it_1 != m_entities.end(); ++it_1 )
  			{
  				if( it_1->isDeleted()) continue;
  
! 				if( it_1->getPointer() == key_fco) // found the entity: *it_1
  				{
! 					found = true;
  
! 					// search for the object among non-proxy equivalents which has the selected name
! 					BON::FCO newsel_resp; // this will store the new value if found
  
! 					// get the equivset of the key_fco
! 					EquivBag_Iterator it_2 = m_equivBag.find( key_fco);
! 					if( it_2 != m_equivBag.end()) 
  					{
! 						// find the new resppointer value in the equivBag[key_fco] set: it_2->second
! 						std::set < ObjPointer >::iterator it_3 = it_2->second.begin();
! 						for( ; !newsel_resp && it_3 != it_2->second.end(); ++it_3)
  						{
! 							if( !isProxy( *it_3))
! 							{
! 								std::string eqname = (*it_3)->getName(); // the name of one equivalent
  
! 								if( eqname == newsel_name)
! 									newsel_resp = *it_3;
! 							}
  						}
  					}
+ 					else
+ 					{
+ 						ASSERT( 0 ); // the key_fco should have equivalents, thus must be present in the equivBag as a key
+ 						continue;
+ 					}
  
+ 
+ 					// if the pointer having the selected name is found
+ 					// then set it as the new "name responsible" pointer
+ 					// if not found then we leave the default resp pointer 
+ 					// unchanged, since that was the only name coming not
+ 					// from the equivalents, but from the old resp pointer
  					if( newsel_resp) // found
+ 					{
  						it_1->setRespPointer( newsel_resp); // set the new name resp
! 					}
! 
! 					// the dispName has to be set all the time
! 					it_1->setDispName( newsel_dispname);
! 
! 					// save back into registry the user selection
! 					if( key_fco->getObjectMeta().name() == "Aspect")
! 					{
! 						AspectRep::getMyRegistry( key_fco, it_1->getParentFolder())->setValueByPath( "/" + Any::NameSelectorNode_str, newsel_name);
! 						AspectRep::getMyRegistry( key_fco, it_1->getParentFolder())->setValueByPath( "/" + Any::DisplayedNameSelectorNode_str, newsel_dispname);
! 					}
! 					else
! 					{
! 						Any::getMyRegistry( key_fco, it_1->getParentFolder())->setValueByPath( "/" + Any::NameSelectorNode_str, newsel_name);
! 						Any::getMyRegistry( key_fco, it_1->getParentFolder())->setValueByPath( "/" + Any::DisplayedNameSelectorNode_str, newsel_dispname);
! 					}
  				}
  			}
+ 			if( !found) 
+ 			{ 
+ 				ASSERT( 0 ); 
+ 			} // the key_fco must be a non-deleted entity in the m_entities
  		}
  	}

Index: Component.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Component.rc,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Component.rc	26 Jan 2005 17:31:06 -0000	1.10
--- Component.rc	7 Apr 2005 21:26:24 -0000	1.11
***************
*** 1,3 ****
! //Microsoft Developer Studio generated resource script.
  //
  #include "resource.h"
--- 1,3 ----
! // Microsoft Visual C++ generated resource script.
  //
  #include "resource.h"
***************
*** 28,37 ****
  //
  
! 1 TEXTINCLUDE DISCARDABLE 
  BEGIN
      "resource.h\0"
  END
  
! 2 TEXTINCLUDE DISCARDABLE 
  BEGIN
      "#include ""afxres.h""\r\n"
--- 28,37 ----
  //
  
! 1 TEXTINCLUDE 
  BEGIN
      "resource.h\0"
  END
  
! 2 TEXTINCLUDE 
  BEGIN
      "#include ""afxres.h""\r\n"
***************
*** 39,43 ****
  END
  
! 3 TEXTINCLUDE DISCARDABLE 
  BEGIN
      "1 TYPELIB ""ComponentLib.tlb""\r\n"
--- 39,43 ----
  END
  
! 3 TEXTINCLUDE 
  BEGIN
      "1 TYPELIB ""ComponentLib.tlb""\r\n"
***************
*** 48,52 ****
  
  
- #ifndef _MAC
  /////////////////////////////////////////////////////////////////////////////
  //
--- 48,51 ----
***************
*** 71,83 ****
          BLOCK "040904B0"
          BEGIN
!             VALUE "CompanyName", "\0"
!             VALUE "FileDescription", "Interpreter Module\0"
!             VALUE "FileVersion", "1, 0, 0, 1\0"
!             VALUE "InternalName", "Interpreter\0"
!             VALUE "LegalCopyright", "Copyright 2000\0"
!             VALUE "OriginalFilename", "Interpreter.DLL\0"
!             VALUE "ProductName", "Interpreter Module\0"
!             VALUE "ProductVersion", "1, 0, 0, 1\0"
!             VALUE "OLESelfRegister", "\0"
          END
      END
--- 70,80 ----
          BLOCK "040904B0"
          BEGIN
!             VALUE "FileDescription", "Interpreter Module"
!             VALUE "FileVersion", "1, 0, 0, 1"
!             VALUE "InternalName", "Interpreter"
!             VALUE "LegalCopyright", "Copyright 2000"
!             VALUE "OriginalFilename", "Interpreter.DLL"
!             VALUE "ProductName", "Interpreter Module"
!             VALUE "ProductVersion", "1, 0, 0, 1"
          END
      END
***************
*** 88,93 ****
  END
  
- #endif    // !_MAC
- 
  
  /////////////////////////////////////////////////////////////////////////////
--- 85,88 ----
***************
*** 98,104 ****
  // Icon with lowest ID value placed first to ensure application icon
  // remains consistent on all systems.
! IDI_ICONDN              ICON    DISCARDABLE     "iconDN.ico"
! IDI_COMPICON            ICON    DISCARDABLE     "compicon.ico"
! IDI_ICONUP              ICON    DISCARDABLE     "iconUP.ico"
  
  /////////////////////////////////////////////////////////////////////////////
--- 93,99 ----
  // Icon with lowest ID value placed first to ensure application icon
  // remains consistent on all systems.
! IDI_ICONDN              ICON                    "iconDN.ico"
! IDI_COMPICON            ICON                    "compicon.ico"
! IDI_ICONUP              ICON                    "iconUP.ico"
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 108,112 ****
  
  #ifdef APSTUDIO_INVOKED
! GUIDELINES DESIGNINFO DISCARDABLE 
  BEGIN
      IDD_ASPECT_PAGE, DIALOG
--- 103,107 ----
  
  #ifdef APSTUDIO_INVOKED
! GUIDELINES DESIGNINFO 
  BEGIN
      IDD_ASPECT_PAGE, DIALOG
***************
*** 129,133 ****
      BEGIN
          LEFTMARGIN, 7
!         RIGHTMARGIN, 192
          TOPMARGIN, 7
          BOTTOMMARGIN, 219
--- 124,128 ----
      BEGIN
          LEFTMARGIN, 7
!         RIGHTMARGIN, 324
          TOPMARGIN, 7
          BOTTOMMARGIN, 219
***************
*** 158,163 ****
  //
  
! IDD_ASPECT_PAGE DIALOG DISCARDABLE  0, 0, 307, 239
! STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
  FONT 8, "MS Sans Serif"
  BEGIN
--- 153,158 ----
  //
  
! IDD_ASPECT_PAGE DIALOG  0, 0, 307, 239
! STYLE DS_SETFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
  FONT 8, "MS Sans Serif"
  BEGIN
***************
*** 165,171 ****
  
  IDD_ASPECTORDER_DLG DIALOGEX 0, 0, 169, 146
! STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Global Aspect Order Dialogue"
! FONT 8, "MS Sans Serif"
  BEGIN
      DEFPUSHBUTTON   "OK",IDOK,15,120,50,14
--- 160,166 ----
  
  IDD_ASPECTORDER_DLG DIALOGEX 0, 0, 169, 146
! STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Global Aspect Order Dialogue"
! FONT 8, "MS Sans Serif", 0, 0, 0x1
  BEGIN
      DEFPUSHBUTTON   "OK",IDOK,15,120,50,14
***************
*** 180,190 ****
  END
  
! IDD_EQUIVDIALOG DIALOG DISCARDABLE  0, 0, 199, 226
! STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Name selection for equivalent objects"
! FONT 8, "MS Sans Serif"
  BEGIN
!     DEFPUSHBUTTON   "OK",IDOK,21,207,50,14
!     PUSHBUTTON      "Use metamodel defaults",IDCANCEL,91,207,89,14
      CONTROL         "Select the desired names by clicking in the first column",
                      IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,7,3,180,
--- 175,185 ----
  END
  
! IDD_EQUIVDIALOG DIALOGEX 0, 0, 331, 226
! STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Name selection for equivalent objects"
! FONT 8, "MS Sans Serif", 0, 0, 0x0
  BEGIN
!     DEFPUSHBUTTON   "OK",IDOK,74,205,50,14
!     PUSHBUTTON      "Use metamodel defaults",IDCANCEL,173,205,89,14
      CONTROL         "Select the desired names by clicking in the first column",
                      IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,7,3,180,
***************
*** 192,197 ****
  END
  
! IDD_OPTIONS DIALOG DISCARDABLE  0, 0, 244, 151
! STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Options"
  FONT 8, "MS Sans Serif"
--- 187,192 ----
  END
  
! IDD_OPTIONS DIALOG  0, 0, 244, 151
! STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Options"
  FONT 8, "MS Sans Serif"
***************
*** 219,224 ****
  END
  
! IDD_EVENTSDLG DIALOG DISCARDABLE  0, 0, 302, 158
! STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Events"
  FONT 8, "MS Sans Serif"
--- 214,219 ----
  END
  
! IDD_EVENTSDLG DIALOG  0, 0, 302, 158
! STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  CAPTION "Events"
  FONT 8, "MS Sans Serif"
***************
*** 266,270 ****
  //
  
! STRINGTABLE DISCARDABLE 
  BEGIN
      IDS_PROJNAME            "Component"
--- 261,265 ----
  //
  
! STRINGTABLE 
  BEGIN
      IDS_PROJNAME            "Component"

Index: BON2Component.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/BON2Component.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** BON2Component.cpp	26 Jan 2005 17:31:05 -0000	1.26
--- BON2Component.cpp	7 Apr 2005 21:26:23 -0000	1.27
***************
*** 260,264 ****
--- 260,267 ----
  				new_elem->setParentFolder( parent_folder); 
  				if ( m_equivBag.find( fco) != m_equivBag.end())
+ 				{
  					new_elem->setEquivPeers( m_equivBag[ fco]);
+ 					new_elem->setDisplayedName( it_1->getDispName());
+ 				}
  			}
  		}

Index: entity.h
===================================================================
RCS file: /project/gme-repository/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/entity.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** entity.h	16 Jul 2004 22:39:07 -0000	1.4
--- entity.h	7 Apr 2005 21:26:24 -0000	1.5
***************
*** 9,17 ****
  public:
  	explicit Entity( const BON::Folder& parent, const BON::FCO& p, const BON::FCO& p2 = BON::FCO())
! 		: m_pointer( p), m_respPointer( p2), m_parentFolder( parent), m_deleted( false) { }
  
  	Entity( const Entity & operand )
  		: m_pointer(operand.m_pointer)
  		, m_respPointer( operand.m_respPointer)
  		, m_parentFolder( operand.m_parentFolder)
  		, m_deleted( operand.m_deleted)
--- 9,18 ----
  public:
  	explicit Entity( const BON::Folder& parent, const BON::FCO& p, const BON::FCO& p2 = BON::FCO())
! 		: m_pointer( p), m_respPointer( p2), m_dispName(), m_parentFolder( parent), m_deleted( false) { }
  
  	Entity( const Entity & operand )
  		: m_pointer(operand.m_pointer)
  		, m_respPointer( operand.m_respPointer)
+ 		, m_dispName( operand.m_dispName)
  		, m_parentFolder( operand.m_parentFolder)
  		, m_deleted( operand.m_deleted)
***************
*** 24,27 ****
--- 25,29 ----
  		m_pointer = operand.m_pointer;
  		m_respPointer = operand.m_respPointer;
+ 		m_dispName = operand.m_dispName;
  		m_parentFolder = operand.m_parentFolder;
  		m_deleted = operand.m_deleted;
***************
*** 43,49 ****
--- 45,53 ----
  	BON::FCO getPointer() const { return m_pointer; }
  	BON::FCO getRespPointer() const { return m_respPointer; }
+ 	std::string getDispName() const { return m_dispName; }
  	BON::Folder getParentFolder() const { return m_parentFolder; }
  	void setPointer( const BON::FCO& p) { m_pointer = p; }
  	void setRespPointer( const BON::FCO& r_p) { m_respPointer = r_p; }
+ 	void setDispName( const std::string& dn) { m_dispName = dn; }
  	void setParentFolder( const BON::Folder& pf) { m_parentFolder = pf; }
  	bool isDeleted() const { return m_deleted; }
***************
*** 53,56 ****
--- 57,61 ----
  	BON::FCO m_pointer;
  	BON::FCO m_respPointer;
+ 	std::string m_dispName;
  	BON::Folder m_parentFolder;
  	bool m_deleted;



More information about the GME-commit mailing list