<div dir="ltr">Hi Tim,<div><br></div><div>Unfortunately, GME is slow and gets slower under the default configuration, which enables it to roll back illegal operations. Here's code to disable the roll-back capability in the GReAT code generator's ...._main.cpp output file:<br><br>#include "Mga.idl" // from $(GME_ROOT)\Interfaces</div><div>....<br></div><div><br><div>// get objects from DNs</div><div>UMLModelTransformer::RootFolder rootUMLModelTransformer_552= UMLModelTransformer::RootFolder::Cast( uMLModelTransformer_ref_54b.GetRootObject());</div><div>StructureTestDSL::RootFolder rootStructureTestDSL_553= StructureTestDSL::RootFolder::Cast( structureTestDSL_ref_54e.GetRootObject());</div><div><br></div><div>// new code starts here:</div><div>// disable nested transactions for output model</div><div>IUnknown* gmeFco = UdmGme::Udm2Gme(sdnUMLModelTransformer_549.GetRootObject());</div><div>IMgaObject* gmeFcoPtr = NULL;</div><div>gmeFco->QueryInterface(__uuidof(IMgaObject), (void**)&gmeFcoPtr);</div><div>IMgaProject* project = NULL;</div><div>gmeFcoPtr->get_Project(&project);</div><div>long prefs;</div><div>project->get_Preferences(&prefs);</div><div>project->put_Preferences(MGAPREF_NO_NESTED_TX | prefs);</div><div>gmeFcoPtr->Release();</div><div>project->Release();</div><div>gmeFco->Release();</div><div>// new code ends</div><div><br></div><div>// Add objects to input packets.</div><div>templateModels_1.push_back( rootStructureTestDSL_553);</div><div>trafos_3.push_back( rootUMLModelTransformer_552);</div><div>// Get access to temporary root object(s).</div><div>g_Crosslinks__GlobalRootContainer= Crosslinks::GlobalRootContainer::Cast( crosslinks_ref_551.GetRootObject());</div><div>// transformation</div><div>Start_0 start_0;</div><div>start_0( templateModels_1, trafos_3);</div></div><div><br></div><div><br></div><div><br></div><div>Alternatively, you can commit the GME transaction before running UdmUtil::CopyObjectHierarchy:</div><div>#include "UdmGme.h"<br>....<br>((UdmGme::GmeDataNetwork*)fromObj.__impl()->__getdn())->CommitEditSequence();<br></div><div><br></div><div>GME will be able to roll back operations, but this will reduce the slowdown.</div><div><br></div><div><br></div><div>You should add error checking, e.g. in case the output file is not a GME file.</div><div><br></div><div>Kevin</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 14, 2017 at 6:48 AM, Belschner, Tim <span dir="ltr"><<a href="mailto:tim.belschner@ils.uni-stuttgart.de" target="_blank">tim.belschner@ils.uni-stuttgart.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="DE" link="#0563C1" vlink="#954F72">
<div class="m_5842583394503343231WordSection1">
<p class="MsoNormal">Hello  everybody,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">based on the generated code for the GReAT Group operator, we built up a cpp template for copying an abstract source object including its children. Since we would like to pass the copied object to an out-port within the
 same rule, the approach is to create a dummy object within the rule’s effector and replace it during the AttributeMapping by calling the aforementioned template:<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">//++++++++++++++++++++++++++<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">template <class T1, class T2, class T3 > bool UserLibCloneObjectAbstractSour<wbr>ce( T1& fromObj, T2& toObj, T3& toParent)<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">{<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">                T1 newObj= T1::Create( toParent );<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">                UdmUtil::copy_assoc_map copy_map;<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">                UdmUtil::CopyObjectHierarchy(<wbr>fromObj.__impl(), newObj.__impl(), newObj.__impl()->__getdn(), copy_map);<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">                toObj.DeleteObject();<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">                toObj = newObj;<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">                return true;<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">}<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">// ++++++++++++++++++++++++++<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">The result in the transformation’s output is as intended. But, the runtime of the function UdmUtil::CopyObjectHierarchy within the template increases with every call. After several calls, the execution of UdmUtil::CopyObjectHierarchy
 takes several seconds. My search within the Udm source code did not reveal any reason. This is why I would like to ask if someone could give me a hint or provide an alternative solution? For example an incorrect usage of the UdmUtil::copy_assoc_map.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">An example transformation with the necessary metamodel and inputs can be found here:
<a href="https://belschner.org/nextcloud/index.php/s/RiMjSyd2yHKFYdT" target="_blank">https://belschner.org/<wbr>nextcloud/index.php/s/<wbr>RiMjSyd2yHKFYdT</a>  PW: GReAT123!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">The cpp template is located in the “UserLib_CloneObject.h”. The increasing runtime for a single “CopyObjectHierarchy” execution can be seen in the console output (Steps 2 to 3).<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks in advance and best regards<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Tim<u></u><u></u></span></p>
</font></span></div>
</div>

<br>______________________________<wbr>_________________<br>
great-users mailing list<br>
<a href="mailto:great-users@list.isis.vanderbilt.edu">great-users@list.isis.<wbr>vanderbilt.edu</a><br>
<a href="http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/great-users" rel="noreferrer" target="_blank">http://list.isis.vanderbilt.<wbr>edu/cgi-bin/mailman/listinfo/<wbr>great-users</a><br>
<br></blockquote></div><br></div>