Pothos  0.1.1
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
InputPort.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 InputPortImpl;
22 class WorkerActor;
23 
28 {
29 public:
30 
32  ~InputPort(void);
33 
39  int index(void) const;
40 
42  const std::string &name(void) const;
43 
45  const DType &dtype(void) const;
46 
48  const std::string &domain(void) const;
49 
54  const BufferChunk &buffer(void) const;
55 
60  size_t elements(void) const;
61 
67  unsigned long long totalElements(void) const;
68 
74  unsigned long long totalMessages(void) const;
75 
77  bool hasMessage(void) const;
78 
84  const LabelIteratorRange &labels(void) const;
85 
94  void removeLabel(const Label &label);
95 
102  void consume(const size_t numElements);
103 
109  Object popMessage(void);
110 
119  void setReserve(const size_t numElements);
120 
124  bool isSlot(void) const;
125 
133  void pushBuffer(const BufferChunk &buffer);
134 
141  void pushLabel(const Label &label);
142 
147  void pushMessage(const Object &message);
148 
153  void clear(void);
154 
155 private:
156  InputPortImpl *_impl;
157  int _index;
158  std::string _name;
159  DType _dtype;
160  std::string _domain;
161  std::reference_wrapper<const BufferChunk> _buffer;
162  size_t _elements;
163  unsigned long long _totalElements;
164  unsigned long long _totalMessages;
165  LabelIteratorRange _labelIter;
166  size_t _pendingElements;
167  size_t _reserveElements;
168  InputPort(InputPortImpl *);
169  InputPort(const InputPort &):
170  _buffer(BufferChunk::null())
171  {} // non construction-copyable
172  InputPort &operator=(const InputPort &){return *this;} // non copyable
173  friend class WorkerActor;
174 };
175 
176 } //namespace Pothos
177 
178 inline int Pothos::InputPort::index(void) const
179 {
180  return _index;
181 }
182 
183 inline const std::string &Pothos::InputPort::name(void) const
184 {
185  return _name;
186 }
187 
188 inline const Pothos::DType &Pothos::InputPort::dtype(void) const
189 {
190  return _dtype;
191 }
192 
193 inline const std::string &Pothos::InputPort::domain(void) const
194 {
195  return _domain;
196 }
197 
199 {
200  return _buffer;
201 }
202 
203 inline size_t Pothos::InputPort::elements(void) const
204 {
205  return _elements;
206 }
207 
208 inline unsigned long long Pothos::InputPort::totalElements(void) const
209 {
210  return _totalElements;
211 }
212 
213 inline unsigned long long Pothos::InputPort::totalMessages(void) const
214 {
215  return _totalMessages;
216 }
217 
219 {
220  return _labelIter;
221 }
222 
223 inline void Pothos::InputPort::consume(const size_t numElements)
224 {
225  _pendingElements += numElements;
226 }
Definition: Label.hpp:23
Definition: Label.hpp:68
#define POTHOS_API
Definition: Config.hpp:41
int index(void) const
Definition: InputPort.hpp:178
const std::string & name(void) const
Get the string name identifier for this port.
Definition: InputPort.hpp:183
const LabelIteratorRange & labels(void) const
Definition: InputPort.hpp:218
const BufferChunk & buffer(void) const
Definition: InputPort.hpp:198
unsigned long long totalMessages(void) const
Definition: InputPort.hpp:213
Definition: Object.hpp:55
Definition: InputPort.hpp:27
const std::string & domain(void) const
Get the domain information for this port.
Definition: InputPort.hpp:193
size_t elements(void) const
Definition: InputPort.hpp:203
unsigned long long totalElements(void) const
Definition: InputPort.hpp:208
const DType & dtype(void) const
Get the data type information for this port.
Definition: InputPort.hpp:188
Definition: BufferChunk.hpp:26
void consume(const size_t numElements)
Definition: InputPort.hpp:223
Definition: DType.hpp:38
static const BufferChunk & null(void)
Get a const reference to a null/empty BufferChunk.