text
stringlengths
0
2.2M
void FlowGraphPortFloatOutput::disconnect(FlowGraphPortFloatInput *port) {
port->disconnect(this);
}
/***************************************************************************/
int32_t FlowGraphPortFloatInput::pullData(int64_t callCount, int32_t numFrames) {
return (mConnected == nullptr)
? std::min(getFramesPerBuffer(), numFrames)
: mConnected->pullData(callCount, numFrames);
}
void FlowGraphPortFloatInput::pullReset() {
if (mConnected != nullptr) mConnected->pullReset();
}
float *FlowGraphPortFloatInput::getBuffer() {
if (mConnected == nullptr) {
return FlowGraphPortFloat::getBuffer(); // loaded using setValue()
} else {
return mConnected->getBuffer();
}
}
int32_t FlowGraphSink::pullData(int32_t numFrames) {
return FlowGraphNode::pullData(numFrames, getLastCallCount() + 1);
}
// bdlb_randomdevice.t.cpp -*-C++-*-
#include <bdlb_randomdevice.h>
// Note the headers are in non-standard order. This was required to silence an
// error from clang 3.4.
//..
// /usr/include/unistd.h:449:12: error: declaration conflicts with target of
// using declaration already in scope
// extern int rename(const char *, const char *);
//..
// This is an acknowledged issue:
// <http://lists.cs.uiuc.edu/pipermail/llvmbugs/2012-May/023328.html>
#include <bslim_testutil.h>
#include <bsls_platform.h>
#include <bsls_stopwatch.h> // for benchmarking only
#if defined(BSLS_PLATFORM_OS_WINDOWS)
#include <windows.h> // 'Sleep'
#else
#include <unistd.h> // 'usleep'
#endif
#include <bsl_cstdio.h>
#include <bsl_iostream.h>
#include <bsl_vector.h> // for usage example
#include <bsl_string.h>
using namespace BloombergLP;
using namespace bsl;
// ============================================================================
// TEST PLAN
// ----------------------------------------------------------------------------
// Overview
// --------
// ----------------------------------------------------------------------------
// CLASS METHODS
// [-1] static int getRandomBytes(unsigned char *buf, size_t numB);
// [ 2] static int getRandomBytesNonBlocking(buf, numB);
// ----------------------------------------------------------------------------
// [ 1] BREATHING TEST
// [-2] PERFORMANCE: 'getRandomBytes'
// [-3] PERFORMANCE: 'getRandomBytesNonBlocking'
// [-4] PERFORMANCE: 'getRandomBytes'
// [-5] PERFORMANCE: 'getRandomBytes'
// [ 3] USAGE EXAMPLE
// ============================================================================
// STANDARD BDE ASSERT TEST FUNCTION
// ----------------------------------------------------------------------------
namespace {
int testStatus = 0;
void aSsErT(bool condition, const char *message, int line)
{
if (condition) {
printf("Error " __FILE__ "(%d): %s (failed)\n", line, message);
if (0 <= testStatus && testStatus <= 100) {
++testStatus;
}
}
}
} // close unnamed namespace
// ============================================================================
// STANDARD BDE TEST DRIVER MACRO ABBREVIATIONS
// ----------------------------------------------------------------------------