adapter


When a binary stream ( os_bstream ) or text stream ( os_tstream ) is constructed, it is associated with a particular I/O device via an intermediate device adapter object called an os_adapter . When an item is streamed, it is sent to the I/O device via the adapter. This technique enables the streaming mechanisms to be fully decoupled from details of any particular I/O device.

Recursion Software provides device adapters for a variety of I/O objects.

For additional information, refer to the catalog entry for os_device .

For IOStream based objects, use the global function os_adapter_for() to create the appropriate adapter.

Library

IO<ToolKit>

Declaration

#include <ospace/io/adapter.h>

class os_adapter

Interface

Constructor
os_adapter()
Constructs an adapter not associated with any device.
Constructor
os_adapter( os_device* device )
Constructs an adapter attached to device .
Constructor
os_adapter( const os_adapter& other )
Constructs an adapter attached to the same device as other .
Destructor
~os_adapter()
Detaches this adapter from its associated device and destroys the device if it is not in use by another adapter.
=
os_adapter& operator=( const os_adapter& other )
Attaches this adapter to the device associated with other . If the device previously associated with this device is not in use by another adapter, destroys it.
->
os_device* operator->() const
Returns a pointer to the device associated with this adapter or returns 0 if no device is available.
device
os_device* device() const
Returns a pointer to the device associated with this adapter or returns 0 if no device is available.

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.