Hi all,
i tried wrapping the ::struct::queue datastructure from Tcllib with a simple XOTcl wrapper, but I'm unsure if there is a better way to setup the instforwarder, it looks too complex to be really the best solution.
package require XOTcl namespace import ::xotcl::* package require struct::queue Class Queue Queue instproc init {args} { next ::struct::queue [self]::queue } Queue instforward clear eval {[self]::queue} clear Queue instforward get eval {[self]::queue} get Queue instforward peek eval {[self]::queue} peek Queue instforward put eval {[self]::queue} put Queue instforward unget eval {[self]::queue} unget Queue instforward size eval {[self]::queue} size Queue instproc destroy {args} { queue destroy next }
Any hints on how to do this in a nicer way?
Michael
For now, the best coming up my mind is:
Class Queue -parameter {{queue [self]::queue}} Queue instproc init {} { ::struct::queue [my queue] } foreach cmd {clear get peek put unget size} { Queue instforward $cmd {%my queue} %proc } Queue instproc destroy {} { [self]::queue destroy next }
or you can try this road:
Class Queue Queue instproc init {} { set queue [self]::queue ::struct::queue $queue my forward clear $queue %proc my forward get $queue %proc my forward put $queue %proc my forward peek $queue %proc my forward unget $queue %proc my forward size $queue %proc } Queue instproc destroy {} { [self]::queue destroy next }
guess, we have currently no shortcut to address a child of the current instance. suggestions for making things nicer are always welcome...
-gustaf