[Ns-developers] Application::Start/Stop, time parameter inconsistent with Simulator::Schedule

Gustavo Carneiro gjcarneiro at gmail.com
Thu May 29 03:55:48 PDT 2008


On 28/05/2008, Gustavo Carneiro <gjcarneiro at gmail.com> wrote:
>
>
>
> On 28/05/2008, Mathieu Lacage <mathieu.lacage at sophia.inria.fr> wrote:
>>
>>
>> On Tue, 2008-05-27 at 23:59 -0700, craigdo at ee.washington.edu wrote:
>>
>> > So I think the simple, straightforward, easy to remember and use thing
>> > is to
>> > go with calls like:
>> >
>> > Application::Start (Seconds (5.)) means start *in* five seconds
>> > (relative).
>> > If you do this before the simulation starts it means start in five
>> > seconds
>> > once the simulation starts.  Simulator::Stop (Seconds (5.)) means stop
>> > the
>> > simulation in five seconds (relative).  If you do this before the
>> > simulation
>> > starts it does what StopAt does now.  Etc., etc.
>>
>>
>> I suspect that a corollary of this proposal is to remove every function
>> using the At postfix (including Simulator::StopAt) and replace them with
>> a no-postfix function, right ? If so, that would be fine with me.
>>
>>
>> > It's hard to get too excited about this, though.
>>
>>
>> Indeed. But if someone wants to cook a patch along the lines of what you
>> outlined, I would be fine with it.
>
>
> I volunteer to prepare the patch.
>
> For now added a bug report:
> http://www.nsnam.org/bugzilla/show_bug.cgi?id=191
>

Committed the change.

Since Application::Start/Stop have changed in a subtle way, that is not
detected by either compile time error or run time assertion, I would advise
a warning such as this to be put in the release notes of next release:

Warning: among API changes in this release, Application::Start and
Application::Stop now interprets the time argument differently.  Now the
time is assumed to be a relative to the current simulation time, in the same
way that Simulator::Schedule behaves.  Any code that calls these APIs in the
middle of the simulation will need to be adapted.  Calls done before the
start of the simulation do not need to be changed.

Although it is easily detected by a compilation error, we might as well make
the migration easier with an addition notice like:

The API of Simulator::StopAt (time) has also changed.  Now it is called
Simulator::Stop (time), and takes a relative time, instead of absolute.

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list