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

Re: New type of queue



I did a similar thing with a new queue:   i did the following .... hope it helps::

ns-compat.tcl:

set queueMap_(newred) NewRED
Queue/NewRED set bytes_ true
Queue/NewRED set queue-in-bytes_ true
Queue/NewRED set thresh_ 5
 etc.... in ns-default.tcl
=======================
 ns-lib
         #XXX yuck
        if { $type == "RED" } {
                $q link [$link_($sid:$did) set link_]
        }
        if { $type == "NewRED" } {
                $q link [$link_($sid:$did) set link_]
        }
==================================
and

static class NewREDClass : public TclClass {
public:
        NewREDClass() : TclClass("Queue/NewRED") {}
        TclObject* create(int, const char*const*) {
                return (new NewREDQueue);
        }
} class_newred;

NewREDQueue::NewREDQueue() : link_(NULL), bcount_(0), de_drop_(NULL),
        tchan_(0), idle_(1)
{
        bind_bool("bytes_", &edp_.bytes);               // boolean: use bytes?
        bind_bool("queue-in-bytes_", &qib_);
etc....

}
=========================





Sara Trabucchi wrote:

> Kannan Varadhan wrote:
>
> > the ns-compat stuff is to maintain backward compatibility
> > with ns-1 scripts.  Since it is likely that no one (including yourself, yes?)
> > has scripts with yoru queue type, you should not have to change ns-compat.tcl.
> >
> > Kannan
>
> Thank you, Kannan.
> Now I don't understand what could be my mistake.
> I' ve implemented this new type of queue, which I' called  RQ. It is defined as a
> child class of REDQueue class. I have no problem whith compiling, but when I run
> my OTcl script for the simulation, the interpreter gives me this message:
>
> invalid command name "Queue/RQ"
>     while executing
> "Queue/RQ create _o31 "
>     invoked from within
> "if [catch "$className create $o $args" msg] {
> if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
> delete $o
> return ""
> }
> global errorInfo
> error "class $ ..."
>     (procedure "new" line 3)
>     invoked from within
> "new Queue/$type"
>     invoked from within
> "set q [new Queue/$type]..."
>     invoked from within
> "if { [string first "ErrorModule" $type] != 0 } {
> set q [new Queue/$type]
>
> } else {
> if { $argsz > 1 } {
> set q [eval new $type ..."
>     (procedure "_o3" line 38)
>     invoked from within
> "$ns simplex-link $n2 $n3 1.5Mb 10ms RQ"
>
> The program exits even  before the class constructor is called. Please, could you
> help me?
> Thanks  a lot
>                            Sara