This class describes a class interface in a class proxy. More...
Constructors and destructors | |
| SBCClassInterface () | |
| Constructs a class interface. | |
| virtual | ~SBCClassInterface () |
| Destructs the interface. | |
Managing functions | |
| void | addFunction (SBCClassFunction *function) |
| Adds a function to the interface. | |
| SBCClassFunction * | getFunction (const std::string &functionName, const SBValue &t0=SBValue(), const SBValue &t1=SBValue(), const SBValue &t2=SBValue(), const SBValue &t3=SBValue(), const SBValue &t4=SBValue(), const SBValue &t5=SBValue(), const SBValue &t6=SBValue(), const SBValue &t7=SBValue(), const SBValue &t8=SBValue(), const SBValue &t9=SBValue(), const SBValue &t10=SBValue(), const SBValue &t11=SBValue(), const SBValue &t12=SBValue(), const SBValue &t13=SBValue(), const SBValue &t14=SBValue(), const SBValue &t15=SBValue()) const |
Returns the function with name functionName and arguments t0, t1, ..., t15. | |
| SBCClassFunction * | getConstFunction (const std::string &functionName, const SBValue &t0=SBValue(), const SBValue &t1=SBValue(), const SBValue &t2=SBValue(), const SBValue &t3=SBValue(), const SBValue &t4=SBValue(), const SBValue &t5=SBValue(), const SBValue &t6=SBValue(), const SBValue &t7=SBValue(), const SBValue &t8=SBValue(), const SBValue &t9=SBValue(), const SBValue &t10=SBValue(), const SBValue &t11=SBValue(), const SBValue &t12=SBValue(), const SBValue &t13=SBValue(), const SBValue &t14=SBValue(), const SBValue &t15=SBValue()) const |
Returns the const function with name functionName and arguments t0, t1, ..., t15. | |
| SBCClassAttribute * | getAttribute (const std::string &attributeName) const |
Returns the attribute with name attributeName. | |
| SBHashMap< std::string, SBCClassFunction * > const & | getFunctionMap () const |
| Returns the function map. | |
| SBHashMap< std::string, SBCClassAttribute * > const & | getAttributeMap () const |
| Returns the attribute map. | |
Attributes | |
| void | addAttribute (SBCClassAttribute *attribute) |
| Adds a function to the interface. | |
Debugging | |
| void | print (unsigned int offset=0) const |
| Prints the interface. | |
This class describes a class interface in a class proxy. A class interface is a collection of class functions exposed through a class descriptor.
Assume for example a SAMSON Extension contains the following class:
as well as the following class descriptor:
In this example, the function multiplyByTwo is accessible to other SAMSON Extensions through the SAMSON's introspection mechanism, even when the definition of class A is not available. Precisely, even though other developers might not have access to the definition of class A (i.e. they do not have the appropriate header file), they may still access its interface from the class proxy:
They may then obtain function objects from the interface:
Since, in this example, the function is not static, we need an object of type A:
We may then use the exposed function by wrapping arguments and unwrapping results:
Note that the class proxy also makes it possible to directly call a function provided by an exposed class without having first to obtain the SBCClassFunction object:
However, when multiple calls are performed, it is more efficient to store a pointer to a SBCClassFunction object and reuse it.
Note that a class interface should never be deleted.
Please refer to the chapter about introspection for more information.
Short name: SBInterface