Christopher Hylands wrote:
If you select 'Listen to actor' on a composite actor, then
you will see events from the Director. Compare and contrast
this with going inside the composite actor and selecting Debug -> Listen to director.
Yes, Director events such as changes to the topology show up, not any runtime events.
Browsing through the code, I see that very few actors have debug printing code. Notably, IOPort and TypedIOPort do but when one right-clicks on their icons, "Listen to actor" is not presented as a choice. Also, they only print transfers of data if opaque.
What do you think of teaching Entity to add the listener to all of the IOPorts it contains? I tried out the code below but still didn't get any meaningful though I haven't set up emacs and jdb yet to trace it out.
==== added to ptolemy/kernel/Entity.java
/** Append the listener to all of the contained IOPorts.
* @param listener The listener to which to send debug messages.
*/
public synchronized void addDebugListener(ptolemy.kernel.util.DebugListener listener) {
super.addDebugListener(listener);
Enumeration e = _portList.elements();
while (e.hasMoreElements()) {
ptolemy.kernel.util.Debuggable d = (ptolemy.kernel.util.Debuggable) e.nextElement();
d.addDebugListener(listener);
}
}
/** Remove the listener from all of the contained IOPorts.
*/
public synchronized void removeDebugListener(ptolemy.kernel.util.DebugListener listener) {
super.removeDebugListener(listener);
Enumeration e = _portList.elements();
while (e.hasMoreElements()) {
ptolemy.kernel.util.Debuggable d = (ptolemy.kernel.util.Debuggable) e.nextElement();
d.removeDebugListener(listener);
}
}
====== added to send() function of ptolemy.actor.TypedIOPort.java
for (int j = 0; j < farReceivers[channelIndex].length; j++) {
TypedIOPort port =
(TypedIOPort)farReceivers[channelIndex][j].getContainer();
Type farType = port.getType();
//Begin add JEK:
if (_debugging) {
this._debug(this.getFullName(), " Port sending token: ", token.toString(), " to port: " + port.getFullName());
}
//End add JEK
if (farType.equals(token.getType())) {
farReceivers[channelIndex][j].put(token);
} else {
Token newToken = farType.convert(token);
farReceivers[channelIndex][j].put(newToken);
}
}
---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]