Pothos  0.1.1
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
OutputPort.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
13 #include <Pothos/Object/Object.hpp>
17 #include <string>
18 
19 namespace Pothos {
20 
21 class OutputPortImpl;
22 class WorkerActor;
23 class InputPort;
24 
29 {
30 public:
31 
33  ~OutputPort(void);
34 
40  int index(void) const;
41 
43  const std::string &name(void) const;
44 
46  const DType &dtype(void) const;
47 
49  const std::string &domain(void) const;
50 
55  const BufferChunk &buffer(void) const;
56 
61  size_t elements(void) const;
62 
68  unsigned long long totalElements(void) const;
69 
75  unsigned long long totalMessages(void) const;
76 
83  void produce(const size_t numElements);
84 
94  void popBuffer(const size_t numBytes);
95 
100  void postLabel(const Label &label);
101 
106  template <typename ValueType>
107  void postMessage(ValueType &&message);
108 
118  void postBuffer(const BufferChunk &buffer);
119 
123  bool isSignal(void) const;
124 
143  void setReadBeforeWrite(InputPort *port);
144 
145 private:
146  OutputPortImpl *_impl;
147  int _index;
148  std::string _name;
149  DType _dtype;
150  std::string _domain;
151  BufferChunk _buffer;
152  size_t _elements;
153  unsigned long long _totalElements;
154  unsigned long long _totalMessages;
155  size_t _pendingElements;
156  OutputPort(OutputPortImpl *);
157  OutputPort(const OutputPort &){} // non construction-copyable
158  OutputPort &operator=(const OutputPort &){return *this;} // non copyable
159  friend class WorkerActor;
160  void _postMessage(const Object &message);
161 };
162 
163 } //namespace Pothos
164 
165 inline int Pothos::OutputPort::index(void) const
166 {
167  return _index;
168 }
169 
170 inline const std::string &Pothos::OutputPort::name(void) const
171 {
172  return _name;
173 }
174 
175 inline const Pothos::DType &Pothos::OutputPort::dtype(void) const
176 {
177  return _dtype;
178 }
179 
180 inline const std::string &Pothos::OutputPort::domain(void) const
181 {
182  return _domain;
183 }
184 
186 {
187  return _buffer;
188 }
189 
190 inline size_t Pothos::OutputPort::elements(void) const
191 {
192  return _elements;
193 }
194 
195 inline unsigned long long Pothos::OutputPort::totalElements(void) const
196 {
197  return _totalElements;
198 }
199 
200 inline unsigned long long Pothos::OutputPort::totalMessages(void) const
201 {
202  return _totalMessages;
203 }
204 
205 inline void Pothos::OutputPort::produce(const size_t numElements)
206 {
207  _pendingElements += numElements;
208 }
209 
210 template <typename ValueType>
211 void Pothos::OutputPort::postMessage(ValueType &&message)
212 {
213  Pothos::OutputPort::_postMessage(Pothos::Object(std::forward<ValueType>(message)));
214 }
Definition: Label.hpp:23
size_t elements(void) const
Definition: OutputPort.hpp:190
const std::string & name(void) const
Get the string name identifier for this port.
Definition: OutputPort.hpp:170
#define POTHOS_API
Definition: Config.hpp:41
Definition: OutputPort.hpp:28
unsigned long long totalElements(void) const
Definition: OutputPort.hpp:195
const DType & dtype(void) const
Get the data type information for this port.
Definition: OutputPort.hpp:175
Definition: Object.hpp:55
Definition: InputPort.hpp:27
void produce(const size_t numElements)
Definition: OutputPort.hpp:205
const BufferChunk & buffer(void) const
Definition: OutputPort.hpp:185
const std::string & domain(void) const
Get the domain information for this port.
Definition: OutputPort.hpp:180
int index(void) const
Definition: OutputPort.hpp:165
Definition: BufferChunk.hpp:26
Definition: DType.hpp:38
unsigned long long totalMessages(void) const
Definition: OutputPort.hpp:200
void postMessage(ValueType &&message)
Definition: OutputPort.hpp:211