# linda::TupleSpace Class Reference

A class representing a TupleSpace. More...

List of all members.

## Public Member Functions

| TupleSpace ()
| The TupleSpace constructor.
| ~TupleSpace ()
| The TupleSpace destructor.
void | _out (Tuple t)
| Output a tuple to the tuplespace.
Tuple | _in (Template t)
| Destructively read a tuple from the tuplespace.
Tuple | _rd (Template t)
| Non-destructively read a tuple from the tuplespace.
Tuple | _inp (Template t)
| Destructively read a tuple from the tuplespace.
Tuple | _rdp (Template t)
| Non-destructively read a tuple from the tuplespace.
int | collect (TupleSpace dest, Template t)
| Move all tuples matching the template to another tuplespace.
int | copy_collect (TupleSpace dest, Template t)
| Copy all tuples matching the template to another tuplespace.

## Detailed Description

A class representing a TupleSpace.

Creating an instance of this class creates a new tuplespace in the linda network.

## Constructor & Destructor Documentation

linda::TupleSpace::TupleSpace | ( |  | ) |

| The TupleSpace constructor. Creates a new tuplespace, to give other processes access to this tuplespace output the reference in a tuple.

linda::TupleSpace::~TupleSpace | ( |  | ) |

| The TupleSpace destructor. Deletes this reference to the tuplespace.

## Member Function Documentation

Tuple linda::TupleSpace::_in | ( | Template | t | ) |

Destructively read a tuple from the tuplespace.

Parameters:

  | t | A template which is matched against the tuples in the tuplespace.

Returns:
  The matching tuple.

This function call blocks until a tuple matching the template is placed in the tuplespace

     t = ts._in((1, 2, 3))
     t = ts._in((int, 2, 3))
     t = ts._in((int, int, 3))
     t = ts._in((int, int, int))

The template should be a tuple containing either actual parameters, or formals. An actual paramater is a real value like 1, "abc" or 1.0. A formal parameter is a type which matched any value of that type. For example int will match 1, 2, 3 etc. linda.TupleSpace will match any tuplespace reference.

Tuple linda::TupleSpace::_inp | ( | Template | t | ) |

Destructively read a tuple from the tuplespace.

Parameters:

  | t | A template which is matched against the tuples in the tuplespace.

Returns:
  The matching tuple or None if a deadlock is detected.

This function call blocks until a tuple matching the template is placed in the tuplespace or a deadlock situation is detected as described in the paper "A Principled Semantics for inp" by Jacob and Wood [2000]. If a deadlock is detected this function returns None.

     t = ts._inp((int, int, int))

See linda::TupleSpace::_in for details on the format of the template

void linda::TupleSpace::_out | ( | Tuple | t | ) |

Output a tuple to the tuplespace.

Parameters:

  | t | The Tuple to be outputted.

     ts._out((1, 2, 3))

Attention:
  Only ints, floats, booleans, strings, tuples and tuplespace references may be part of the tuple. For performance reasons this is not checked and may cause a strange run-time error if not followed.

Tuple linda::TupleSpace::_rd | ( | Template | t | ) |

Non-destructively read a tuple from the tuplespace.

Parameters:

  | t | A template which is matched against the tuples in the tuplespace.

Returns:
  The matching tuple.

This function call blocks until a tuple matching the template is placed in the tuplespace

     t = ts._rd((int, int, int))

See linda::TupleSpace::_in for details on the format of the template

Tuple linda::TupleSpace::_rdp | ( | Template | t | ) |

Non-destructively read a tuple from the tuplespace.

Parameters:

  | t | A template which is matched against the tuples in the tuplespace

Returns:
  The matching tuple or None if a deadlock is detected

This function call blocks until a tuple matching the template is placed in the tuplespace or a deadlock situation is detected as described in the paper "A Principled Semantics for inp" by Jacob and Wood [2000]. If a deadlock is detected this function returns None.

     t = ts._rdp((int, int, int))

See linda::TupleSpace::_in for details on the format of the template

int linda::TupleSpace::collect | ( | TupleSpace | dest,
|  | Template | t
| ) |

Move all tuples matching the template to another tuplespace.

Parameters:

  | dest | The tuplespace to which the tuples are moved
  | t | A template which is matched against the tuples in the tuplespace

Returns:
  The number of tuples moved.

     count = ts1.collect(ts2, (int, int, int))

See linda::TupleSpace::_in for details on the format of the template

int linda::TupleSpace::copy_collect | ( | TupleSpace | dest,
|  | Template | t
| ) |

Copy all tuples matching the template to another tuplespace.

Parameters:

  | dest | The tuplespace to which the tuples are moved
  | t | A template which is matched against the tuples in the tuplespace

Returns:
  The number of tuples copied.

     count = ts1.copy_collect(ts2, (int, int, int))

See linda::TupleSpace::_in for details on the format of the template

The documentation for this class was generated from the following file:

- linda.c