Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# ACE_Stream Class Template Reference

This class is the primary abstraction for the ASX framework. It is moduled after System V Stream. More...

`#include <Stream.h>`

Inheritance diagram for ACE_Stream:

[legend]
Collaboration diagram for ACE_Stream:

[legend]
List of all members.

## Public Types
enum | { M_DELETE = 3 }
## Public Methods
| ACE_Stream (void *arg=0, ACE_Module< ACE_SYNCH_USE > *head=0, ACE_Module< ACE_SYNCH_USE > *tail=0)
| Create a Stream consisting of and <tail> as the Stream head and Stream tail, respectively. More...
virtual int | open (void *arg, ACE_Module< ACE_SYNCH_USE > *head=0, ACE_Module< ACE_SYNCH_USE > *tail=0)
| Create a Stream consisting of and <tail> as the Stream head and Stream tail, respectively. More...
virtual int | close (int flags=M_DELETE)
| Close down the stream and release all the resources. More...
virtual | ~ACE_Stream (void)
| Close down the stream and release all the resources. More...
virtual int | push (ACE_Module< ACE_SYNCH_USE > *mod)
| Add a new module <mod> right below the Stream head. More...
virtual int | pop (int flags=M_DELETE)
| Remove the <mod> right below the Stream head and close it down. More...
virtual int | top (ACE_Module< ACE_SYNCH_USE > *&mod)
| Return the top module on the stream (right below the stream head). More...
virtual int | insert (const ACE_TCHAR *prev_name, ACE_Module< ACE_SYNCH_USE > *mod)
| Insert a new module <mod> below the named module <prev_name>. More...
virtual int | replace (const ACE_TCHAR *replace_name, ACE_Module< ACE_SYNCH_USE > *mod, int flags=M_DELETE)
| Replace the named module <replace_name> with a new module <mod>. More...
virtual int | remove (const ACE_TCHAR *mod, int flags=M_DELETE)
| Remove the named module <mod> from the stream. This bypasses the strict LIFO ordering of <push> and <pop>. More...
virtual ACE_Module< ACE_SYNCH_USE > * | head (void)
| Return current stream head. More...
virtual ACE_Module< ACE_SYNCH_USE > * | tail (void)
| Return current stream tail. More...
virtual ACE_Module< ACE_SYNCH_USE > * | find (const ACE_TCHAR *mod)
| Find a particular ACE_Module. More...
virtual int | link (ACE_Stream< ACE_SYNCH_USE > &)
| Create a pipe between two Streams. More...
virtual int | unlink (void)
| Remove a pipe formed between two Streams. More...
virtual int | put (ACE_Message_Block *mb, ACE_Time_Value *timeout=0)
| Send the message <mb> down the stream, starting at the Module below the Stream head. More...
virtual int | get (ACE_Message_Block *&mb, ACE_Time_Value *timeout=0)
| Read the message <mb> that is stored in the stream head. More...
virtual int | control (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, void *args)
| Send control message down the stream. More...
virtual int | wait (void)
| Synchronize with the final close of the stream. More...
virtual void | dump (void) const
| Dump the state of an object. More...
## Public Attributes
| ACE_ALLOC_HOOK_DECLARE
| Declare the dynamic allocation hooks. More...
## Private Methods
int | unlink_i (void)
| Actually perform the unlinking of two Streams (must be called with locks held). More...
int | link_i (ACE_Stream< ACE_SYNCH_USE > &)
| Actually perform the linking of two Streams (must be called with locks held). More...
int | push_module (ACE_Module< ACE_SYNCH_USE > *, ACE_Module< ACE_SYNCH_USE > *=0, ACE_Module< ACE_SYNCH_USE > *=0)
| Must a new module onto the Stream. More...
## Private Attributes
ACE_Module< ACE_SYNCH_USE > * | stream_head_
| Pointer to the head of the stream. More...
ACE_Module< ACE_SYNCH_USE > * | stream_tail_
| Pointer to the tail of the stream. More...
ACE_Stream< ACE_SYNCH_USE > * | linked_us_
| Pointer to an adjoining linked stream. More...
ACE_SYNCH_MUTEX_T | lock_
| Protect the stream against race conditions. More...
ACE_SYNCH_CONDITION_T | final_close_
| Use to tell all threads waiting on the close that we are done. More...
## Friends
class | ACE_Stream_Iterator< ACE_SYNCH_USE >

## Detailed Description

### template<ACE_SYNCH_DECL>
class ACE_Stream<>

This class is the primary abstraction for the ASX framework. It is moduled after System V Stream.

A Stream consists of a stack of <ACE_Modules>, each of which contains two <ACE_Tasks>. Even though the methods in this class are virtual, this class isn't really intended for subclassing unless you know what you are doing. In particular, the <ACE_Stream> destructor calls <close>, which won't be overridden properly unless you call it in a subclass destructor.

## Member Enumeration Documentation

template<ACE_SYNCH_DECL >
anonymous enum

  | Enumeration values:
  M_DELETE | Indicates that <close> deletes the Tasks. Don't change this value without updating the same enum in class ACE_Module...

## Constructor & Destructor Documentation

template<ACE_SYNCH_DECL >
ACE_Stream<>::ACE_Stream | ( | void * | a = 0,
|  | ACE_Module< ACE_SYNCH_USE > * | head = 0,
|  | ACE_Module< ACE_SYNCH_USE > * | tail = 0
| ) |

| Create a Stream consisting of and <tail> as the Stream head and Stream tail, respectively. If these are 0 then the <ACE_Stream_Head> and <ACE_Stream_Tail> are used, respectively. <arg> is the value past in to the <open> methods of the tasks.

template<ACE_SYNCH_DECL >
ACE_Stream<>::~ACE_Stream | ( | void |  | ) | `[virtual]`

| Close down the stream and release all the resources.

## Member Function Documentation

template<ACE_SYNCH_DECL >
int ACE_Stream<>::close | ( | int | flags = M_DELETE | ) | `[virtual]`

| Close down the stream and release all the resources.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::control | ( | ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds | cmd,
|  | void * | a
| ) | `[virtual]`

| Send control message down the stream.

template<ACE_SYNCH_DECL >
void ACE_Stream<>::dump | ( | void |  | ) | const`[virtual]`

| Dump the state of an object.

template<ACE_SYNCH_DECL >
ACE_Module< ACE_SYNCH_USE > * ACE_Stream<>::find | ( | const ACE_TCHAR * | name | ) | `[virtual]`

| Find a particular ACE_Module.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::get | ( | ACE_Message_Block *& | mb,
|  | ACE_Time_Value * | tv = 0
| ) | `[virtual]`

| Read the message <mb> that is stored in the stream head. Wait for upto <timeout> amount of absolute time for the operation to complete (or block forever if <timeout> == 0).

template<ACE_SYNCH_DECL >
ACE_INLINE ACE_Module< ACE_SYNCH_USE > * ACE_Stream<>::head | ( | void |  | ) | `[virtual]`

| Return current stream head.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::insert | ( | const ACE_TCHAR * | prev_name,
|  | ACE_Module< ACE_SYNCH_USE > * | mod
| ) | `[virtual]`

| Insert a new module <mod> below the named module <prev_name>.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::link | ( | ACE_Stream< ACE_SYNCH_USE > & | us | ) | `[virtual]`

| Create a pipe between two Streams.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::link_i | ( | ACE_Stream< ACE_SYNCH_USE > & | us | ) | `[private]`

| Actually perform the linking of two Streams (must be called with locks held).

template<ACE_SYNCH_DECL >
int ACE_Stream<>::open | ( | void * | a,
|  | ACE_Module< ACE_SYNCH_USE > * | head = 0,
|  | ACE_Module< ACE_SYNCH_USE > * | tail = 0
| ) | `[virtual]`

| Create a Stream consisting of and <tail> as the Stream head and Stream tail, respectively. If these are 0 then the <ACE_Stream_Head> and <ACE_Stream_Tail> are used, respectively. <arg> is the value past in to the <open> methods of the tasks.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::pop | ( | int | flags = M_DELETE | ) | `[virtual]`

| Remove the <mod> right below the Stream head and close it down.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::push | ( | ACE_Module< ACE_SYNCH_USE > * | new_top | ) | `[virtual]`

| Add a new module <mod> right below the Stream head.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::push_module | ( | ACE_Module< ACE_SYNCH_USE > * | new_top,
|  | ACE_Module< ACE_SYNCH_USE > * | current_top = 0,
|  | ACE_Module< ACE_SYNCH_USE > * | head = 0
| ) | `[private]`

| Must a new module onto the Stream.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::put | ( | ACE_Message_Block * | mb,
|  | ACE_Time_Value * | tv = 0
| ) | `[virtual]`

| Send the message <mb> down the stream, starting at the Module below the Stream head. Wait for upto <timeout> amount of absolute time for the operation to complete (or block forever if <timeout> == 0).

template<ACE_SYNCH_DECL >
int ACE_Stream<>::remove | ( | const ACE_TCHAR * | name,
|  | int | flags = M_DELETE
| ) | `[virtual]`

| Remove the named module <mod> from the stream. This bypasses the strict LIFO ordering of <push> and <pop>.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::replace | ( | const ACE_TCHAR * | replace_name,
|  | ACE_Module< ACE_SYNCH_USE > * | mod,
|  | int | flags = M_DELETE
| ) | `[virtual]`

| Replace the named module <replace_name> with a new module <mod>.

template<ACE_SYNCH_DECL >
ACE_INLINE ACE_Module< ACE_SYNCH_USE > * ACE_Stream<>::tail | ( | void |  | ) | `[virtual]`

| Return current stream tail.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::top | ( | ACE_Module< ACE_SYNCH_USE > *& | m | ) | `[virtual]`

| Return the top module on the stream (right below the stream head).

template<ACE_SYNCH_DECL >
int ACE_Stream<>::unlink | ( | void |  | ) | `[virtual]`

| Remove a pipe formed between two Streams.

template<ACE_SYNCH_DECL >
int ACE_Stream<>::unlink_i | ( | void |  | ) | `[private]`

| Actually perform the unlinking of two Streams (must be called with locks held).

template<ACE_SYNCH_DECL >
ACE_INLINE int ACE_Stream<>::wait | ( | void |  | ) | `[virtual]`

| Synchronize with the final close of the stream.

## Friends And Related Function Documentation

template<ACE_SYNCH_DECL >
friend class ACE_Stream_Iterator< ACE_SYNCH_USE >`[friend]`

## Member Data Documentation

template<ACE_SYNCH_DECL >
ACE_Stream::ACE_ALLOC_HOOK_DECLARE

| Declare the dynamic allocation hooks.

template<ACE_SYNCH_DECL >
ACE_SYNCH_CONDITION_T ACE_Stream::final_close_`[private]`

| Use to tell all threads waiting on the close that we are done.

template<ACE_SYNCH_DECL >
ACE_Stream<ACE_SYNCH_USE>* ACE_Stream::linked_us_`[private]`

| Pointer to an adjoining linked stream.

template<ACE_SYNCH_DECL >
ACE_SYNCH_MUTEX_T ACE_Stream::lock_`[private]`

| Protect the stream against race conditions.

template<ACE_SYNCH_DECL >
ACE_Module<ACE_SYNCH_USE>* ACE_Stream::stream_head_`[private]`

| Pointer to the head of the stream.

template<ACE_SYNCH_DECL >
ACE_Module<ACE_SYNCH_USE>* ACE_Stream::stream_tail_`[private]`

| Pointer to the tail of the stream.

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

- Stream.h
- Stream.cpp
- Stream.i