3.4.0.0.2 Example configuration of a TclObject

The following example illustrates the configuration of an SRM agent (Agent/SRM/Adaptive../ns-2/srm-adaptive.tcl).
        set srm [new Agent/SRM/Adaptive]
        \$srm set packetSize_ 1024
        \$srm traffic-source \$s0
By convention in ns, the class Agent/SRM/Adaptive is a subclass of Agent/SRM, is a subclass of Agent, is a subclass of TclObject. The corresponding compiled class hierarchy is the ASRMAgent, derived from SRMAgent, derived from Agent, derived from TclObject respectively. The first line of the above example shows how a TclObject is created (or destroyed)Sectionsec:Creation; the next line configures a bound variableSectionsec:VarBinds; and finally, the last line illustrates the interpreted object invoking a C++ method as if they were an instance procedureSectionsec:Commands.



Tom Henderson 2014-12-17