TimeAtofCommand Class Reference

Inheritance diagram for TimeAtofCommand:

TclCommand Collaboration diagram for TimeAtofCommand:

Collaboration graph
[legend]

Detailed Description

Definition at line 195 of file misc.cc.

Public Member Functions

virtual int command (int argc, const char *const *argv)
 TimeAtofCommand ()


Constructor & Destructor Documentation

TimeAtofCommand::TimeAtofCommand  )  [inline]
 

Definition at line 197 of file misc.cc.

00197 : TclCommand("time_atof") { }


Member Function Documentation

virtual int TimeAtofCommand::command int  argc,
const char *const *  argv
[inline, virtual]
 

Definition at line 198 of file misc.cc.

00198                                                           {
00199         if (argc != 2)
00200             return (TCL_ERROR);
00201         char* s = (char*) argv[1];
00202         char wrk[32];
00203         char* cp = wrk;
00204         while (isdigit(*s) || *s == 'e' ||
00205                *s == '+' || *s == '-' || *s == '.')
00206             *cp++ = *s++;
00207         *cp = 0;
00208         double v = atof(wrk);
00209         switch (*s) {
00210         case 'm':
00211             v *= 1e-3;
00212             break;
00213         case 'u':
00214             v *= 1e-6;
00215             break;
00216         case 'n':
00217             v *= 1e-9;
00218             break;
00219         case 'p':
00220             v *= 1e-12;
00221             break;
00222         }
00223         Tcl::instance().resultf("%g", v);
00224         return (TCL_OK);
00225     }


The documentation for this class was generated from the following file:
Generated on Tue Mar 6 17:34:08 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6