swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Adding another probe display


From: Akiko Ogawa - RS/GIS lab
Subject: Adding another probe display
Date: Mon, 14 Dec 1998 14:27:57 -0700

Would anyone help me add another probe display.
I experimented the following two methods using Swarm Template program but they 
did not work. What I intended is either to add second probe display for 
templateModelSwarm for another variable or to add a probe display for counter 
object. If anyone of you know the reason of my failure and the solution, please 
advise.
As I am a novice at programming including Swarm I would appreciate your 
explanation in plain English.

1. In TemplateModelSwarm.m, I copied d the following code and pasted just after 
the original one renaming "probeMap" to "probeMap2". Then I made another 
variable 
to probe.

>   probeMap = [EmptyProbeMap createBegin: aZone];
>   [probeMap setProbedClass: [self class]];
>   probeMap = [probeMap createEnd];
> 
>   // MODIFY: add your own probes for your parameters.
>   [probeMap addProbe: [probeLibrary getProbeForVariable: "increment"
>                                   inClass: [self class]]];
>   [probeLibrary setProbeMap: probeMap For: [self class]];

But After compiling, it turned out that only the most recent one, "probeMap2" 
was 
created and the first "probeMap" was ignored.

2. To create another probe display for Counter object, I copied the whole 
+crateBegin and -createEnd fuction from TemplateModelSwarm.m and pasted it in 
Counter.m with some changes as below. I changed the probed variable name, 
declared 
the function prototype and imported <objectbase/SwarmObject.h> and 
<objectbase.h> 
in the header file.

> +createBegin: (id) aZone {
>   //Changed from "TemplateModelSwarm * obj;"
>   Counter * obj;
>   id <ProbeMap> probeMap;
> 
>   obj = [super createBegin: aZone];
>
>   //Changed from "obj->increment = 3;"
>   obj->frequency = 3;
> 
>   probeMap = [EmptyProbeMap createBegin: aZone];
>   [probeMap setProbedClass: [self class]];
>   probeMap = [probeMap createEnd];
> 
>   //Changed variable name.
>   [probeMap addProbe: [probeLibrary getProbeForVariable: "frequency"
>                                   inClass: [self class]]];
> 
>   [probeLibrary setProbeMap: probeMap For: [self class]];
>   
>   return obj;
> }
> 
> - createEnd 
> {
>   return [super createEnd];
> }
 
And also I added the following code in -buildObjects function of 
TemplateObserverSwarm.m after the line "[templateModelSwarm buildObjects];".

>    CREATE_PROBE_DISPLAY ([templateModelSwarm getCouter]);

It compiled. It executed the program and created the initital displays without 
my 
new probe display. But once I pressed the START button, it exited the program 
leaving the following message.

> error: Warning_c.Creating (class)  
> Warning_c.Creating does not recognize raiseEvent:  
> Abort (core dumped)

Does anyone know what the problems with these are? 
If both 1 and 2 should be possible, I would like to know how I can do both.
I would appreciate your help.

Many thanks.

-------------------------------------------
Akiko Ogawa
Department of Geography and Earth Resources
Utah State University
address@hidden
-------------------------------------------


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]