#include <basetrace.h>
Inheritance diagram for BaseTrace:


Public Member Functions | |
| BaseTrace () | |
| ~BaseTrace () | |
| virtual int | command (int argc, const char *const *argv) |
| virtual void | dump () |
| virtual void | namdump () |
| char * | buffer () |
| char * | nbuffer () |
| Tcl_Channel | channel () |
| void | channel (Tcl_Channel ch) |
| Tcl_Channel | namchannel () |
| void | namchannel (Tcl_Channel namch) |
| void | flush (Tcl_Channel channel) |
| bool | tagged () |
| void | tagged (bool tag) |
Static Public Member Functions | |
| double | round (double x, double precision=PRECISION) |
Protected Attributes | |
| Tcl_Channel | channel_ |
| Tcl_Channel | namChan_ |
| char * | wrk_ |
| char * | nwrk_ |
| bool | tagged_ |
|
|
Definition at line 57 of file basetrace.cc.
|
|
|
Definition at line 64 of file basetrace.cc.
|
|
|
|
Definition at line 54 of file basetrace.h. References channel_.
00054 {channel_ = ch; }
|
|
|
Definition at line 53 of file basetrace.h. References channel_. Referenced by Trace::command(), and DequeTrace::recv().
00053 { return channel_; }
|
|
||||||||||||
|
Definition at line 117 of file basetrace.cc. References channel_, namChan_, and tagged().
00118 {
00119 Tcl& tcl = Tcl::instance();
00120 if (argc == 2) {
00121 if (strcmp(argv[1], "detach") == 0) {
00122 channel_ = 0;
00123 namChan_ = 0;
00124 return (TCL_OK);
00125 }
00126 if (strcmp(argv[1], "flush") == 0) {
00127 if (channel_ != 0)
00128 Tcl_Flush(channel_);
00129 if (namChan_ != 0)
00130 Tcl_Flush(namChan_);
00131 return (TCL_OK);
00132 }
00133 if (strcmp(argv[1], "tagged") == 0) {
00134 tcl.resultf("%d", tagged());
00135 return (TCL_OK);
00136 }
00137 } else if (argc == 3) {
00138 if (strcmp(argv[1], "attach") == 0) {
00139 int mode;
00140 const char* id = argv[2];
00141 channel_ = Tcl_GetChannel(tcl.interp(), (char*)id,
00142 &mode);
00143 if (channel_ == 0) {
00144 tcl.resultf("trace: can't attach %s for writing", id);
00145 return (TCL_ERROR);
00146 }
00147 return (TCL_OK);
00148 }
00149 if (strcmp(argv[1], "namattach") == 0) {
00150 int mode;
00151 const char* id = argv[2];
00152 namChan_ = Tcl_GetChannel(tcl.interp(), (char*)id,
00153 &mode);
00154 if (namChan_ == 0) {
00155 tcl.resultf("trace: can't attach %s for writing", id);
00156 return (TCL_ERROR);
00157 }
00158 return (TCL_OK);
00159 }
00160 if (strcmp(argv[1], "tagged") == 0) {
00161 int tag;
00162 if (Tcl_GetBoolean(tcl.interp(),
00163 (char*)argv[2], &tag) == TCL_OK) {
00164 tagged(tag);
00165 return (TCL_OK);
00166 } else return (TCL_ERROR);
00167 }
00168 }
00169 return (TclObject::command(argc, argv));
00170 }
|
Here is the call graph for this function:

|
|
|
Definition at line 59 of file basetrace.h. Referenced by Trace::command().
00059 { Tcl_Flush(channel); }
|
|
|
Definition at line 57 of file basetrace.h. References namChan_.
00057 {namChan_ = namch; }
|
|
|
Definition at line 56 of file basetrace.h. References namChan_. Referenced by Trace::command(), Trace::format(), SatTrace::format(), CMUTrace::format(), DequeTrace::recv(), and SatDequeTrace::recv().
00056 { return namChan_; }
|
|
|
Definition at line 91 of file basetrace.cc. References namChan_, and nwrk_. Referenced by Trace::annotate(), CMUTrace::nam_format(), DequeTrace::recv(), Trace::recv(), SatDequeTrace::recv(), Trace::recvOnly(), EventTrace::trace(), and Trace::write_nam_trace().
00092 {
00093 int n = 0;
00094
00095 /* Otherwise nwrk_ isn't initialized */
00096 if (namChan_ != 0)
00097 n = strlen(nwrk_);
00098 if ((n > 0) && (namChan_ != 0)) {
00099 /*
00100 * tack on a newline (temporarily) instead
00101 * of doing two writes
00102 */
00103 nwrk_[n] = '\n';
00104 nwrk_[n + 1] = 0;
00105 (void)Tcl_Write(namChan_, nwrk_, n + 1);
00106 //Tcl_Flush(channel_);
00107 nwrk_[n] = 0;
00108 }
00109 }
|
|
|
Definition at line 51 of file basetrace.h. References nwrk_. Referenced by Trace::annotate(), Trace::format(), SatTrace::format(), CMUTrace::nam_format(), DequeTrace::recv(), SatDequeTrace::recv(), TcpAgent::trace_event(), and Trace::write_nam_trace().
00051 {return nwrk_; }
|
|
||||||||||||
|
Definition at line 72 of file basetrace.h. Referenced by Trace::annotate(), HttpApp::command(), SatGeometry::distance(), Trace::format(), SatTrace::format(), HttpApp::log(), SatGeometry::propdelay(), Trace::trace(), and TcpAgent::trace_event().
00072 {
00073 return (double)floor(x*precision + 0.5)/precision;
00074 }
|
|
|
Definition at line 77 of file basetrace.h. References tagged_.
00077 { tagged_ = tag; }
|
|
|
Definition at line 76 of file basetrace.h. References tagged_. Referenced by Trace::annotate(), Trace::command(), command(), Trace::format(), SatTrace::format(), CMUTrace::format_aodv(), CMUTrace::format_arp(), CMUTrace::format_dsr(), CMUTrace::format_imep(), CMUTrace::format_ip(), CMUTrace::format_mac(), CMUTrace::format_rtp(), CMUTrace::format_tcp(), CMUTrace::format_tora(), CMUPriQueue::log_stats(), DequeTrace::recv(), and Trace::trace().
00076 { return tagged_; }
|
|
|
Definition at line 80 of file basetrace.h. |
|
|
Definition at line 81 of file basetrace.h. Referenced by command(), namchannel(), and namdump(). |
|
|
Definition at line 83 of file basetrace.h. Referenced by BaseTrace(), namdump(), nbuffer(), and ~BaseTrace(). |
|
|
Definition at line 84 of file basetrace.h. Referenced by tagged(). |
|
|
Definition at line 82 of file basetrace.h. Referenced by BaseTrace(), buffer(), dump(), and ~BaseTrace(). |
1.3.3