Creating an instance of a component type in GME
Peter Volgyesi
peter.volgyesi at vanderbilt.edu
Mon Oct 7 12:25:49 CDT 2002
I hope, this helps:
--
peter
----------------------------------------------------------------------------
--------------
/*
First example: the code creates a subtype and an instance of the first
'ParadigmSheet' model into the root folder
*/
void CComponent::InvokeEx(CBuilder &builder,CBuilderObject *focus,
CBuilderObjectList &selected, long param)
{
CBuilderFolder *root = builder.GetRootFolder();
ASSERT(root);
const CBuilderModelList *models = root->GetRootModels();
if (models && models->GetCount() > 0) {
CBuilderModel *firstmodel = models->GetHead();
CComPtr<IMgaFolder> mgaRoot = root->GetIFolder();
CComPtr<IMgaFCO> mgaBase = firstmodel->GetIModel();
CComPtr<IMgaFCO> mgaSubType;
COMTHROW(mgaRoot->DeriveRootObject(mgaBase, VARIANT_FALSE, &mgaSubType));
CComPtr<IMgaFCO> mgaInstance;
COMTHROW(mgaRoot->DeriveRootObject(mgaBase, VARIANT_TRUE, &mgaInstance));
}
}
----------------------------------------------------------------------------
--------------
/*
Second example: the code creates a subtype and an instance of the first
'Atom' atom in the first 'ParadigmSheet' model. The role
of the derived objects will be the same (as in most cases).
*/
void CComponent::InvokeEx(CBuilder &builder,CBuilderObject *focus,
CBuilderObjectList &selected, long param)
{
CBuilderFolder *root = builder.GetRootFolder();
ASSERT(root);
const CBuilderModelList *models = root->GetRootModels();
if (models && models->GetCount() > 0) {
CBuilderModel *firstmodel = models->GetHead();
const CBuilderAtomList *atoms = firstmodel->GetAtoms("Atom");
if (atoms && atoms->GetCount() > 0) {
CBuilderAtom* firstatom = atoms->GetHead();
CComPtr<IMgaModel> mgaModel = firstmodel->GetIModel();
CComPtr<IMgaFCO> mgaBase = firstatom->GetIAtom();
CComPtr<IMgaMetaRole> metaRole;
COMTHROW(mgaBase->get_MetaRole(&metaRole));
ASSERT(metaRole);
CComPtr<IMgaFCO> mgaSubType;
COMTHROW(mgaModel->DeriveChildObject(mgaBase, metaRole, VARIANT_FALSE,
&mgaSubType));
CComPtr<IMgaFCO> mgaInstance;
COMTHROW(mgaModel->DeriveChildObject(mgaBase, metaRole, VARIANT_TRUE,
&mgaInstance));
}
}
}
----------------------------------------------------------------------------
--------------
----- Original Message -----
From: "Feng Shi" <fengshi at isis-server.isis.vanderbilt.edu>
To: "Sandeep Neema" <neemask at vuse.vanderbilt.edu>
Cc: "GME List" <GMEList at isis-server.vuse.vanderbilt.edu>
Sent: Wednesday, October 02, 2002 10:21 PM
Subject: RE: Creating an instance of a component type in GME
> Sandeep,
>
> According to Akos words, there is no direct method from BON can be used
> for creating an instance of an object right now. I'm sorry.
>
> ************************************************************************
> *
> To all GME guys,
>
> Is there any one who knows how to use BON to create an instance of an
> object?
>
> Peter: Would you please once again to show us how to implement this
> function with the internal code of BON? Thanks,
>
> Feng
>
>
>
More information about the gme-users
mailing list