FreeNOS
Public Types | Public Member Functions | Private Attributes
ChannelRegistry Class Reference

Registration for Channels. More...

#include <ChannelRegistry.h>

Public Types

enum  Result {
  Success, InvalidArgument, InvalidSize, IOError,
  NotFound
}
 Result codes. More...
 

Public Member Functions

 ChannelRegistry ()
 Constructor. More...
 
virtual ~ChannelRegistry ()
 Destructor. More...
 
ChannelgetConsumer (const ProcessID pid)
 Get one consumer. More...
 
ChannelgetProducer (const ProcessID pid)
 Get one producer. More...
 
HashTable< ProcessID, Channel * > & getConsumers ()
 Get all consumers. More...
 
HashTable< ProcessID, Channel * > & getProducers ()
 Get all producers. More...
 
Result registerConsumer (const ProcessID pid, Channel *channel)
 Register consumer channel. More...
 
Result registerProducer (const ProcessID pid, Channel *channel)
 Register producer channel. More...
 
Result unregisterConsumer (const ProcessID pid)
 Unregister consumer channel. More...
 
Result unregisterProducer (const ProcessID pid)
 Unregister producer channel. More...
 

Private Attributes

HashTable< ProcessID, Channel * > m_consumer
 Contains registered consumer channels. More...
 
HashTable< ProcessID, Channel * > m_producer
 Contains registered producer channels. More...
 

Detailed Description

Registration for Channels.

Definition at line 37 of file ChannelRegistry.h.

Member Enumeration Documentation

◆ Result

Result codes.

Enumerator
Success 
InvalidArgument 
InvalidSize 
IOError 
NotFound 

Definition at line 44 of file ChannelRegistry.h.

Constructor & Destructor Documentation

◆ ChannelRegistry()

ChannelRegistry::ChannelRegistry ( )

Constructor.

Definition at line 22 of file ChannelRegistry.cpp.

◆ ~ChannelRegistry()

ChannelRegistry::~ChannelRegistry ( )
virtual

Destructor.

Definition at line 26 of file ChannelRegistry.cpp.

References HashIterator< K, V >::hasCurrent(), m_consumer, and m_producer.

Member Function Documentation

◆ getConsumer()

Channel * ChannelRegistry::getConsumer ( const ProcessID  pid)

Get one consumer.

Parameters
pidProcessID of the channel to get
Returns
Channel pointer if found or ZERO

Definition at line 35 of file ChannelRegistry.cpp.

References HashTable< K, V >::get(), m_consumer, and ZERO.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::accept(), ChannelClient::findConsumer(), and unregisterConsumer().

◆ getConsumers()

HashTable< ProcessID, Channel * > & ChannelRegistry::getConsumers ( )

Get all consumers.

Returns
HashTable with consumer channels

Definition at line 53 of file ChannelRegistry.cpp.

References m_consumer.

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

◆ getProducer()

Channel * ChannelRegistry::getProducer ( const ProcessID  pid)

◆ getProducers()

HashTable< ProcessID, Channel * > & ChannelRegistry::getProducers ( )

Get all producers.

Returns
HashTable with all producer channels

Definition at line 58 of file ChannelRegistry.cpp.

References m_producer.

◆ registerConsumer()

ChannelRegistry::Result ChannelRegistry::registerConsumer ( const ProcessID  pid,
Channel channel 
)

Register consumer channel.

Parameters
pidProcessID of the attached process
channelChannel object
Returns
Result code

Definition at line 63 of file ChannelRegistry.cpp.

References HashTable< K, V >::insert(), m_consumer, and Success.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::accept(), and ChannelClient::connect().

◆ registerProducer()

ChannelRegistry::Result ChannelRegistry::registerProducer ( const ProcessID  pid,
Channel channel 
)

Register producer channel.

Parameters
pidProcessID of the attached process
channelChannel object
Returns
Result code

Definition at line 71 of file ChannelRegistry.cpp.

References HashTable< K, V >::insert(), m_producer, and Success.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::accept(), and ChannelClient::connect().

◆ unregisterConsumer()

ChannelRegistry::Result ChannelRegistry::unregisterConsumer ( const ProcessID  pid)

Unregister consumer channel.

Parameters
pidProcessID of the attached process
Returns
Result code

Definition at line 79 of file ChannelRegistry.cpp.

References getConsumer(), m_consumer, NotFound, HashTable< K, V >::remove(), and Success.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::readKernelEvents().

◆ unregisterProducer()

ChannelRegistry::Result ChannelRegistry::unregisterProducer ( const ProcessID  pid)

Unregister producer channel.

Parameters
pidProcessID of the attached process
Returns
Result code

Definition at line 91 of file ChannelRegistry.cpp.

References getProducer(), m_producer, NotFound, HashTable< K, V >::remove(), and Success.

Referenced by ChannelServer< DatastoreServer, DatastoreMessage >::readKernelEvents().

Field Documentation

◆ m_consumer

HashTable<ProcessID, Channel *> ChannelRegistry::m_consumer
private

Contains registered consumer channels.

Definition at line 138 of file ChannelRegistry.h.

Referenced by getConsumer(), getConsumers(), registerConsumer(), unregisterConsumer(), and ~ChannelRegistry().

◆ m_producer

HashTable<ProcessID, Channel *> ChannelRegistry::m_producer
private

Contains registered producer channels.

Definition at line 141 of file ChannelRegistry.h.

Referenced by getProducer(), getProducers(), registerProducer(), unregisterProducer(), and ~ChannelRegistry().


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