Pothos  0.1.1
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Proxy.tmpl.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
13 #include <memory>
14 #include <string>
15 
16 namespace Pothos {
17 
18 class ProxyEnvironment;
19 class ProxyHandle;
20 
27 class POTHOS_API Proxy
28 {
29 public:
30 
34  Proxy(void);
35 
41  Proxy(const std::shared_ptr<ProxyHandle> &handle);
42 
49  Proxy(ProxyHandle *handle);
50 
55  pothos_explicit operator bool(void) const;
56 
58  std::shared_ptr<ProxyHandle> getHandle(void) const;
59 
63  std::shared_ptr<ProxyEnvironment> getEnvironment(void) const;
64 
70  template <typename ValueType>
71  ValueType convert(void) const;
72 
73  #for $NARGS in range($MAX_ARGS)
74  template <typename ReturnType, $expand('typename A%d', $NARGS)>
76  ReturnType call(const std::string &name, $expand('const A%d &a%d', $NARGS)) const;
77 
79  template <$expand('typename A%d', $NARGS)>
80  Proxy callProxy(const std::string &name, $expand('const A%d &a%d', $NARGS)) const;
81 
83  template <$expand('typename A%d', $NARGS)>
84  void callVoid(const std::string &name, $expand('const A%d &a%d', $NARGS)) const;
85  #end for;
86 
94  int compareTo(const Proxy &other) const;
95 
100  size_t hashCode(void) const;
101 
107  std::string toString(void) const;
108 
115  std::string getClassName(void) const;
116 
118  bool operator<(const Proxy &obj) const;
119 
121  bool operator>(const Proxy &obj) const;
122 
123 private:
124  std::shared_ptr<ProxyHandle> _handle;
125 };
126 
134 POTHOS_API bool operator==(const Proxy &lhs, const Proxy &rhs);
135 
136 } //namespace Pothos
137 
138 inline Pothos::Proxy Pothos::Proxy::callProxy(const std::string &name) const
139 {
140  return this->call<Proxy>(name);
141 }
142 
143 inline void Pothos::Proxy::callVoid(const std::string &name) const
144 {
145  this->call<Proxy>(name);
146 }
#define pothos_explicit
Definition: Config.hpp:85
#define POTHOS_API
Definition: Config.hpp:41
bool operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs)
Definition: ManagedBuffer.hpp:132
void callVoid(const std::string &name) const
Call a method with a void return and 0 args.
Definition: Proxy.hpp:240
Proxy callProxy(const std::string &name) const
Call a method with a Proxy return and 0 args.
Definition: Proxy.hpp:235
int compareTo(const T0 &v0, const T1 &v1)
Definition: CompareTo.hpp:27
Definition: Proxy.hpp:27