Changeset 10:9cf218bd97ba in xplcommon


Ignore:
Timestamp:
12/29/12 09:02:58 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added default implementations of read and write

Location:
src/xplcommon/posix
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/xplcommon/posix/BufferedWaitable.cc

    r6 r10  
    3535#include "WritingBuffer.h"
    3636
     37#include <unistd.h>
    3738#include <poll.h>
    3839
     
    6566//------------------------------------------------------------------------------
    6667
     68ssize_t BufferedWaitable::read(void* dest, size_t length)
     69{
     70    return ::read(fd, dest, length);
     71}
     72
     73//------------------------------------------------------------------------------
     74
     75ssize_t BufferedWaitable::write(const void* src, size_t length)
     76{
     77    return ::write(fd, src, length);
     78}
     79
     80//------------------------------------------------------------------------------
     81
    6782bool BufferedWaitable::isReady()
    6883{
  • src/xplcommon/posix/BufferedWaitable.h

    r6 r10  
    103103protected:
    104104    /**
    105      * Read using the file descriptor into the given buffer.
     105     * Read using the file descriptor at most the given number of
     106     * bytes into the given buffer.
     107     *
     108     * This default implementation uses the read(2) function for
     109     * reading.
     110     *
     111     * @return the number of bytes read (0 in case of end-of-file or
     112     * when the connection is closed), -1 on error.
    106113     */
    107     virtual ssize_t read(void* dest, size_t length) = 0;
     114    virtual ssize_t read(void* dest, size_t length);
    108115
    109116    /**
    110      * Write using the file descriptor from the given buffer.
     117     * Write using the file descriptor the given number of bytes from
     118     * the given buffer.
     119     *
     120     * This default implementation uses the write(2) function for
     121     * writing.
     122     *
     123     * @return the number of bytes written, or -1 on error.
    111124     */
    112     virtual ssize_t write(const void* src, size_t length) = 0;
     125    virtual ssize_t write(const void* src, size_t length);
    113126
    114127    /**
Note: See TracChangeset for help on using the changeset viewer.