<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2975" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT face=Verdana
color=#0000ff size=2>Hi Zoli,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT face=Verdana
color=#0000ff size=2>Thanks for your reply.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT face=Verdana
color=#0000ff size=2>The workaround works when I do not save or closes/reopens
my model after the objects where deleted. (An exception is thrown from
BONimpl.cpp line 50) :</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT face=Verdana
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006>
<P><FONT size=2><FONT face=Verdana color=#0000ff>inline</FONT><FONT face=Verdana
color=#0000ff> MON::ObjectPtr _getMetaBase( IMgaObject* spObject
)</FONT></FONT></P>
<P><FONT face=Verdana color=#0000ff size=2>{</FONT></P>
<P><FONT face=Verdana color=#0000ff size=2>MON::ObjectPtr spMeta;</FONT></P>
<P><FONT face=Verdana><FONT color=#0000ff><FONT size=2>COMTHROW(
spObject->get_MetaBase( spMeta.Addr() ) );<SPAN class=812173308-09112006>
//<-- exception thrown here</SPAN></FONT></FONT></FONT></P>
<P><FONT size=2><FONT face=Verdana color=#0000ff>return</FONT><FONT face=Verdana
color=#0000ff> spMeta;</FONT></FONT></P>
<P><FONT face=Verdana color=#0000ff size=2>}</FONT></P>
<P><FONT face=Verdana color=#0000ff size=2><SPAN class=812173308-09112006>But I
am not able to figure out how this is related to the FindById
function?</SPAN></FONT></P>
<P><FONT face=Verdana color=#0000ff size=2><SPAN
class=812173308-09112006></SPAN></FONT> </P>
<P><FONT face=Verdana color=#0000ff size=2><SPAN class=812173308-09112006>To
"solve" my problem I have removed the following line from the FindByIDI: <FONT
face="Times New Roman" color=#008000>COMTHROW( m_spProject->GetObjectByID(
Util::Copy( strID ), spObject.Addr() ) );</FONT></SPAN></FONT></P>
<P><FONT face=Verdana color=#0000ff size=2><SPAN class=812173308-09112006>and
then it does not throw the exception but return NULL, if the model where saved
or closed/reopened after the objects where
deleted.</SPAN></FONT></P></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=812173308-09112006><FONT size=2>
<P>ObjectImpl* ProjectImpl::findByIDI( </FONT><FONT color=#0000ff
size=2>const</FONT><FONT size=2> std::string& strID )</P>
<P>{</P>
<P></FONT><FONT color=#008000 size=2>// Look for in Objects'
cache</P></FONT><FONT size=2>
<P>ObjectMapByID::iterator it = m_mapObjectsByID.find( strID );</P>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> ( it !=
m_mapObjectsByID.end() )</P>
<P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>
it->second;</P>
<P></FONT><FONT color=#008000 size=2>// Retrieve and Attach</P></FONT><FONT
size=2>
<P>ObjectPtr spObject;</P>
<P></FONT><FONT color=#008000 size=2>//COMTHROW( m_spProject->GetObjectByID(
Util::Copy( strID ), spObject.Addr() ) );</P></FONT><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> ( ! spObject )</P>
<P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2> NULL;</P>
<P></FONT><FONT color=#0000ff size=2>return</FONT><FONT size=2>
ObjectImpl::attachI( spObject, </FONT><FONT color=#0000ff
size=2>this</FONT><FONT size=2> );</P>
<P>}</P></FONT></SPAN></DIV>
<DIV><SPAN class=812173308-09112006></SPAN><FONT
size=2>Best regards,</FONT></DIV>
<DIV><SPAN class=812173308-09112006></SPAN><SPAN
class=812173308-09112006></SPAN><FONT size=2>J<SPAN
class=812173308-09112006>esper</SPAN></FONT><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> gme-users-bounces@list.isis.vanderbilt.edu
[mailto:gme-users-bounces@list.isis.vanderbilt.edu] <B>On Behalf Of </B>Zoltan
Molnar<BR><B>Sent:</B> 8. november 2006 20:17<BR><B>To:</B>
gme-users<BR><B>Subject:</B> RE: [gme-users] probklems with findByID
(BON2)<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=040021119-08112006><FONT face=Arial color=#0000ff size=2>It
seems that the current implementation of findById disregards object status,
which may be checked with <FONT face="Times New Roman"
color=#000000>ObjectImpl::getStatus() implemented as
follows:<BR></FONT></FONT></SPAN><SPAN class=040021119-08112006><FONT
size=2></FONT></SPAN></DIV>
<DIV><SPAN class=040021119-08112006><FONT size=2>ObjectStatus
ObjectImpl::getStatus() </FONT><FONT color=#0000ff size=2>const<BR></FONT><FONT
size=2>{<BR></FONT><FONT color=#0000ff size=2>long</FONT><FONT size=2>
lStatus;<BR></FONT><FONT size=2>COMTHROW( m_spObject->get_Status(
&lStatus ) );<BR></FONT><FONT color=#0000ff size=2>switch</FONT><FONT
size=2> ( lStatus ) {<BR></FONT><FONT color=#0000ff size=2>case</FONT><FONT
size=2> OBJECT_EXISTS :</FONT><FONT color=#0000ff size=2>return</FONT><FONT
size=2> OST_Exists;<BR></FONT><FONT color=#0000ff size=2>case</FONT><FONT
size=2> OBJECT_ZOMBIE :</FONT><FONT color=#0000ff size=2>return</FONT><FONT
size=2> OST_Zombie;<BR></FONT><FONT color=#0000ff size=2>case</FONT><FONT
size=2> OBJECT_DELETED :</FONT><FONT color=#0000ff size=2>return</FONT><FONT
size=2> OST_Deleted;<BR></FONT><FONT color=#0000ff size=2>default</FONT><FONT
size=2> :ASSERTTHROW( Util::Exception( "Unprocessed Object Status!" )
);<BR>}<BR></FONT></SPAN><SPAN class=040021119-08112006><FONT
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=040021119-08112006><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=040021119-08112006><FONT size=2>So until i implement a fix,
please check the status of objects returned by findById, like
this:</FONT></SPAN></DIV>
<DIV><SPAN class=040021119-08112006>
<P><FONT size=2>Object obj = project->findByID("id-0065-00000008", <FONT
color=#0000ff>false</FONT>);<BR><FONT color=#0000ff>if</FONT>(obj)<BR>{<BR><SPAN
class=040021119-08112006> </SPAN>project->consoleMsg(
"Found", MSG_NORMAL);<BR><FONT color=#0000ff><SPAN
class=040021119-08112006> </SPAN>if</FONT>(
obj->getStatus() != OST_Exists)<BR><SPAN
class=040021119-08112006>
</SPAN>project->consoleMsg( "but it's a zombie", MSG_ERROR);<BR></FONT><SPAN
class=040021119-08112006><FONT size=2>}</FONT></SPAN></P>
<P><FONT face=Arial color=#0000ff size=2></FONT> </P>
<P><SPAN class=040021119-08112006><FONT face=Arial color=#0000ff size=2>br,
Zoli</FONT></SPAN></P>
<P><FONT face=Arial color=#0000ff size=2></FONT> </P></SPAN><SPAN
class=040021119-08112006><FONT size=2></FONT></SPAN><SPAN
class=040021119-08112006><FONT size=2></DIV></FONT></SPAN>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
gme-users-bounces@list.isis.vanderbilt.edu
[mailto:gme-users-bounces@list.isis.vanderbilt.edu] <B>On Behalf Of
</B>Berthing Jesper<BR><B>Sent:</B> Saturday, October 28, 2006 8:25
AM<BR><B>To:</B> gme-users<BR><B>Subject:</B> RE: [gme-users] probklems with
findByID (BON2)<BR><BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>Hi All,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>I have some extra information to the problem I posted
some days ago.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>1) When I delete some objects (Atoms) from my model and
then execute the interpreter, the function findByID returns that the delete
object still exists? (How can that be true if I deleted the objects before
executing the interpreter)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>2) If I delete some objects from the model, save and
close the project and reopens it again, executes the interpreter. What tries
to execute the function findByID with the ID on the delete objects, an
exception is thown each time. Whereas the documentation says that a NULL
object should be returned.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>I have tried to call the function with either true or
false as the secons parameter with no difference.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>Has anybody any experience with this function? and its
behaviour or any clue what I could be doing wrong, please help me?
;-)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>I am using GME version 6.5.8</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>Thanks.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>Best regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006><FONT face=Arial
color=#0000ff size=2>Jesper</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=852321513-28102006></SPAN> </DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>From:</B>
gme-users-bounces@list.isis.vanderbilt.edu
[mailto:gme-users-bounces@list.isis.vanderbilt.edu] <B>On Behalf Of
</B>Berthing Jesper<BR><B>Sent:</B> 23. oktober 2006 20:08<BR><B>To:</B>
gme-users@list.isis.vanderbilt.edu<BR><B>Subject:</B> [gme-users] probklems
with findByID (BON2)<BR></FONT><BR></DIV>
<DIV></DIV><!-- Converted from text/plain format --><FONT face=Arial
color=#0000ff size=2></FONT><BR>
<P><FONT size=2>Hi,<BR><BR>I have a problem with the function findByID that
throws an exception on line 50 in bonimpl.cpp.<BR><BR>Currently I am using the
function in order to check the current model against a backup model (XML)
where I have the ID’s stored of each object. If the object is present in the
current model it functions correctly, but if it is not present the exception
is thrown.<BR><BR>Therefore, how should I use the
function?<BR><BR>Example:<BR>try<BR>{<BR> if(0 ==
project->findByID(“Id not present in the model”, true))<BR>
{<BR> // Object with id not
present<BR> }<BR> else<BR>
{<BR> // Object with id
present.<BR> }<BR>}<BR>catch(BON::Exception&
e)<BR>{<BR> //print
error<BR>}<BR><BR>Best
regards,<BR>Jesper<BR></FONT></P></BLOCKQUOTE></BODY></HTML>