Personal tools
You are here: Home Forum How to use Salome? Architecture advice: developing SALOME module

Architecture advice: developing SALOME module

Up to How to use Salome?

Architecture advice: developing SALOME module

Posted by Goodrone at March 23. 2011

Hello,

I'm developing a module (let's call it MyModule) in Python, using PyHello as a starting template, and I think I need some advice on the module architecture.

In MyModule there is a hierarchy of objects, and I'm integrating this hierarchy into the study so that users could interact with the objects through the SALOME GUI. I'm going to make this integration as loose as possible.

As far as I understand I need to create an object in study (SO) for every object in my hierarchy (HO), and translate events (e.g. context menu popup) from SO to HO. Is it correct? I don't need to make HO aware of the study, do I? How can I hold references from SO to HO?

Currently I'm looking through the source codes of GEOM and SMESH modules, but I think that MyModule's architecture could be simpler, because I'm not going to make it available to other modules through CORBA.

Please let me know if I could clarify any details.

Thanks in advance,
Andrew.

Re: Architecture advice: developing SALOME module

Posted by Damien GODIN at March 24. 2011

Hello,

I'm sorry,  i will not be able to help you but i have some problems to create my own module too.

I'm interrested to know how to add objects in the study. I can't find any simple documentation to do that.

For the moment i have duplicated a geom object with GEOM::GEOM_Object::_duplicate(), and i want to add the duplicated object in the study.

Thanks for your help.

Damien

 

Previously Goodrone wrote:

Hello,

I'm developing a module (let's call it MyModule) in Python, using PyHello as a starting template, and I think I need some advice on the module architecture.

In MyModule there is a hierarchy of objects, and I'm integrating this hierarchy into the study so that users could interact with the objects through the SALOME GUI. I'm going to make this integration as loose as possible.

As far as I understand I need to create an object in study (SO) for every object in my hierarchy (HO), and translate events (e.g. context menu popup) from SO to HO. Is it correct? I don't need to make HO aware of the study, do I? How can I hold references from SO to HO?

Currently I'm looking through the source codes of GEOM and SMESH modules, but I think that MyModule's architecture could be simpler, because I'm not going to make it available to other modules through CORBA.

Please let me know if I could clarify any details.

Thanks in advance,
Andrew.

 

Re: Architecture advice: developing SALOME module

Posted by Saint Michael at March 24. 2011

Hello, Andrew

As far as I understand I need to create an object in study (SO) for every object in my hierarchy (HO), and translate events (e.g. context menu popup) from SO to HO. Is it correct?
Yes, it is.
I don't need to make HO aware of the study, do I?
It is not necessary.
How can I hold references from SO to HO?

It is done using attributes of SO. An SO can store many different attributes of different types. You can find their description in the file SALOMEDS_Attributes.idl. In standard SALOME modules, SO holds IOR of CORBA object using the attribute "AttributeIOR". By the IOR, a CORBA object can be retrieved and casted to a specific CORBA interface e.g to GEOM::GEOM_Object interface.

You can store e.g. the integer identifier using AttributeInteger and then map that ID to your HO.

BR
St. Michael

Re: Architecture advice: developing SALOME module

Posted by Goodrone at March 30. 2011

Hello, Michael

Thank you for the reply! As far as I understand, there are two possible ways of integration:

  • using the CORBA approach, i.e. define interfaces to my classes and write implementation of them in Python. It seems to me as a correct and robust way, but it will take much more time and effort to complete.
  • map some identifiers using attributes of SALOME study objects — much easier, but I'm worried if there are any pitfalls I'm not aware of. Is it OK to have a completely separated hierarchy of objects?

Best wishes,
Andrew.

Re: Architecture advice: developing SALOME module

Posted by Saint Michael at March 30. 2011
I'm worried if there are any pitfalls I'm not aware of. Is it OK to have a completely separated hierarchy of objects?

 

Don'y worry, it is OK.

It seems to me as a correct and robust way

Robustness depends on a developer.

 

BR, St. Michael

Re: Architecture advice: developing SALOME module

Posted by Goodrone at March 31. 2011

One more question: where could I read more about attributes? Is it OK to use AttributeInteger for my purposes or better inherit another class or GenericAttribute?

Andrew

Powered by Ploneboard
Document Actions