[gme-users] cloning of models using BON
Sumant Tambe
sutambe at dre.vanderbilt.edu
Fri Mar 21 13:19:59 CDT 2008
Hi Zoli,
Thanks for the code. I'm integrating it into my program now. I'm not
sure how to get a handle to the copied object from your copy function.
Can you please tell what needs to change so that it can return a handle?
Thanks,
Sumant.
Zoltan Molnar wrote:
> Oh, sorry. BON1 might not have such functionality implemented, but the
> underlying COM functionality allows easy implementation of it:
>
> The COM methods of IMgaModel look like this:
> HRESULT MoveFCOs([in] IMgaFCOs * to_copy, [in]
> IMgaMetaRoles *destroles, [out] IMgaFCOs **objs);
> HRESULT CopyFCOs([in] IMgaFCOs * to_move, [in]
> IMgaMetaRoles *destroles, [out] IMgaFCOs **objs);
>
>
> So a helper method to benefit from these could look like this:
> void copy( CBuilderModel* where_to_copy, CBuilderObject *to_copy)
> {
> CComPtr<IMgaFCO> src_obj = to_copy->getIObject();
> CComPtr<IMgaModel> par_obj = where_to_copy->GetIModel();
>
> CComPtr<IMgaFCOs> fco_coll; // ptr to a collection of
> IMgaFCO objects
> CComPtr<IMgaMetaRoles> rol_coll; // same
> fco_coll.CoCreateInstance( L"Mga.MgaFCOs"); // create an
> empty 'array' of MgaFCO objects
> rol_coll.CoCreateInstance( L"Mga.MgaMetaRoles")); // same
>
> // fco collection with 1 element
> fco_coll->Append( src_obj);
>
> CComPtr<IMgaMetaRole> role;
> src_obj->get_MetaRole(&role);
>
> // role collection with 1 element
> rol_coll->Append( role); // based on the assumption that the
> parent of src_obj is of same or similar kind to par_obj
>
> CComPtr<IMgaFCOs> dst_coll;
> par_obj->CopyFCOs( fco_coll, rol_coll, &dst_coll);
>
> // analyze dst_coll
> long l = 0;
> if( dst_coll) dst_coll->get_Count( &l);
> for( int i = 1; i <= l; ++i)
> {
> CComPtr<IMgaFCO> dst;
> dst_coll->get_Item( i, &dst);
> }
> }
>
> Let me know if you need something else,
> Zoli
>
>> -----Original Message-----
>> From: gme-users-bounces at list.isis.vanderbilt.edu
>> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf
>> Of Sumant Tambe
>> Sent: Friday, March 21, 2008 11:22 AM
>> To: gme-users
>> Subject: Re: [gme-users] cloning of models using BON
>>
>>
>> Hi Zoli,
>>
>> It is a part of BON2 I believe. I'm wondering if similar thing can be
>> done using BON. I need that because I'm maintaining legacy
>> code written
>> using BON.
>>
>> Thanks,
>>
>> Sumant.
>>
>> Zoltan Molnar wrote:
>>> Sumant,
>>>
>>> There is a method called copy, and another called move. copy's
>>> signature is as follows:
>>>
>>> FCOImpl::copy( Folder& parent)
>>> FCOImpl::copy( Model& parent, std::string& role)
>>>
>>>
>>> Zoli
>>>
>>>
>>>> -----Original Message-----
>>>> From: gme-users-bounces at list.isis.vanderbilt.edu
>>>> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf
>>>> Of Sumant Tambe
>>>> Sent: Thursday, March 20, 2008 8:34 PM
>>>> To: gme-users
>>>> Subject: [gme-users] cloning of models using BON
>>>>
>>>>
>>>> Hi folks,
>>>>
>>>> Is there a way to programatically duplicate or clone a model
>>>> using BON? Effect should be same as that of a manual
>>>> copy-paste operation, which
>>>> does a deep-copy of the source model.
>>>>
>>>> Thanks,
>>>>
>>>> Sumant.
>>>> _______________________________________________
>>>> gme-users mailing list
>>>> gme-users at list.isis.vanderbilt.edu
>>>> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>>>>
>>> _______________________________________________
>>> gme-users mailing list
>>> gme-users at list.isis.vanderbilt.edu
>>> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>> _______________________________________________
>> gme-users mailing list
>> gme-users at list.isis.vanderbilt.edu
>> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
More information about the gme-users
mailing list