protocol


An abstract base class for all protocol adapters.

Library

Streaming<ToolKit>

Declaration

#include <ospace/stream/protocol.h>

class os_protocol

Enums

enum os_protocol::type_t
  {
  byte8,
  bool8,
  char8,
  wchar16,
  wchar32,
  int8,
  uint8,
  int16,
  uint16,
  int32,
  uint32,
  int64,
  uint64,
  float32,
  float64,
  float80,
  float96,
  float112,
  float128
  };
  

Interface

Destructor
/* virtual */ ~os_protocol()
Destroys the protocol adapter.
clear
/* virtual */ void clear()
Resets the state of the device adapter for this protocol to good.
device
/* virtual */ const os_adapter& device() const
Returns a constant reference to the device adapter.
device
/* virtual */ void device( const os_adapter& adapter )
Sets the device adapter for this protocol to adapter .
eof
/* virtual */ bool eof() const
Returns true if the device adapter for this protocol has reached end of input.
good
/* virtual */ bool good() const
Returns true if the device adapter for this protocol is in a good state and not at EOF.
ok
/* virtual */ bool ok() const
Returns true if the device adapter for this protocol is in a good state.
read
/* virtual */ bool read( type_t type , void* addr )
Reads the primitive type into the location specified by addr . Returns the number of bytes read.
read_array
/* virtual */ ssize_t read_array( type_t type , void* addr , size_t n )
Reads an array of n primitive type elements into the location specified by addr and returns the number of elements read. With some protocols, this operation can be more efficient than reading each individual element.
reset
/* virtual */ void reset()
Resets the protocol state.
size
/* static */ int size( os_protocol::type_t type ) const
Returns the number of bytes required to store type .
sync
/* virtual */ bool sync()
Flushes all buffered data to the device adapter.
write
/* virtual */ bool write( type_t type , const void* addr )
Writes the primitive type from the location specified by addr . Returns the number of bytes written.
write_array
/* virtual */ ssize_t write_array( type_t type , const void* addr , size_t n )
Writes an array of n primitive type elements from the location specified by addr and returns the number of elements written. With some protocols, this operation can be more efficient than writing each individual element.

Non-Member Functions

<<
os_protocol& operator<<( os_protocol& protocol , bool value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , char value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , double value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , float value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , int value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , long value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , long double value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , long long value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , short value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , signed char value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , unsigned char value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , unsigned int value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , unsigned long value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , unsigned long value )
Encodes and streams value using protocol .
<<
os_protocol& operator<<( os_protocol& protocol , unsigned short value )
Encodes and streams value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , bool& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , char& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , double& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , float& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , int& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , long& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , long double& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , long long& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , short& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , signed char& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , unsigned char& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , unsigned int& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , unsigned long& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , unsigned long long& value )
Reads and decodes value using protocol .
>>
os_protocol& operator>>( os_protocol& protocol , unsigned short& value )
Reads and decodes value using protocol .

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