This is the interface for object channel plug-ins that define their buffering characteristics.
This enables that logic to be varied by creating channels specifying a particular implementation of this interface. This reduces the number of classes that would otherwise need to be defined. The default channel constructor (with no parameters) uses the ZeroBuffer implementation, which gives the standard CSP semantics -- no buffering and full synchronisation between reading and writing processes. See the static Channel.createOne2One<TT>create</TT> methods of Channel etc.
Note: instances of ChannelDataStore implementations are used by the various channel classes within org.org.jcsp.lang in a thread-safe way. They are not intended for any other purpose. Developers of new ChannelDataStore implementations, therefore, do not need to worry about thread safety (e.g. by making its methods synchronized). Also, developers can assume that the documented pre-conditions for invoking the get and put methods will be met.
Modifiers | Name | Description |
---|---|---|
static int |
EMPTY |
Indicates that the ChannelDataStore is empty -- it can accept only a put. |
static int |
FULL |
Indicates that the ChannelDataStore is full -- it can accept only a get. |
static int |
NONEMPTYFULL |
Indicates that the ChannelDataStore is neither empty nor full -- it can accept either a put or a get call. |
Type | Name and description |
---|---|
Object |
clone() Returns a new (and EMPTY) ChannelDataStore with the same creation parameters as this one. |
void |
endGet() Ends an extended read on the buffer. |
Object |
get() Returns an Object from the ChannelDataStore. |
int |
getState() Returns the current state of the ChannelDataStore. |
void |
put(Object value) Puts a new Object into the ChannelDataStore. |
void |
removeAll() Deletes all items in the buffer, leaving it empty. |
Object |
startGet() Begins an extended read on the buffer, returning the data for the extended read |
Indicates that the ChannelDataStore is empty -- it can accept only a put.
Indicates that the ChannelDataStore is full -- it can accept only a get.
Indicates that the ChannelDataStore is neither empty nor full -- it can accept either a put or a get call.
Returns a new (and EMPTY) ChannelDataStore with the same creation parameters as this one.
Note: Only the size and structure of the ChannelDataStore should be cloned, not any stored data.
Ends an extended read on the buffer. The channels guarantee that this method will be called exactly once after each beginExtRead call. During the period between startGet and endGet, it is possible that put will be called, but not get.
Returns an Object from the ChannelDataStore.
Pre-condition: getState must not currently return EMPTY.
Returns the current state of the ChannelDataStore.
Puts a new Object into the ChannelDataStore.
Pre-condition: getState must not currently return FULL.
value
- the Object to put into the ChannelDataStoreDeletes all items in the buffer, leaving it empty.
Begins an extended read on the buffer, returning the data for the extended read Pre-condition: getState must not currently return EMPTY. The exact behaviour of this method depends on your buffer. When a process performs an extended rendezvous on a buffered channel, it will first call this method, then the endGet method. A FIFO buffer would implement this method as returning the value from the front of the buffer and the next call would remove the value. An overflowing buffer would do the same. However, for an overwriting buffer it is more complex. Refer to the documentation for OverWritingBuffer.startGet and OverWriteOldestBuffer.startGet for details