47 return _totalElements;
62 return _totalMessages;
67 _pendingElements += numElements;
72 return this->
getBuffer(_dtype, numElements);
82 _readBeforeWritePort = port;
85 template <
typename ValueType>
88 Pothos::OutputPort::_postMessage(
Pothos::Object(std::forward<ValueType>(message)));
91 template <
typename T,
typename... Args>
94 Pothos::OutputPort::_postMessage(Pothos::Object::emplace<T>(std::forward<Args>(args)...));
99 this->bufferManagerPop(numElements*this->
dtype().size());
103 template <
typename ValueType>
106 auto &queue = _postedBuffers;
107 if (queue.full()) queue.set_capacity(queue.size()*2);
108 auto &r = queue.emplace_back(std::forward<ValueType>(
buffer));
111 if (not r.dtype) r.dtype = this->
dtype();
113 _totalElements += r.elements();
118 template <
typename... ValueType>
121 _postedLabels.emplace_back(std::forward<ValueType>(label)...);
122 _postedLabels.back().adjust(this->
dtype().size(), 1);
130 if (numElements > _reserveElements) _workEvents++;
132 _reserveElements = numElements;
135 inline bool Pothos::OutputPort::bufferManagerEmpty(
void)
137 std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
138 return not _bufferManager or _bufferManager->empty();
143 std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
147 inline void Pothos::OutputPort::bufferManagerPop(
const size_t numBytes)
149 std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
150 return _bufferManager->pop(numBytes);
153 inline bool Pothos::OutputPort::tokenManagerEmpty(
void)
155 std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
156 return not _tokenManager or _tokenManager->empty();
161 std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
163 auto tok = _tokenManager->front();
164 _tokenManager->pop(0);
168 inline void Pothos::OutputPort::tokenManagerPop(
const size_t numBytes)
170 std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
171 return _tokenManager->pop(numBytes);
void postLabel(ValueType &&... label)
Definition: OutputPortImpl.hpp:119
int index(void) const
Definition: OutputPortImpl.hpp:15
void popElements(const size_t numElements)
Definition: OutputPortImpl.hpp:97
unsigned long long totalElements(void) const
Definition: OutputPortImpl.hpp:45
const std::string & domain(void) const
Get the domain information for this port.
Definition: OutputPortImpl.hpp:30
const BufferChunk & buffer(void) const
Definition: OutputPortImpl.hpp:35
unsigned long long totalLabels(void) const
Definition: OutputPortImpl.hpp:55
unsigned long long totalMessages(void) const
Definition: OutputPortImpl.hpp:60
const DType & dtype(void) const
Get the data type information for this port.
Definition: OutputPortImpl.hpp:25
Definition: Object.hpp:47
const std::string & name(void) const
Get the string name identifier for this port.
Definition: OutputPortImpl.hpp:20
void produce(const size_t numElements)
Definition: OutputPortImpl.hpp:65
bool isSignal(void) const
Definition: OutputPortImpl.hpp:75
void postBuffer(ValueType &&buffer)
Definition: OutputPortImpl.hpp:104
unsigned long long totalBuffers(void) const
Definition: OutputPortImpl.hpp:50
BufferChunk getBuffer(const size_t numElements)
Definition: OutputPortImpl.hpp:70
void setReserve(const size_t numElements)
Definition: OutputPortImpl.hpp:127
size_t elements(void) const
Definition: OutputPortImpl.hpp:40
Definition: BufferChunk.hpp:30
void setReadBeforeWrite(InputPort *port)
Definition: OutputPortImpl.hpp:80
void postMessage(ValueType &&message)
Definition: OutputPortImpl.hpp:86
void emplaceMessage(Args &&... args)
Definition: OutputPortImpl.hpp:92