FreeNOS
Public Types | Public Member Functions | Protected Attributes
Channel Class Reference

Unidirectional point-to-point messaging channel. More...

#include <Channel.h>

Inheritance diagram for Channel:
MemoryChannel

Public Types

enum  Result {
  Success, InvalidArgument, InvalidMode, InvalidSize,
  IOError, ChannelFull, NotFound, NotSupported
}
 Result codes. More...
 
enum  Mode { Producer, Consumer }
 Channel modes. More...
 

Public Member Functions

 Channel (const Mode mode, const Size messageSize)
 Constructor. More...
 
virtual ~Channel ()
 Destructor. More...
 
const Size getMessageSize () const
 Get message size. More...
 
virtual Result read (void *buffer)
 Read a message. More...
 
virtual Result write (const void *buffer)
 Write a message. More...
 
virtual Result flush ()
 Flush message buffers. More...
 

Protected Attributes

const Mode m_mode
 Channel mode. More...
 
const Size m_messageSize
 Message size. More...
 

Detailed Description

Unidirectional point-to-point messaging channel.

Definition at line 34 of file Channel.h.

Member Enumeration Documentation

◆ Mode

Channel modes.

Enumerator
Producer 
Consumer 

Definition at line 56 of file Channel.h.

◆ Result

Result codes.

Enumerator
Success 
InvalidArgument 
InvalidMode 
InvalidSize 
IOError 
ChannelFull 
NotFound 
NotSupported 

Definition at line 41 of file Channel.h.

Constructor & Destructor Documentation

◆ Channel()

Channel::Channel ( const Mode  mode,
const Size  messageSize 
)

Constructor.

Parameters
modeChannel mode is either a producer or consumer
messageSizeSize of each individual message in bytes

Definition at line 20 of file Channel.cpp.

◆ ~Channel()

Channel::~Channel ( )
virtual

Destructor.

Definition at line 26 of file Channel.cpp.

Member Function Documentation

◆ flush()

Channel::Result Channel::flush ( )
virtual

Flush message buffers.

Ensures that all messages are written through caches.

Returns
Result code.

Reimplemented in MemoryChannel.

Definition at line 45 of file Channel.cpp.

References NotSupported.

◆ getMessageSize()

const Size Channel::getMessageSize ( ) const

Get message size.

Returns
Message size

Definition at line 30 of file Channel.cpp.

References m_messageSize.

Referenced by ChannelClient::sendRequest().

◆ read()

Channel::Result Channel::read ( void *  buffer)
virtual

Read a message.

Parameters
bufferOutput buffer for the message.
Returns
Result code.

Reimplemented in MemoryChannel.

Definition at line 35 of file Channel.cpp.

References NotSupported.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::readChannels(), and ChannelClient::syncReceiveFrom().

◆ write()

Channel::Result Channel::write ( const void *  buffer)
virtual

Write a message.

Parameters
bufferInput buffer for the message.
Returns
Result code.

Reimplemented in MemoryChannel.

Definition at line 40 of file Channel.cpp.

References NotSupported.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::readChannels(), ChannelClient::sendRequest(), FileSystemServer::sendResponse(), and ChannelClient::syncSendTo().

Field Documentation

◆ m_messageSize

const Size Channel::m_messageSize
protected

Message size.

Definition at line 117 of file Channel.h.

Referenced by getMessageSize(), MemoryChannel::read(), and MemoryChannel::write().

◆ m_mode

const Mode Channel::m_mode
protected

Channel mode.

Definition at line 114 of file Channel.h.

Referenced by MemoryChannel::flush(), MemoryChannel::reset(), and MemoryChannel::setPhysical().


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