void activate(void) { if (_path.empty()) throw Pothos::FileException("BinaryFileSource", "empty file path"); _fd = open(_path.c_str(), O_RDONLY | O_BINARY); if (_fd < 0) { poco_error_f4(Poco::Logger::get("BinaryFileSource"), "open(%s) returned %d -- %s(%d)", _path, _fd, std::string(strerror(errno)), errno); } }
void Pothos::InputPort::bufferAccumulatorPushNoLock(const BufferChunk &buffer_) { auto buffer = buffer_; if (not buffer.dtype or not this->dtype() or //unspecified (this->dtype().size() == buffer.dtype.size())) //size match { //unspecified buffer dtype? copy it from the port if (not buffer.dtype) buffer.dtype = this->dtype(); _bufferAccumulator.push(buffer); _totalBuffers++; } else { poco_error_f4(Poco::Logger::get("Pothos.Block.inputBuffer"), "%s[%s] dropped '%s', expected '%s'", _actor->block->getName(), this->alias(), buffer.dtype.toString(), this->dtype().toString()); } }
void Pothos::InputPort::bufferAccumulatorPop(const size_t numBytes) { std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock); if (numBytes > _bufferAccumulator.getTotalBytesAvailable()) { poco_error_f4(Poco::Logger::get("Pothos.Block.consume"), "%s[%s] overconsumed %z bytes, %z available", _actor->block->getName(), this->alias(), numBytes, _bufferAccumulator.getTotalBytesAvailable()); return; } _bufferAccumulator.pop(numBytes); //adjust enqueued inline messages for new offset for (size_t i = 0; i < _inputInlineMessages.size(); i++) { _inputInlineMessages[i].index -= numBytes; } _workEvents++; }