[gme-users] GME Add-On and object IDs

Jerry Lin jerrylin at usc.edu
Tue Apr 21 17:09:30 CDT 2009


Thanks Csaba and Peter for the responses.

I'm looking into using relative IDs now, however I'm still not clear on how
to set/get/search based on this.

In my add-on objectEventPerformed, I get a BON::Object which I want to get
the relative ID for.

I then want to create the same object on another instance of GME with the
same relative ID.

I can't do something like CComPtr<IMgaObject> obj = object;

How am I supposed to be accessing the relative IDs?

-Jerry

-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Peter
Volgyesi
Sent: Monday, April 20, 2009 9:34 AM
To: GME Users
Subject: [gme-users] GME Add-On and object IDs

Hi,

As Csaba said, the object IDs are read-only. The relative IDs are more
important and you want them to match in both projects if you want
(almost) identical results. (Relative IDs are unique within the
container only, so a path of relative IDs will identify the object
uniquely in the project). The read-only IDs are reassigned even after
an XML export/import step.

You might want to look at the multiuser/xml backend (available when
you create a new project) if you need a distributed environment.

Regards,

--
Peter Volgyesi
Research Scientist
Vanderbilt University, ISIS



On Mon, Apr 20, 2009 at 10:47 AM, Csaba Toth <ctoth at isis.vanderbilt.edu>
wrote:
> Dear Jerry,
>
>
>
> Object IDs are basically read only attributes. You can change the relative
> ID of an object, if this is allowed by the actual project.
>
> See Interfaces/Mga.idl:
>
>
>
> // Used with MgaProject::Preferences()
>
>
>
> typedef enum preference_flags {
>
> MGAPREF_NODUPLICATENAMES  = 0x00000001,         // make sure, names are
> never duplicated
>
> MGAPREF_NAMENEWOBJECTS    = 0x00000002,         // assign kind/rolename to
> new objects
>
> MGAPREF_IGNORECONNCHECKS =  0x00000004,         // do not complain on
> partially connected simple connections
>
> MGAPREF_FREEINSTANCEREFS =  0x00000008,         // do not bind refs in
> subtypes/instances to successors of ref target in basetype
>
> MGAPREF_RELAXED_RDATTRTYPES =  0x00000010,      // attributes may be read
as
> types other than the real type
>
> MGAPREF_RELAXED_WRATTRTYPES =  0x00000020,      // attributes may be
written
> as types other than the real type
>
> MGAPREF_MANUAL_RELIDS         = 0x00000040,     // relid-s are assigned
> manually
>
> } preference_flags;
>
>
>
> and:
>
>
>
> interface IMgaObject : IDispatch    {
>
> 

>
>       [propget, helpstring("property RelID")]         HRESULT RelID([out,
> retval] long *pVal);
>
>       [propput, helpstring("property RelID")]         HRESULT RelID([in]
> long newVal);
>
> 

>
> }
>
>
>
> and also these properties:
>
>       [id(0x560), propget, helpstring("property ChildRelIDCounter")]
>
>             HRESULT ChildRelIDCounter([out, retval] long *pVal);
>
>       [id(0x560), propput, helpstring("property ChildRelIDCounter")]
>
>             HRESULT ChildRelIDCounter([in] long pVal);
>
>
>
> On the IMgaFolder and IMgaModel interface. Child relid is generated in a
> deterministic way.
>
> Although you cannot change the Object ID part, but it is also generated in
a
> deterministic way, depending on the underlying storage infrastructure, see
> these functions in the source code:
>
>
>
> GME\Core\CoreBinFile.cpp:
>
> CCoreBinFile::CreateObject(objid_type *objid)
>
>
>
> GME\Core\CoreRepository.cpp:
>
> objid_type CCoreRepository::ObjID_GetNext(metaid_type metaid)
>
> (used in case of multi-user mode?)
>
>
>
> GME\Core\CoreODBC.cpp:
>
> CCoreODBC::CreateObject(objid_type *objid)
>
> (not used)
>
>
>
> These functions return the generated ids.
>
>
>
> Hope this helps,
>
> Csaba
>
>
>
> From: gme-users-bounces at list.isis.vanderbilt.edu
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Jerry Lin
> Sent: Sunday, April 19, 2009 4:50 AM
> To: gme-users
> Subject: [gme-users] GME Add-On and object IDs
>
>
>
> Hello,
>
> I am trying to create an add-on for real-time distributed modeling. At
this
> time it looks like I need to keep the various instances of GME working on
a
> consistent model, meaning, if someone creates an object, it should show up
> exactly as created on the other side. I am having trouble finding ways to
> create objects with a specific ID.
>
> Can someone help me here?
>
> -Jerry
>
> _______________________________________________
> 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