[great-dev] Re: [udm-users] RE: [great-users] "Com exception: Object cannot bechanged"

Endre Magyari endre at isis.vanderbilt.edu
Sun Apr 10 23:32:56 CDT 2005


> 2) from the same guard/AttrMap create an association (defined in

> How do I create the association of step 2) ?
>

 From this point of view, an object's archetype has the same type, so you  
have to create an association between two objects of the same type. (of  
course-  you must have such an association defined in your UML meta)



MyClass a; //MyClass is defined in MyClass.h and it is your custom class

// init. of a

if (a.isInstance())
{
	MyClass type = a.Archetype();
	
	// if it is a simple association
	a.assoc_role_name() = type;
	//type.assoc_other_role_name() = a; //it works either way

	//if it is an assoc. class based association

	MyAssocClass mac;
	//init. of mac
	
	mac.assoc_role_name_end() = a;
	mac.assoc_other_role_name_end() = type;

	//a.assoc_other_role_name() = mac; type.assoc_role_name() = a; //it works  
either way
};


in any case, this works only if you have defined in your Uml meta diagram  
an association between a MyClass and itself. And if so, you have defined  
in the generated API, for class MyClass, the accessor functions for  
getting/setting associations.


If you don't have the generated API and you need to do this generically,  
you can use:
Udm::ObjectImpl::setAssociation
Udm::Object::setAssociation
Udm::Object::CreateLink

functions. I can further help on that, if you don't have access to the  
domain specific API.

Endre


>
> Endre Magyari wrote:
>
>>
>> Then the code is:
>>
>> Udm::Object o;
>>
>> if (o.isInstance())
>> {
>>     //o is an instance, only it's type can be modified
>>     Udm::Object type = o.archetype();
>>     //modify type
>> }
>> else
>> {
>>     //o is not an instance, it's either an normal object(model, fco,
>> atom) or  a derived object, which can be modified.
>>     //if it's a derived object, isSubtype() returns true
>> };
>>
>>
>>
>> Note that this is generic code, but since all generated types are
>> inherited from  Udm::Object, isInstance(), isSubtype() works.
>> For the generated classes in UDM API there is also available an
>> Archetype()call, which is typed, it returns with an object of the
>> same  type.
>>
>>
>> Endre
>>
>>
>>
>> On Fri, 8 Apr 2005 10:20:39 -0500, Attila Vizhanyo
>> <viza at isis.vanderbilt.edu> wrote:
>>
>>> Tivadar wants to (1) query if an object is instance or not (2) if it  
>>> is,
>>> get access to its type object, and modify the type object.
>>>
>>>
>>>> -----Original Message-----
>>>> From: Endre Magyari
>>>> Sent: Friday, April 08, 2005 2:06
>>>> To: udm-users
>>>> Cc: This is a list for GReAT developers to exchange
>>>> development related thoughts and ideas
>>>> Subject: [great-dev] Re: [udm-users] RE: [great-users] "Com
>>>> exception: Object cannot bechanged"
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Attila,
>>>>
>>>>     there is no UDM API which permits to modify an instance
>>>> object - besides,
>>>> Tivadar is talking about a COM exception thrown by MGA layer.
>>>>     So, what kind of solution did you mean ?
>>>>
>>>> Thanks,
>>>> Endre
>>>>
>>>>
>>>> On Thu, 7 Apr 2005 16:42:22 -0500, Attila Vizhanyo
>>>> <viza at isis.vanderbilt.edu> wrote:
>>>>
>>>> > I believe these problems can be solved using the UDM API
>>>> from Guard/
>>>> > AttributeMapping code. I'm forwarding your post to the
>>>> udm-users list.
>>>> >
>>>> > Thanks,
>>>> > Attila
>>>> >
>>>> >
>>>> >> -----Original Message-----
>>>> >> From: Tivadar Szemethy
>>>> >> Sent: Thursday, April 07, 2005 16:28
>>>> >> To: great-users
>>>> >> Subject: [great-users] "Com exception: Object cannot be changed"
>>>> >>
>>>> >>
>>>> >> Hello,
>>>> >>
>>>> >> In a GReAT transformation, I have to make temporary
>>>> modifications to
>>>> >> my src model in order to make further processing easier. However,
>>>> >> some of the objects in the src are Instances (as in General
>>>> >> Properties/Type in the Attribute Panel in GME) of other objects
>>>> >> defined in a "Model Library" folder in the src model.
>>>> >>
>>>> >> As I understand, instances cannot be modified.
>>>> >> Therefore, I need to come up with a GReAT rule, which:
>>>> >>
>>>> >> a) checks whether the object in question is an Instance or not
>>>> >> b) if it is, returns the corresponding "Template" object
>>>> which can be
>>>> >> modified
>>>> >>
>>>> >> How do I do this ?
>>>> >>
>>>> >> Thanks,
>>>> >>
>>>> >> Tivadar
>>>> >> _______________________________________________
>>>> >> great-users mailing list great-users at list.isis.vanderbilt.edu
>>>> >> http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
>>>> >>
>>>> > _______________________________________________
>>>> > udm-users mailing list
>>>> > udm-users at list.isis.vanderbilt.edu
>>>> > http://list.isis.vanderbilt.edu/mailman/listinfo/udm-users
>>>>
>>>>
>>>> _______________________________________________
>>>> great-dev mailing list
>>>> great-dev at list.isis.vanderbilt.edu
>>>> http://list.isis.vanderbilt.edu/mailman/listinfo/great-dev
>>>>
>>> _______________________________________________
>>> great-dev mailing list
>>> great-dev at list.isis.vanderbilt.edu
>>> http://list.isis.vanderbilt.edu/mailman/listinfo/great-dev
>>
>>
>>
>
>




More information about the great-users mailing list