Pothos  0.2.1-g9f04573d
The Pothos dataflow programming software suite
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros
Class.tmpl.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 #include <Pothos/Config.hpp>
14 #include <string>
15 #include <memory>
16 #include <typeinfo>
17 
18 namespace Pothos {
19 
24 class POTHOS_API ManagedClass
25 {
26 public:
27 
31  static ManagedClass lookup(const std::type_info &type);
32 
34  ManagedClass(void);
35 
41  template <typename ClassType>
42  ManagedClass &registerClass(void);
43 
48  template <typename ClassType, typename BaseClassType>
49  ManagedClass &registerBaseClass(void);
50 
56  ManagedClass &registerToBaseClass(const Callable &toBase);
57 
58  #for $NARGS in range($MAX_ARGS)
59 
63  template <typename ClassType, $expand('typename A%d', $NARGS)>
64  ManagedClass &registerConstructor(void);
65 
69  template <$expand('typename A%d', $NARGS), typename ReturnType>
70  ManagedClass &registerStaticMethod(const std::string &name, ReturnType(*method)($expand('A%d', $NARGS)));
71 
76  template <$expand('typename A%d', $NARGS), typename ReturnType, typename ClassType>
77  ManagedClass &registerMethod(const std::string &name, ReturnType(ClassType::*method)($expand('A%d', $NARGS)));
78 
83  template <$expand('typename A%d', $NARGS), typename ReturnType, typename ClassType>
84  ManagedClass &registerMethod(const std::string &name, ReturnType(ClassType::*method)($expand('A%d', $NARGS)) const);
85  #end for
86 
97  template <typename ClassType, typename ValueType>
98  ManagedClass &registerField(const std::string &name, ValueType ClassType::*member);
99 
105  ManagedClass &registerReferenceToWrapper(const Callable &toPointer);
106 
112  ManagedClass &registerPointerToWrapper(const Callable &toPointer);
113 
119  ManagedClass &registerSharedToWrapper(const Callable &toPointer);
120 
126  ManagedClass &registerConstructor(const Callable &constructor);
127 
132  ManagedClass &registerStaticMethod(const std::string &name, const Callable &method);
133 
139  ManagedClass &registerMethod(const std::string &name, const Callable &method);
140 
145  ManagedClass &registerOpaqueConstructor(const Callable &constructor);
146 
150  template <typename ClassType>
151  ManagedClass &registerOpaqueConstructor(void);
152 
157  ManagedClass &registerOpaqueStaticMethod(const std::string &name, const Callable &method);
158 
163  ManagedClass &registerWildcardStaticMethod(const Callable &method);
164 
170  ManagedClass &registerOpaqueMethod(const std::string &name, const Callable &method);
171 
177  ManagedClass &registerWildcardMethod(const Callable &method);
178 
186  ManagedClass &commit(const std::string &classPath);
187 
195  static void unload(const std::string &classPath);
196 
203  const std::type_info &type(void) const;
204 
209  const std::type_info &pointerType(void) const;
210 
215  const std::type_info &sharedType(void) const;
216 
220  const Callable &getReferenceToWrapper(void) const;
221 
225  const Callable &getPointerToWrapper(void) const;
226 
230  const Callable &getSharedToWrapper(void) const;
231 
236  const std::vector<Callable> &getBaseClassConverters(void) const;
237 
242  const std::vector<Callable> &getConstructors(void) const;
243 
250  const std::vector<Callable> &getStaticMethods(const std::string &name) const;
251 
258  const std::vector<Callable> &getMethods(const std::string &name) const;
259 
265  const Callable &getOpaqueConstructor(void) const;
266 
274  const Callable &getOpaqueStaticMethod(const std::string &name) const;
275 
282  const Callable &getWildcardStaticMethod(void) const;
283 
291  const Callable &getOpaqueMethod(const std::string &name) const;
292 
299  const Callable &getWildcardMethod(void) const;
300 
301 private:
302  struct Impl;
303  std::shared_ptr<Impl> _impl;
304 };
305 
306 } //namespace Pothos
#define POTHOS_API
Definition: Config.hpp:41