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

Csaba Toth ctoth at isis.vanderbilt.edu
Mon Apr 20 10:47:01 CDT 2009


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20090420/bff18ee4/attachment.html 


More information about the gme-users mailing list