Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
utils::Channel Class Reference

Channel is implemented with a pair of anonymous sockets. More...

#include <channel.hpp>

Public Member Functions

 Channel (const bool closeOnExec=true)
 
 Channel (const int fd)
 
 ~Channel ()
 
 Channel (const Channel &)=delete
 
Channeloperator= (const Channel &)=delete
 
void setLeft ()
 Use the "left" end of the channel Closes the "right" end. More...
 
void setRight ()
 Use the "right" end of the channel Closes the "left" end. More...
 
void shutdown ()
 Gracefully shutdown the used end of the channel. More...
 
template<typename Data >
void write (const Data &data)
 Send the data to the other end of the channel. More...
 
template<typename Data >
Data read ()
 Receive data of a given type (size) More...
 
int getFD ()
 Get an active file descriptor. More...
 
int getLeftFD ()
 Gen the left file descriptor. More...
 
int getRightFD ()
 Gen the right file descriptor. More...
 
void setCloseOnExec (const bool closeOnExec)
 Sets close on exec on an active fd to either true or false. More...
 

Private Member Functions

void closeSocket (int socketIndex)
 

Private Attributes

int mSocketIndex
 
std::array< int, 2 > mSockets
 

Detailed Description

Channel is implemented with a pair of anonymous sockets.

Constructor & Destructor Documentation

utils::Channel::Channel ( const bool  closeOnExec = true)
explicit
utils::Channel::Channel ( const int  fd)
explicit
utils::Channel::~Channel ( )
Initial value:
{
assert(fd >= 0)
utils::Channel::Channel ( const Channel )
delete

Member Function Documentation

void utils::Channel::closeSocket ( int  socketIndex)
private
int utils::Channel::getFD ( )

Get an active file descriptor.

int utils::Channel::getLeftFD ( )

Gen the left file descriptor.

int utils::Channel::getRightFD ( )

Gen the right file descriptor.

Channel& utils::Channel::operator= ( const Channel )
delete
template<typename Data >
Data utils::Channel::read ( )

Receive data of a given type (size)

void utils::Channel::setCloseOnExec ( const bool  closeOnExec)

Sets close on exec on an active fd to either true or false.

void utils::Channel::setLeft ( )

Use the "left" end of the channel Closes the "right" end.

void utils::Channel::setRight ( )

Use the "right" end of the channel Closes the "left" end.

void utils::Channel::shutdown ( )

Gracefully shutdown the used end of the channel.

template<typename Data >
void utils::Channel::write ( const Data &  data)

Send the data to the other end of the channel.

Parameters
datadata to send

Member Data Documentation

int utils::Channel::mSocketIndex
private
std::array<int, 2> utils::Channel::mSockets
private

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