Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Threads Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTPCValBufferBaseGuarded<Type,GuardDecorator>

Module:  Threads   Package:  Interthread Communication


RWTPCValBufferBaseGuarded<Type,GuardDecorator> (virtual) RWTPCValBufferBaseDecorated<Type,GuardDecorator>

Local Index

Members

Header File

#include <rw/itc/RWTPCValBufferBaseGuarded.h> 

Description

RWTPCValBufferBaseGuarded<Type,GuardDecorator> is the base class for the family of classes that provide buffered producer-consumer synchronization semantics for exchanging guarded values between cooperating threads.

In the producer-consumer synchronization model, reader threads (consumers) are blocked while a buffer is empty, and writer threads (producers) are blocked while a buffer is full. A buffer is considered full when the number of unread entries equals or exceeds some user-specified maximum capacity.

The write operations provided by this class and its subclasses bind additional data items to each value prior to storing that value in an internal buffer. One of these additional data items, or decorations, is a guard functor that is used during read operations to determine whether the associated value is currently eligible for retrieval from the buffer. The template parameter GuardDecorator identifies the class that is used to encapsulate both the value, guard function, and any other decorations as a single object for storage in the internal buffer. The decorator classes used by subclasses to instantiate this class are intended for the module's internal use, and are not documented as part of the public interface.

Public Destructor

virtual
~RWTPCValBufferBaseGuarded();

Inherited Functions

The following superclass functions have been redeclared or redefined to allow them to be overloaded within this class:

These functions provide the same capabilities and behavior as their counter-parts in this class, except that these functions attach an empty guard functor instance to each value.

The superclass functions that are used for peeking or reading a buffer behave differently when called on instances of this class. These functions provide nearly the same capabilities and behavior as when used in their superclasses, with the exception that they now test the guard functor instance associated with each buffered value to determine whether or not that value is eligible for reading.

The detailed behavioral differences are described below.

Type   peek();
Type   read();
RWWaitStatus peek(Type& value,
                  unsigned long milliseconds);
RWWaitStatus read(Type& value,
                  unsigned long milliseconds);
bool    tryPeek(Type& value);
bool    tryRead(Type& value);

Public Member Functions

bool 
tryWrite(const Type& value, 
const RWTFunctorR0<bool>& guard);
void 
write(const Type& value, const RWTFunctorR0<bool>& guard);
RWWaitStatus
write(const Type& value,
      const RWTFunctorR0<bool>& guard,
      unsigned long milliseconds);

See Also

RWTPCValBufferBaseDecorated<Type,Decorator>, RWTPCValQueueGuarded<Type>, RWTPCValStackGuarded<Type>, RWTPCValBufferBaseGuardedPrioritized<Type,GuardAndPriorityDecorator>



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.