At 12:28 PM 5/4/2006, Zimdars, Andrew wrote:
I'm working on an atomic actor right now where user-specified parameter
changes trigger further updates to the actor.  For example, the user
enters the name of a file that contains a remote service definition, and
the actor loads and processes the file, extracting from it information
like port names and types.  The user update (entering a file name)
causes a cascade of calls to attributeChanged() -- the file is read into
a buffer variable, triggering parsing of the buffer contents, triggering
the creation of new ports and the assignment of types to those ports,
and so on.

The end result is a correctly-configured actor.  It has the correct
input and output ports, with the correct types; it knows how to bind to
the remote service.  However, when I save and reopen the model
containing the actor, I find that a lot of the configuration values were
not persisted.  In particular, the port types and the contents of the
service definition buffer don't survive the round trip.

What objects do I need to notify when these "autonomous" updates occur
so the new values make it into the exported MoML?

Thanks,

Andy Z.

I guess the answer depends on exactly which attributes you
want to persist.  To make the type of a port persist, you
can include inside the port an attribute whose MoML looks like
this:

<property name="_type" class="ptolemy.actor.TypeAttribute" value="int"/>

Specifically, this will make the port an int type.

Note that MoML represents only entities, ports, relations,
attributes, and links.  Anything you want to be persistent has
to be represented by one of these.

In general, a good way to check this is to make the changes
you want with Vergil, then look at the XML using View->XML.

Edward




------------
Edward A. Lee
Professor, Chair of the EE Division, Associate Chair of EECS
231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
[EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to