Pothos  0.4.1-gb758ed46
The Pothos dataflow programming software suite
Topology.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
15 #include <Pothos/Object/Object.hpp>
16 #include <string>
17 #include <memory>
18 #include <iosfwd>
19 
20 namespace Pothos {
21 
31 {
32 public:
33 
38  static std::shared_ptr<Topology> make(void);
39 
146  static std::shared_ptr<Topology> make(const std::string &json);
147 
149  Topology(void);
150 
155  ~Topology(void);
156 
158  void setThreadPool(const ThreadPool &threadPool);
159 
161  const ThreadPool &getThreadPool(void) const;
162 
166  std::vector<PortInfo> inputPortInfo(void);
167 
171  std::vector<PortInfo> outputPortInfo(void);
172 
181  void commit(void);
182 
193  bool waitInactive(const double idleDuration = 0.1, const double timeout = 1.0);
194 
202  template <
203  typename SrcType, typename SrcPortType,
204  typename DstType, typename DstPortType>
205  void connect(
206  SrcType &&src, const SrcPortType &srcPort,
207  DstType &&dst, const DstPortType &dstPort);
208 
216  template <
217  typename SrcType, typename SrcPortType,
218  typename DstType, typename DstPortType>
219  void disconnect(
220  SrcType &&src, const SrcPortType &srcPort,
221  DstType &&dst, const DstPortType &dstPort);
222 
230  void disconnectAll(const bool recursive = false);
231 
233  void _connect(
234  const Object &src, const std::string &srcPort,
235  const Object &dst, const std::string &dstPort);
236 
238  void _disconnect(
239  const Object &src, const std::string &srcPort,
240  const Object &dst, const std::string &dstPort);
241 
248  void registerCallable(const std::string &name, const Callable &call);
249 
277  std::string queryJSONStats(void);
278 
330  std::string dumpJSON(const std::string &request = "{}");
331 
353  std::string toDotMarkup(const std::string &request = "{}");
354 
362  Object opaqueCallMethod(const std::string &name, const Object *inputArgs, const size_t numArgs) const;
363 
364 protected:
375  virtual Object opaqueCallHandler(const std::string &name, const Object *inputArgs, const size_t numArgs);
376 
377 private:
378  Topology(const Topology &){} // non construction-copyable
379  Topology &operator=(const Topology &){return *this;} // non copyable
380 public:
381  struct Impl;
382  std::shared_ptr<Impl> _impl;
383 };
384 
385 } //namespace Pothos
Definition: Connectable.hpp:41
#define POTHOS_API
Definition: Config.hpp:41
Definition: Callable.hpp:30
Definition: ThreadPool.hpp:113
Definition: Testing.hpp:134
Definition: Object.hpp:55
Definition: Topology.hpp:30
std::shared_ptr< Impl > _impl
Definition: Topology.hpp:381