reSIProcate/stack  9694
Public Member Functions | Private Attributes
TestConnection Class Reference
Inheritance diagram for TestConnection:
Inheritance graph
[legend]
Collaboration diagram for TestConnection:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestConnection (Transport *transport, const Tuple &who, const Data &bytes)
bool read (unsigned int minChunkSize, unsigned int maxChunkSize)

Private Attributes

Data mTestStream
unsigned int mStreamPos

Detailed Description

Definition at line 58 of file testConnectionBase.cxx.


Constructor & Destructor Documentation

TestConnection::TestConnection ( Transport transport,
const Tuple who,
const Data bytes 
) [inline]

Definition at line 61 of file testConnectionBase.cxx.

                                                                               :
         ConnectionBase(transport,who),
         mTestStream(bytes),
         mStreamPos(0)
      {}

Member Function Documentation

bool TestConnection::read ( unsigned int  minChunkSize,
unsigned int  maxChunkSize 
) [inline]

Definition at line 67 of file testConnectionBase.cxx.

References resip::Random::getRandom(), resip::resipMax(), and resip::resipMin().

Referenced by main().

      {
         unsigned int chunk = Random::getRandom() % maxChunkSize;
         chunk = resipMax(chunk, minChunkSize);
         chunk = resipMin(chunk, maxChunkSize);
                 unsigned int chunkPos = mTestStream.size() - mStreamPos;
         chunk = resipMin(chunk, chunkPos);
         assert(chunk > 0);
         std::pair<char*, size_t> writePair = getWriteBuffer();
         memcpy(writePair.first, mTestStream.data() + mStreamPos, chunk);
         mStreamPos += chunk;
         assert(mStreamPos <= mTestStream.size());

         preparseNewBytes(chunk);
         return mStreamPos != mTestStream.size();
      }

Here is the call graph for this function:


Member Data Documentation

unsigned int TestConnection::mStreamPos [private]

Definition at line 86 of file testConnectionBase.cxx.

Definition at line 85 of file testConnectionBase.cxx.


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