Logo Search packages:      
Sourcecode: r-cran-nws version File versions  Download package

def nwsclient::NetWorkSpace::declare (   self,
  varName,
  mode 
)

Declare a variable in a workspace with the specified mode.

ws.declare(varName, mode)

This method is used to specify a mode other than the default
mode of 'fifo'.  Legal values for the mode are:

    'fifo', 'lifo', 'multi', and 'single'

In the first three modes, multiple value can be stored in
a variable.  If the mode is 'fifo', then values are retrieved
in a "first-in, first-out" fashion.  That is, the first value
stored, will be the first value fetched.  If the mode is 'lifo',
then values are retreived in a "last-in, first-out" fashion,
as in a stack.  If the mode is 'multi', then the order of
retreival is undefined.

The 'single' mode means that only a single value can be
stored in the variable.  Each new store operation will overwrite
the current value of the variable.

If a variable is created using a store operation, then the
mode defaults to 'fifo'.  The mode cannot be changed with
subsequent calls to declare, regardless of whether the variable
was originally created using store or declare.

Arguments:

varName -- Name of the variable to declare.

mode -- Mode of the variable.

Definition at line 601 of file nwsclient.py.

00601                                     :
        """Declare a variable in a workspace with the specified mode.

        ws.declare(varName, mode)

        This method is used to specify a mode other than the default
        mode of 'fifo'.  Legal values for the mode are:

            'fifo', 'lifo', 'multi', and 'single'

        In the first three modes, multiple value can be stored in
        a variable.  If the mode is 'fifo', then values are retrieved
        in a "first-in, first-out" fashion.  That is, the first value
        stored, will be the first value fetched.  If the mode is 'lifo',
        then values are retreived in a "last-in, first-out" fashion,
        as in a stack.  If the mode is 'multi', then the order of
        retreival is undefined.

        The 'single' mode means that only a single value can be
        stored in the variable.  Each new store operation will overwrite
        the current value of the variable.

        If a variable is created using a store operation, then the
        mode defaults to 'fifo'.  The mode cannot be changed with
        subsequent calls to declare, regardless of whether the variable
        was originally created using store or declare.

        Arguments:

        varName -- Name of the variable to declare.

        mode -- Mode of the variable.

        """
        if type(varName) != str:
            raise TypeError, 'variable name must be a string'

        if type(mode) != str:
            raise TypeError, 'mode must be a string'

        if mode not in _modes:
            raise ValueError, 'illegal mode: ' + str(mode)

        op = 'declare var'
        self.send('0004%020d%s%020d%s%020d%s%020d%s' % (len(op), op, len(self.curWs), self.curWs, len(varName), varName, len(mode), mode))

        status = int(self.recv(4))
        if status: raise NwsDeclarationFailedException, 'variable declaration failed'

    def deleteVar(self, varName):


Generated by  Doxygen 1.6.0   Back to index