Class ::ws::snapshot::Snapshot

::ws::snapshot::Snapshot[i] create ... \
           [ -elements (default " vars procs nx-objects xotcl-objects ") ] \
           [ -namespace (default "") ]

Collect the following types of things in the workspace
Defined in /usr/local/ns/tcl/nsshell/snapshot.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nx::Object[i]
::nx::Class create ::ws::snapshot::Snapshot \
     -superclass ::nx::Object

Methods (to be applied on instances)

  • collect all (scripted, public)

     <instance of ws::snapshot::Snapshot[i]> collect all

    Invoke :collect on each item in :elements and return a dict representation, where :element items are keys and outputs of :collect are values.

    Testcases:
    No testcase defined.
    foreach e ${:elements} { dict set d $e [:collect $e] }
    return $d
  • diff (scripted, public)

     <instance of ws::snapshot::Snapshot[i]> diff

    Compute the difference of the current workspace with the values at snapshot creation time.

    Testcases:
    No testcase defined.
    set current [:collect all]
    foreach e ${:elements} {
            #puts "START $e: [llength [dict get ${:start} $e]]"
            #puts "NOW   $e: [llength [dict get $current $e]]"
            dict set diff $e [:listDiff [dict get $current $e] [dict get ${:start} $e]]
    }
    return $diff
  • get_delta (scripted, public)

     <instance of ws::snapshot::Snapshot[i]> get_delta

    Return a Tcl command which can be evaluated to reconstruct the difference between the start of the snapshot and the current state.

    Testcases:
    No testcase defined.
    set diff [:diff]
    set result ""
    foreach e ${:elements} {
            append result [:save $e [dict get $diff $e]]
    }
    return $result