Class SBCClassProxy#
This class describes a class proxy. More...
#include <SBCClassProxy.hpp>
Public Functions#
Type | Name |
---|---|
virtual SBValue | call (const SBValue & object, 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 Calls the function for the specific object with argumentst0 ,t1 , ...,t15 . |
virtual void | clear (const SBValue & object, const std::string & attributeName) const Clears attribute attributeName from theobject when possible. |
virtual SBValue | constCall (const SBValue & object, 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 Calls the const function for the specific object with argumentst0 ,t1 , ...,t15 . |
virtual SBValue | createInstance (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 Creates an instance of the class with arguments t0 ,t1 , ...,t15 . |
virtual SBValue | createInstanceType () const Creates a value type that holds the class type. |
virtual SBValue | get (const SBValue & object, const std::string & attributeName) const Returns the value of attribute attributeName for the specificobject . |
virtual SBCClassProxyData * | getData () noexcept const |
virtual std::string | getDescription () const Returns the description of the class. |
virtual std::string | getElement () noexcept const Returns the SAMSON Extension containing the class. |
virtual SBCContainerUUID | getElementUUID () const Returns the UUID of the SAMSON Extension containing the class. |
virtual SBCClassFactory const * | getFactory () const Returns the factory of the class. |
virtual std::string | getGUIShortcut () const Returns the shortcut of the GUI of the class. |
virtual SBCContainerUUID | getGUIUUID () const Returns the UUID of the GUI of the class. |
virtual std::string | getIconFileName () const Returns the file name of the class icon. |
virtual SBCClassInterface const * | getInterface () const Returns the interface of the class. |
virtual SBUserPlan | getMinimumUserPlan () noexcept const Returns the minimum user plan required to use this class. |
virtual std::string | getName () const Returns the name of the class. |
virtual std::string | getPublicName () const Returns the public name of the class. |
virtual SBVersionNumber | getSDKVersionNumber () noexcept const Returns the version number of the SAMSON SDK used to compile the class. |
virtual std::string | getShortcut () const Returns the shortcut of the class. |
virtual unsigned int | getSize (const SBValue & object, const std::string & attributeName) const Returns the size of attribute attributeName in theobject when relevant. |
virtual std::string | getToolTip () const Returns the tooltip of the class. |
virtual SBCClass::Type | getType () noexcept const Returns the type of the class. |
virtual SBCContainerUUID | getUUID () const Returns the UUID of the class. |
virtual SBVersionNumber | getVersionNumber () const Returns the version number of the class. |
virtual bool | has (const SBValue & object, const std::string & attributeName) const Returns whether attribute attributeName exists in theobject and has a value. |
virtual bool | isDiscoverable () noexcept const Returns true if can be discovered by the user. |
void | print (unsigned int offset=0) const Prints debugging information. |
virtual void | set (const SBValue & object, const std::string & attributeName, const SBValue & value, const SBValue & size=0) const Sets the value of attribute attributeName for the specificobject tovalue . |
virtual void | setData (SBCClassProxyData * data) |
virtual | ~SBCClassProxy () Destructs the class proxy. |
Protected Functions#
Type | Name |
---|---|
SBCClassProxy () |
Detailed Description#
This class describes a class proxy (see Introspection), i.e. an access to a class that has been exposed through a class descriptor (see Introspection) in a SAMSON Extension.
Assume for example a SAMSON Extension contains the following class:
class A {
SB_CLASS
public:
A() {}
virtual ~A() {}
int multiplyByTwo(int i) {
return 2 * i;
}
};
SB_REGISTER_TYPE(A, "A", "BF99103E-06FE-C4C1-D929-4C6E833B101C");
SB_CLASS_BEGIN(A);
SB_CLASS_TYPE(SBCClass::App);
SB_CLASS_DESCRIPTION("Integer multiplier");
SB_FACTORY_BEGIN;
SB_CONSTRUCTOR_0(A);
SB_FACTORY_END;
SB_INTERFACE_BEGIN;
SB_FUNCTION_1(int, A, multiplyByTwo, int);
SB_INTERFACE_END;
SB_CLASS_END(A);
In this example, the functionality of class A is accessible to developers of SAMSON Extensions, 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 create instances of it:
const SBValue& argumentHolder = new SBValueHolder<int>(17);
const SBValue& resultHolder =
classProxy->call(objectHolder, "multiplyByTwo", argument);
int result = static_cast<SBValueHolder<int>*>(resultHolder)->getValue();
delete argumentHolder;
delete resultHolder;
In general, a class proxy gives access to information about a class (e.g. its name, its type, etc.), as well as its factory (its collection of constructors) and its interface (its collection of functions).
Note that, when multiple instances of the class are created, or when multiple calls are performed, it is more efficient to store pointers to class constructors and class functions and reuse them.
Note that a class proxy should never be deleted.
Please refer to the chapter about Introspection for more information.
Short name: SBProxy
See also: Introspection
See also: SBCClassFactory, SBCClassConstructor, SBCClassInterface, SBCClassFunction
Public Functions Documentation#
function call#
Calls the function for the specific object
with argumentst0
,t1
, ...,t15
.
virtual SBValue SBCClassProxy::call (
const SBValue & object,
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
function clear#
Clears attribute attributeName
from theobject
when possible.
virtual void SBCClassProxy::clear (
const SBValue & object,
const std::string & attributeName
) const
function constCall#
Calls the const function for the specific object
with argumentst0
,t1
, ...,t15
.
virtual SBValue SBCClassProxy::constCall (
const SBValue & object,
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
function createInstance#
Creates an instance of the class with arguments t0
,t1
, ...,t15
.
virtual SBValue SBCClassProxy::createInstance (
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
function createInstanceType#
Creates a value type that holds the class type.
function get#
Returns the value of attribute attributeName
for the specificobject
.
virtual SBValue SBCClassProxy::get (
const SBValue & object,
const std::string & attributeName
) const
function getData#
function getDescription#
Returns the description of the class.
function getElement#
Returns the SAMSON Extension containing the class.
function getElementUUID#
Returns the UUID of the SAMSON Extension containing the class.
function getFactory#
Returns the factory of the class.
function getGUIShortcut#
Returns the shortcut of the GUI of the class.
function getGUIUUID#
Returns the UUID of the GUI of the class.
function getIconFileName#
Returns the file name of the class icon.
function getInterface#
Returns the interface of the class.
function getMinimumUserPlan#
Returns the minimum user plan required to use this class.
function getName#
Returns the name of the class.
function getPublicName#
Returns the public name of the class.
function getSDKVersionNumber#
Returns the version number of the SAMSON SDK used to compile the class.
function getShortcut#
Returns the shortcut of the class.
function getSize#
Returns the size of attribute attributeName
in theobject
when relevant.
virtual unsigned int SBCClassProxy::getSize (
const SBValue & object,
const std::string & attributeName
) const
function getToolTip#
Returns the tooltip of the class.
function getType#
Returns the type of the class.
function getUUID#
Returns the UUID of the class.
function getVersionNumber#
Returns the version number of the class.
function has#
Returns whether attribute attributeName
exists in theobject
and has a value.
function isDiscoverable#
Returns true if can be discovered by the user.
function print#
Prints debugging information.
function set#
Sets the value of attribute attributeName
for the specificobject
tovalue
.
virtual void SBCClassProxy::set (
const SBValue & object,
const std::string & attributeName,
const SBValue & value,
const SBValue & size=0
) const
function setData#
function ~SBCClassProxy#
Destructs the class proxy.