Pothos  0.4.1-gb758ed46
The Pothos dataflow programming software suite
Public Member Functions | Static Public Member Functions | List of all members
Pothos::ManagedClass Class Reference

#include <Class.hpp>

Public Member Functions

 ManagedClass (void)
 Create a new empty ManagedClass. More...
 
template<typename ClassType >
ManagedClassregisterClass (void)
 
template<typename ClassType , typename BaseClassType >
ManagedClassregisterBaseClass (void)
 
ManagedClassregisterToBaseClass (const Callable &toBase)
 
template<typename ClassType , typename... ArgsType>
ManagedClassregisterConstructor (void)
 
template<typename ReturnType , typename... ArgsType>
ManagedClassregisterStaticMethod (const std::string &name, ReturnType(*method)(ArgsType...))
 
template<typename ReturnType , typename ClassType , typename... ArgsType>
ManagedClassregisterMethod (const std::string &name, ReturnType(ClassType::*method)(ArgsType...))
 
template<typename ReturnType , typename ClassType , typename... ArgsType>
ManagedClassregisterMethod (const std::string &name, ReturnType(ClassType::*method)(ArgsType...) const)
 
template<typename ClassType , typename ValueType >
ManagedClassregisterField (const std::string &name, ValueType ClassType::*member)
 
ManagedClassregisterReferenceToWrapper (const Callable &toPointer)
 
ManagedClassregisterPointerToWrapper (const Callable &toPointer)
 
ManagedClassregisterSharedToWrapper (const Callable &toPointer)
 
ManagedClassregisterConstructor (const Callable &constructor)
 
ManagedClassregisterStaticMethod (const std::string &name, const Callable &method)
 
ManagedClassregisterMethod (const std::string &name, const Callable &method)
 
ManagedClassregisterOpaqueConstructor (const Callable &constructor)
 
template<typename ClassType >
ManagedClassregisterOpaqueConstructor (void)
 
ManagedClassregisterOpaqueStaticMethod (const std::string &name, const Callable &method)
 
ManagedClassregisterWildcardStaticMethod (const Callable &method)
 
ManagedClassregisterOpaqueMethod (const std::string &name, const Callable &method)
 
ManagedClassregisterWildcardMethod (const Callable &method)
 
ManagedClasscommit (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 CallablegetReferenceToWrapper (void) const
 
const CallablegetPointerToWrapper (void) const
 
const CallablegetSharedToWrapper (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 CallablegetOpaqueConstructor (void) const
 
const CallablegetOpaqueStaticMethod (const std::string &name) const
 
const CallablegetWildcardStaticMethod (void) const
 
const CallablegetOpaqueMethod (const std::string &name) const
 
const CallablegetWildcardMethod (void) const
 

Static Public Member Functions

static ManagedClass lookup (const std::type_info &type)
 
static void unload (const std::string &classPath)
 

Detailed Description

ManagedClass represents registered constructors and methods of a class. A ManagedClass makes calls available to users via the Callable interface.

Constructor & Destructor Documentation

Pothos::ManagedClass::ManagedClass ( void  )

Create a new empty ManagedClass.

Member Function Documentation

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".

Exceptions
PluginPathErrorif the classPath is invalid
Parameters
classPaththe namespaces and class name
const std::vector<Callable>& Pothos::ManagedClass::getBaseClassConverters ( void  ) const

Get a list of available converters to base classes

Returns
a list of converters as callables
const std::vector<Callable>& Pothos::ManagedClass::getConstructors ( void  ) const

Get a list of available constructors.

Returns
a list of constructors as callables
const std::vector<Callable>& Pothos::ManagedClass::getMethods ( const std::string &  name) const

Get a list of available methods for the given method name.

Exceptions
ManagedClassNameErrorif the name does not exist in the registry
Parameters
namethe name of the method to look for
Returns
a list of methods as callables
const Callable& Pothos::ManagedClass::getOpaqueConstructor ( void  ) const

Get the opaque constructor. The opaque contructor takes (Object *args, size_t num).

Returns
a callable object for a constructor
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).

Exceptions
ManagedClassNameErrorif the name does not exist in the registry
Parameters
namethe name of the method to look for
Returns
a callable object for a method
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).

Exceptions
ManagedClassNameErrorif the name does not exist in the registry
Parameters
namethe name of the static method to look for
Returns
a callable object for a static method
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.

Exceptions
ManagedClassNameErrorif the name does not exist in the registry
Parameters
namethe name of the static method to look for
Returns
a list of static methods as callables
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).

Returns
a callable object for a method
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).

Returns
a callable object for a static method
static ManagedClass Pothos::ManagedClass::lookup ( const std::type_info &  type)
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.

Exceptions
ManagedClassTypeErrorif no constructors registered
template<typename ClassType , typename BaseClassType >
ManagedClass & Pothos::ManagedClass::registerBaseClass ( void  )

Register a public base class of this managed class. This adopts the inherited methods of the base class.

template<typename ClassType >
ManagedClass & Pothos::ManagedClass::registerClass ( void  )

Register information and conversions about the ClassType. This routine is automatically called during constructor and method registration calls.

template<typename ClassType , typename... ArgsType>
ManagedClass & Pothos::ManagedClass::registerConstructor ( void  )

Register a constructor given class type and variable argument types.

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif the class type differs from the registered type
template<typename ClassType , typename ValueType >
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.

Exceptions
ManagedClassTypeErrorif the class type differs from the registered type
Parameters
namethe name of the field
membera pointer to a data member of Class
template<typename ReturnType , typename ClassType , typename... ArgsType>
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.

Exceptions
ManagedClassTypeErrorif the class type differs from the registered type
template<typename ReturnType , typename ClassType , typename... ArgsType>
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.

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif 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).

Exceptions
ManagedClassTypeErrorif the class type differs from the registered type
template<typename ClassType >
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).

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif the class type differs from the registered type
template<typename ReturnType , typename... ArgsType>
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.

Exceptions
ManagedClassTypeErrorif the class type differs from the registered type
Parameters
toBasea 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).

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif 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.

Exceptions
ManagedClassTypeErrorif no constructors registered
static void Pothos::ManagedClass::unload ( const std::string &  classPath)
static

Unload a managed class from the plugin tree. This reverses the effect of ManagedClass::commit(). This call is mainly used for testing purposes.

Exceptions
PluginPathErrorif the classPath is invalid
Parameters
classPaththe namespaces and class name

The documentation for this class was generated from the following files: