MASA-Core
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Buffer2 Class Reference

Detailed Description

Definition at line 55 of file Buffer2.hpp.

#include <Buffer2.hpp>

List of all members.

Public Member Functions

 Buffer2 (int bufferMax)
virtual ~Buffer2 ()
int readBuffer (cell_t *data, int nmemb)
int writeBuffer (const cell_t *data, int nmemb)
void waitEmptyBuffer ()
void destroy ()
bool isDestroyed ()
int getCapacity ()
 Returns the maximum capacity in bytes of the buffer.
buffer2_statistics_t getStatistics ()
 Returns a struct containing statistics of the buffer.
void setLogFile (string logFile, float interval)
 Defines a logfile to receive the buffer statistics in each interval period.

Private Member Functions

int circularSkip (int len)
int circularLoad (cell_t *dst, int len)
int circularStore (const cell_t *src, int len)
int sizeUsed ()
int sizeAvailable ()
void logThread ()

Static Private Member Functions

static void * staticLogThread (void *arg)

Private Attributes

buffer2_statistics_t stats
float tempBlockingWriteTime
float tempBlockingReadTime
pthread_mutex_t mutex
pthread_cond_t notFullCond
pthread_cond_t notEmptyCond
pthread_cond_t emptyCond
pthread_cond_t loggerCond
bool destroyed
cell_tbuffer
int buffer_size
int buffer_start
int buffer_end
int buffer_max
pthread_t loggerThread
string logFile
bool isLogging
float logInterval

Constructor & Destructor Documentation

Buffer2::Buffer2 ( int  bufferMax)

Definition at line 38 of file Buffer2.cpp.

Buffer2::~Buffer2 ( ) [virtual]

Definition at line 68 of file Buffer2.cpp.


Member Function Documentation

int Buffer2::circularLoad ( cell_t dst,
int  len 
) [private]

Definition at line 105 of file Buffer2.cpp.

int Buffer2::circularSkip ( int  len) [private]

Definition at line 123 of file Buffer2.cpp.

int Buffer2::circularStore ( const cell_t src,
int  len 
) [private]

Definition at line 139 of file Buffer2.cpp.

void Buffer2::destroy ( )

Definition at line 73 of file Buffer2.cpp.

Returns the maximum capacity in bytes of the buffer.

Returns:
The size of the buffer in bytes.

Definition at line 239 of file Buffer2.cpp.

Returns a struct containing statistics of the buffer.

Returns:
statistics of the buffer.

Definition at line 243 of file Buffer2.cpp.

Definition at line 92 of file Buffer2.cpp.

void Buffer2::logThread ( ) [private]

Definition at line 259 of file Buffer2.cpp.

int Buffer2::readBuffer ( cell_t data,
int  nmemb 
)

Definition at line 166 of file Buffer2.cpp.

void Buffer2::setLogFile ( string  logFile,
float  interval 
)

Defines a logfile to receive the buffer statistics in each interval period.

Parameters:
logFilethe filename of the log file.
intervalThe period in seconds to log the statistics.

Definition at line 286 of file Buffer2.cpp.

int Buffer2::sizeAvailable ( ) [private]

Definition at line 154 of file Buffer2.cpp.

int Buffer2::sizeUsed ( ) [private]

Definition at line 158 of file Buffer2.cpp.

void * Buffer2::staticLogThread ( void *  arg) [static, private]

Definition at line 233 of file Buffer2.cpp.

Definition at line 96 of file Buffer2.cpp.

int Buffer2::writeBuffer ( const cell_t data,
int  nmemb 
)

Definition at line 204 of file Buffer2.cpp.


Member Data Documentation

cell_t* Buffer2::buffer [private]

Definition at line 103 of file Buffer2.hpp.

int Buffer2::buffer_end [private]

Definition at line 106 of file Buffer2.hpp.

int Buffer2::buffer_max [private]

Definition at line 107 of file Buffer2.hpp.

int Buffer2::buffer_size [private]

Definition at line 104 of file Buffer2.hpp.

int Buffer2::buffer_start [private]

Definition at line 105 of file Buffer2.hpp.

bool Buffer2::destroyed [private]

Definition at line 101 of file Buffer2.hpp.

pthread_cond_t Buffer2::emptyCond [private]

Definition at line 98 of file Buffer2.hpp.

bool Buffer2::isLogging [private]

Definition at line 111 of file Buffer2.hpp.

string Buffer2::logFile [private]

Definition at line 110 of file Buffer2.hpp.

pthread_cond_t Buffer2::loggerCond [private]

Definition at line 99 of file Buffer2.hpp.

pthread_t Buffer2::loggerThread [private]

Definition at line 109 of file Buffer2.hpp.

float Buffer2::logInterval [private]

Definition at line 112 of file Buffer2.hpp.

pthread_mutex_t Buffer2::mutex [private]

Definition at line 95 of file Buffer2.hpp.

pthread_cond_t Buffer2::notEmptyCond [private]

Definition at line 97 of file Buffer2.hpp.

pthread_cond_t Buffer2::notFullCond [private]

Definition at line 96 of file Buffer2.hpp.

Definition at line 89 of file Buffer2.hpp.

Definition at line 92 of file Buffer2.hpp.

Definition at line 91 of file Buffer2.hpp.


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