47 return _totalElements;
62 return _totalMessages;
67 _pendingElements += numElements;
77 _readBeforeWritePort = port;
80 template <
typename ValueType>
83 Pothos::OutputPort::_postMessage(
Pothos::Object(std::forward<ValueType>(message)));
86 template <
typename T,
typename... Args>
89 Pothos::OutputPort::_postMessage(Pothos::Object::emplace<T>(std::forward<Args>(args)...));
94 this->bufferManagerPop(numElements*this->
dtype().size());
98 template <
typename ValueType>
101 auto &queue = _postedBuffers;
102 if (queue.full()) queue.set_capacity(queue.size()*2);
103 auto &r = queue.emplace_back(std::forward<ValueType>(
buffer));
106 if (not r.dtype) r.dtype = this->
dtype();
108 _totalElements += r.elements();
113 template <
typename... ValueType>
116 _postedLabels.emplace_back(std::forward<ValueType>(label)...);
117 _postedLabels.back().adjust(this->
dtype().size(), 1);
125 if (numElements > _reserveElements) _workEvents++;
127 _reserveElements = numElements;
130 inline bool Pothos::OutputPort::bufferManagerEmpty(
void)
132 std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
133 return not _bufferManager or _bufferManager->empty();
138 std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
142 inline void Pothos::OutputPort::bufferManagerPop(
const size_t numBytes)
144 std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
145 return _bufferManager->pop(numBytes);
148 inline bool Pothos::OutputPort::tokenManagerEmpty(
void)
150 std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
151 return not _tokenManager or _tokenManager->empty();
156 std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
158 auto tok = _tokenManager->front();
159 _tokenManager->pop(0);
163 inline void Pothos::OutputPort::tokenManagerPop(
const size_t numBytes)
165 std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
166 return _tokenManager->pop(numBytes);
void postLabel(ValueType &&... label)
Definition: OutputPortImpl.hpp:114
int index(void) const
Definition: OutputPortImpl.hpp:15
void popElements(const size_t numElements)
Definition: OutputPortImpl.hpp:92
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:70
void postBuffer(ValueType &&buffer)
Definition: OutputPortImpl.hpp:99
unsigned long long totalBuffers(void) const
Definition: OutputPortImpl.hpp:50
void setReserve(const size_t numElements)
Definition: OutputPortImpl.hpp:122
size_t elements(void) const
Definition: OutputPortImpl.hpp:40
Definition: BufferChunk.hpp:30
void setReadBeforeWrite(InputPort *port)
Definition: OutputPortImpl.hpp:75
void postMessage(ValueType &&message)
Definition: OutputPortImpl.hpp:81
void emplaceMessage(Args &&... args)
Definition: OutputPortImpl.hpp:87