Changeset 29:54c2d451f8a0 in xplcommon


Ignore:
Timestamp:
01/02/13 11:37:15 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented a blocking stream and a corresponding trst program

Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • src/xplcommon/Buffer.h

    r5 r29  
    9696
    9797    /**
     98     * Get whether the buffer is empty or not.
     99     */
     100    bool isEmpty() const;
     101
     102    /**
    98103     * Get the available capacity in the buffer.
    99104     */
     
    172177{
    173178    return length;
     179}
     180
     181//------------------------------------------------------------------------------
     182
     183inline bool Buffer::isEmpty() const
     184{
     185    return length==0;
    174186}
    175187
  • src/xplcommon/BufferedStream.h

    r21 r29  
    9393//------------------------------------------------------------------------------
    9494
    95 // #include "win32/BufferedStream.h"
     95#include "win32/BufferedStream.h"
    9696
    97 // namespace xplcommon { typedef win32::BufferedStream BufferedStream; }
     97namespace xplcommon { typedef win32::BufferedStream BufferedStream; }
    9898
    9999//------------------------------------------------------------------------------
  • src/xplcommon/Makefile.am

    r27 r29  
    1010
    1111libxplcommon_la_SOURCES= \
     12        PseudoRandom.cc         \
    1213        Buffer.cc               \
    13         PseudoRandom.cc
     14        BlockingStream.cc
    1415
    1516if TARGET_API_POSIX
     
    2526        config.h                \
    2627        types.h                 \
     28        PseudoRandom.h          \
    2729        Failable.h              \
    2830        Thread.h                \
     
    3840        LocalConnector.h        \
    3941        LocalClientSocket.h     \
    40         PseudoRandom.h
     42        BlockingStream.h
  • src/xplcommon/posix/ReadingBuffer.cc

    r21 r29  
    6363        stream.events &= ~POLLIN;
    6464        size_t added = addLength(result);
    65         assert(added==result);
    66         assert(getLength()==result);
     65        assert(static_cast<ssize_t>(added)==result);
     66        assert(static_cast<ssize_t>(getLength())==result);
    6767    }
    6868    return result>=0;
  • src/xplcommon/posix/Waiter.cc

    r14 r29  
    4949    {
    5050        Waitable* waitable = i->second;
    51         if (waitable->ready()) return true;
     51        if (waitable->ready()) {
     52            return true;
     53        }
    5254    }
    5355    return false;
  • test/Makefile.am

    r27 r29  
    11INCLUDES=-I$(top_srcdir)/src
    22
    3 noinst_PROGRAMS=testevent testlocsock
     3noinst_PROGRAMS=testevent testlocsock testblkstream
    44if TARGET_API_POSIX
    55noinst_PROGRAMS+=testrandom
     
    2424endif
    2525
     26testblkstream_SOURCES=testblkstream.cc
     27testblkstream_LDADD=../src/xplcommon/libxplcommon.la
     28if TARGET_API_POSIX
     29testblkstream_LDADD+=-lpthread
     30endif
     31if TARGET_API_WIN32
     32testblkstream_LDFLAGS=-static-libgcc -static-libstdc++
     33endif
     34
    2635testrandom_SOURCES=testrandom.cc
    2736testrandom_LDADD=../src/xplcommon/libxplcommon.la
Note: See TracChangeset for help on using the changeset viewer.