DUNE: Uniform Navigational Environment  2017.01.0
DUNE::IO::Handle Class Referenceabstract

Public Member Functions

virtual ~Handle (void)
 
size_t write (const uint8_t *data, size_t length)
 
size_t write (const char *data, size_t length)
 
size_t writeString (const char *cstr)
 
size_t read (uint8_t *data, size_t length)
 
size_t read (char *data, size_t length)
 
size_t readString (char *bfr, size_t length)
 
void flush (void)
 
void flushInput (void)
 
void flushOutput (void)
 
NativeHandle getNative (void) const
 

Protected Member Functions

virtual NativeHandle doGetNative (void) const =0
 
virtual size_t doWrite (const uint8_t *data, size_t data_size)=0
 
virtual size_t doRead (uint8_t *data, size_t data_size)=0
 
virtual void doFlushInput (void)
 
virtual void doFlushOutput (void)
 
virtual void doFlush (void)
 

Constructor & Destructor Documentation

virtual DUNE::IO::Handle::~Handle ( void  )
inlinevirtual

Destructor.

Member Function Documentation

virtual void DUNE::IO::Handle::doFlush ( void  )
inlineprotectedvirtual

References doFlushInput(), and doFlushOutput().

Referenced by flush().

virtual void DUNE::IO::Handle::doFlushInput ( void  )
inlineprotectedvirtual

Referenced by doFlush(), and flushInput().

virtual void DUNE::IO::Handle::doFlushOutput ( void  )
inlineprotectedvirtual

Referenced by doFlush(), and flushOutput().

virtual NativeHandle DUNE::IO::Handle::doGetNative ( void  ) const
protectedpure virtual

Referenced by getNative().

virtual size_t DUNE::IO::Handle::doRead ( uint8_t *  data,
size_t  data_size 
)
protectedpure virtual

Referenced by read().

virtual size_t DUNE::IO::Handle::doWrite ( const uint8_t *  data,
size_t  data_size 
)
protectedpure virtual

Referenced by write().

void DUNE::IO::Handle::flush ( void  )
inline

Flush input and output.

References doFlush().

Referenced by DUNE::Hardware::UCTK::Interface::flush(), and DUNE::Hardware::SerialPort::~SerialPort().

void DUNE::IO::Handle::flushInput ( void  )
inline
void DUNE::IO::Handle::flushOutput ( void  )
inline

Flush data buffered but not written.

References doFlushOutput().

NativeHandle DUNE::IO::Handle::getNative ( void  ) const
inline

Retrieve the native I/O handle.

Returns
native I/O handle.

References doGetNative().

Referenced by DUNE::IO::Poll::add(), DUNE::IO::Poll::poll(), and DUNE::IO::Poll::wasTriggered().

size_t DUNE::IO::Handle::read ( uint8_t *  data,
size_t  length 
)
inline

Read binary data from I/O handle.

Parameters
[in]datadata buffer.
[in]lengthnumber of bytes to read.
Returns
number of bytes read.

References doRead().

Referenced by DUNE::Hardware::UCTK::Interface::consume(), Sensors::SW100::Driver::read(), DUNE::Hardware::LUCL::Protocol::read(), read(), and readString().

size_t DUNE::IO::Handle::read ( char *  data,
size_t  length 
)
inline

Read binary data from I/O handle.

Parameters
[in]datadata buffer.
[in]lengthnumber of bytes to read.
Returns
number of bytes read.

References read().

size_t DUNE::IO::Handle::readString ( char *  bfr,
size_t  length 
)
inline

Read C-style string from I/O handle.

Parameters
[in]bfrdata buffer.
[in]lengthcapacity of the data buffer.
Returns
number of bytes read.

References read().

size_t DUNE::IO::Handle::write ( const uint8_t *  data,
size_t  length 
)
inline

Write binary data to I/O handle.

Parameters
[in]datadata buffer.
[in]lengthnumber of bytes to write.
Returns
number of bytes written.

References doWrite().

Referenced by DUNE::Hardware::UCTK::Interface::sendFrame(), DUNE::Hardware::HayesModem::sendRaw(), DUNE::Hardware::BasicModem::sendRaw(), write(), DUNE::Hardware::LUCL::Protocol::write(), DUNE::Network::TCPSocket::writeFile(), and writeString().

size_t DUNE::IO::Handle::write ( const char *  data,
size_t  length 
)
inline

Write binary data to I/O handle.

Parameters
[in]datadata buffer.
[in]lengthnumber of bytes to write.
Returns
number of bytes written.

References write().

size_t DUNE::IO::Handle::writeString ( const char *  cstr)
inline

Write C-style string to I/O handle.

Parameters
[in]cstrC-style string.
Returns
number of bytes written.

References write().

Collaboration diagram for DUNE::IO::Handle:
Collaboration graph