Pothos
0.7.0-gf7fbae99
The Pothos dataflow programming software suite
|
#include <Class.hpp>
Public Member Functions | |
ManagedClass (void) | |
Create a new empty ManagedClass. More... | |
template<typename ClassType > | |
ManagedClass & | registerClass (void) |
template<typename ClassType , typename BaseClassType > | |
ManagedClass & | registerBaseClass (void) |
ManagedClass & | registerToBaseClass (const Callable &toBase) |
template<typename ClassType , typename... ArgsType> | |
ManagedClass & | registerConstructor (void) |
template<typename ReturnType , typename... ArgsType> | |
ManagedClass & | registerStaticMethod (const std::string &name, ReturnType(*method)(ArgsType...)) |
template<typename ReturnType , typename ClassType , typename... ArgsType> | |
ManagedClass & | registerMethod (const std::string &name, ReturnType(ClassType::*method)(ArgsType...)) |
template<typename ReturnType , typename ClassType , typename... ArgsType> | |
ManagedClass & | registerMethod (const std::string &name, ReturnType(ClassType::*method)(ArgsType...) const) |
template<typename ClassType , typename ValueType > | |
ManagedClass & | registerField (const std::string &name, ValueType ClassType::*member) |
ManagedClass & | registerReferenceToWrapper (const Callable &toPointer) |
ManagedClass & | registerPointerToWrapper (const Callable &toPointer) |
ManagedClass & | registerSharedToWrapper (const Callable &toPointer) |
ManagedClass & | registerConstructor (const Callable &constructor) |
ManagedClass & | registerStaticMethod (const std::string &name, const Callable &method) |
ManagedClass & | registerMethod (const std::string &name, const Callable &method) |
ManagedClass & | registerOpaqueConstructor (const Callable &constructor) |
template<typename ClassType > | |
ManagedClass & | registerOpaqueConstructor (void) |
ManagedClass & | registerOpaqueStaticMethod (const std::string &name, const Callable &method) |
ManagedClass & | registerWildcardStaticMethod (const Callable &method) |
ManagedClass & | registerOpaqueMethod (const std::string &name, const Callable &method) |
ManagedClass & | registerWildcardMethod (const Callable &method) |
ManagedClass & | commit (const std::string &classPath) |
const std::type_info & | type (void) const |
const std::type_info & | pointerType (void) const |
const std::type_info & | sharedType (void) const |
const Callable & | getReferenceToWrapper (void) const |
const Callable & | getPointerToWrapper (void) const |
const Callable & | getSharedToWrapper (void) const |
const std::vector< Callable > & | getBaseClassConverters (void) const |
const std::vector< Callable > & | getConstructors (void) const |
const std::vector< Callable > & | getStaticMethods (const std::string &name) const |
const std::vector< Callable > & | getMethods (const std::string &name) const |
const Callable & | getOpaqueConstructor (void) const |
const Callable & | getOpaqueStaticMethod (const std::string &name) const |
const Callable & | getWildcardStaticMethod (void) const |
const Callable & | getOpaqueMethod (const std::string &name) const |
const Callable & | getWildcardMethod (void) const |
Static Public Member Functions | |
static ManagedClass | lookup (const std::type_info &type) |
static void | unload (const std::string &classPath) |
ManagedClass represents registered constructors and methods of a class. A ManagedClass makes calls available to users via the Callable interface.
Pothos::ManagedClass::ManagedClass | ( | void | ) |
Create a new empty ManagedClass.
ManagedClass& Pothos::ManagedClass::commit | ( | const std::string & | classPath | ) |
Commit this registration into the plugin tree. The actual registration will be stored to /managed/classPath. An example class path might be "MyNamespace/MyClass".
PluginPathError | if the classPath is invalid |
classPath | the namespaces and class name |
const std::vector<Callable>& Pothos::ManagedClass::getBaseClassConverters | ( | void | ) | const |
Get a list of available converters to base classes
const std::vector<Callable>& Pothos::ManagedClass::getConstructors | ( | void | ) | const |
Get a list of available constructors.
const std::vector<Callable>& Pothos::ManagedClass::getMethods | ( | const std::string & | name | ) | const |
Get a list of available methods for the given method name.
ManagedClassNameError | if the name does not exist in the registry |
name | the name of the method to look for |
const Callable& Pothos::ManagedClass::getOpaqueConstructor | ( | void | ) | const |
Get the opaque constructor. The opaque contructor takes (Object *args, size_t num).
const Callable& Pothos::ManagedClass::getOpaqueMethod | ( | const std::string & | name | ) | const |
Get the opaque method for the given method name. The opaque method takes (Object *args, size_t num).
ManagedClassNameError | if the name does not exist in the registry |
name | the name of the method to look for |
const Callable& Pothos::ManagedClass::getOpaqueStaticMethod | ( | const std::string & | name | ) | const |
Get the opaque static methods for the given method name. The opaque static method takes (Object *args, size_t num).
ManagedClassNameError | if the name does not exist in the registry |
name | the name of the static method to look for |
const Callable& Pothos::ManagedClass::getPointerToWrapper | ( | void | ) | const |
Get a callable that converts a pointer into a ref wrapper.
const Callable& Pothos::ManagedClass::getReferenceToWrapper | ( | void | ) | const |
Get a callable that converts a reference into a ref wrapper.
const Callable& Pothos::ManagedClass::getSharedToWrapper | ( | void | ) | const |
Get a callable that converts a shared pointer into a ref wrapper.
const std::vector<Callable>& Pothos::ManagedClass::getStaticMethods | ( | const std::string & | name | ) | const |
Get a list of available static methods for the given method name.
ManagedClassNameError | if the name does not exist in the registry |
name | the name of the static method to look for |
const Callable& Pothos::ManagedClass::getWildcardMethod | ( | void | ) | const |
Get the wildcard static method. This is a catch-all for methods when there is not a name match. The opaque wildcard method takes (std::string name, Object *args, size_t num).
const Callable& Pothos::ManagedClass::getWildcardStaticMethod | ( | void | ) | const |
Get the wildcard opaque static method. This is a catch-all for static methods when there is not a name match. The opaque wildcard static method takes (std::string name, Object *args, size_t num).
|
static |
Lookup a managed class based on typeinfo for the class.
const std::type_info& Pothos::ManagedClass::pointerType | ( | void | ) | const |
Get the pointer version of the class type represented.
ManagedClassTypeError | if no constructors registered |
ManagedClass & Pothos::ManagedClass::registerBaseClass | ( | void | ) |
Register a public base class of this managed class. This adopts the inherited methods of the base class.
ManagedClass & Pothos::ManagedClass::registerClass | ( | void | ) |
Register information and conversions about the ClassType. This routine is automatically called during constructor and method registration calls.
ManagedClass & Pothos::ManagedClass::registerConstructor | ( | void | ) |
Register a constructor given class type and variable argument types.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerConstructor | ( | const Callable & | constructor | ) |
Register a constructor via a callable. This method is called by the templated method of the same name.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass & Pothos::ManagedClass::registerField | ( | const std::string & | name, |
ValueType ClassType::* | member | ||
) |
Register an accessor and mutator method for the field. The accessor and mutator are registered under the names "get:name" and "set:name". Example usage: myManagedClass.registerField(&MyClass:myField); The accessor method can be called on a class instance and takes no arguments. The mutator method can be called on a class instance and takes the new value as the first argument.
ManagedClassTypeError | if the class type differs from the registered type |
name | the name of the field |
member | a pointer to a data member of Class |
ManagedClass & Pothos::ManagedClass::registerMethod | ( | const std::string & | name, |
ReturnType(ClassType::*)(ArgsType...) | method | ||
) |
Register a method given class name and function pointer of variable args. When specifying overloads using the ArgsType, the entire pack must be specified.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerMethod | ( | const std::string & | name, |
ReturnType(ClassType::*)(ArgsType...) const | method | ||
) |
Register a method given class name and function pointer of variable args. When specifying overloads using the ArgsType, the entire pack must be specified.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerMethod | ( | const std::string & | name, |
const Callable & | method | ||
) |
Register a method via a callable. This method is called by the templated method of the same name.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerOpaqueConstructor | ( | const Callable & | constructor | ) |
Register a callable that takes generic arguments (Object *args, size_t num).
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass & Pothos::ManagedClass::registerOpaqueConstructor | ( | void | ) |
Template version of registerOpaqueConstructor for user's convenience.
ManagedClass& Pothos::ManagedClass::registerOpaqueMethod | ( | const std::string & | name, |
const Callable & | method | ||
) |
Register a static method with the following signature: Object method(instance, Object *args, size_t num).
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerOpaqueStaticMethod | ( | const std::string & | name, |
const Callable & | method | ||
) |
Register a static method with the following signature: Object staticMethod(Object *args, size_t num).
ManagedClass& Pothos::ManagedClass::registerPointerToWrapper | ( | const Callable & | toPointer | ) |
Register a conversion function from pointer to a ref wrapper. Called automatically when a constructor is registered via the templated interface.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerReferenceToWrapper | ( | const Callable & | toPointer | ) |
Register a conversion function from reference to a ref wrapper. Called automatically when a constructor is registered via the templated interface.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerSharedToWrapper | ( | const Callable & | toPointer | ) |
Register a conversion function from shared pointer to ref wrapper. Called automatically when a constructor is registered via the templated interface.
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass & Pothos::ManagedClass::registerStaticMethod | ( | const std::string & | name, |
ReturnType(*)(ArgsType...) | method | ||
) |
Register a static method given class name and function pointer of variable args. When specifying overloads using the ArgsType, the entire pack must be specified.
ManagedClass& Pothos::ManagedClass::registerStaticMethod | ( | const std::string & | name, |
const Callable & | method | ||
) |
Register a static method via a callable. This method is called by the templated method of the same name.
ManagedClass& Pothos::ManagedClass::registerToBaseClass | ( | const Callable & | toBase | ) |
Register a conversion function from this class to a base class.
ManagedClassTypeError | if the class type differs from the registered type |
toBase | a callable that converts between class types |
ManagedClass& Pothos::ManagedClass::registerWildcardMethod | ( | const Callable & | method | ) |
Register a static method with the following signature: Object method(instance, std::string name, Object *args, size_t num).
ManagedClassTypeError | if the class type differs from the registered type |
ManagedClass& Pothos::ManagedClass::registerWildcardStaticMethod | ( | const Callable & | method | ) |
Register a static method with the following signature: Object staticMethod(std::string name, Object *args, size_t num).
const std::type_info& Pothos::ManagedClass::sharedType | ( | void | ) | const |
Get the shared pointer version of the class type represented.
ManagedClassTypeError | if no constructors registered |
const std::type_info& Pothos::ManagedClass::type | ( | void | ) | const |
Get the type of the class represented. This is the type created by the constructors, and the type taken as the class by the bound methods.
ManagedClassTypeError | if no constructors registered |
|
static |
Unload a managed class from the plugin tree. This reverses the effect of ManagedClass::commit(). This call is mainly used for testing purposes.
PluginPathError | if the classPath is invalid |
classPath | the namespaces and class name |