Ok. Inside my Agent I do have lots of functions: command, recv, and others
that I implemented.
And inside my agent I also have lots of variables. Well, I am still not
that comfortable with C++, so I have a silly question:
If I do change a variable from my agent inside recv, for example,
shouldn't its value change also inside the command function? Well, if so,
it simply is not working how it should here.
For example, here is a part of my Agent structure:
159 class MyUnequalAgent : public Agent {
162 public:
163 int command(int argc, const char*const* argv);
164 void recv(Packet*, Handler*);
165 void getEnergy();
166 bool pot_answered; /* potence transmit answer only once */
167 int counter,rd,beTentativeHead;
168 bool clusterAllow/*can i really be a cluster-head?*/,sentStp;
169 MyUnequalAgent();
170 double energia;
180 };
But if I change beTentativeHead (which was started as 0) to 1 from inside
the function recv, it will remain false inside command.
And if I change energia's (which was started as 0.0) value from inside
getEnergy, it will remain being 0.0 inside command, or recv functions.
How do I change a variable value and make it take effect in all my
functions??? This is veeeery important, although I think it seems to be
silly, it is essential and maybe even easy to do what I want, but I simply
am not managing to.
Thanks,
--
Fernando Henrique Gielow - UFPR - NR2
Computer Science graduation student.