Web Analytics Made Easy - Statcounter
Skip to content

Class SBCClassProxy#

ClassList > 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 bool deleteInstance (SBValue & instance) const
Deletes the instance of the class exposed via this proxy; if successful, sets instance to an empty value and returnstrue .
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
Returns the private data class object.
virtual std::string getDescription () noexcept 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 if defined, else nullptr.
virtual std::string getGUIShortcut () noexcept 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 () noexcept const
Returns the file name of the class icon.
virtual SBCClassInterface const * getInterface () const
Returns the interface of the class if defined, else nullptr.
virtual SBUserPlan getMinimumUserPlan () noexcept const
Returns the minimum user plan required to use this class.
virtual std::string getName () noexcept const
Returns the name of the class.
virtual std::string getPublicName () noexcept 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 () noexcept 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 () noexcept 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)
Sets the private data class object.
virtual ~SBCClassProxy ()
Destructs the class proxy.

Protected Functions#

Type Name
SBCClassProxy () noexcept
Protected constructor.

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 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");
as well as the following class descriptor:
SB_CLASS_BEGIN(A);

    SB_CLASS_TYPE(SBCClass::App);
    SB_CLASS_DESCRIPTION("Integer multiplier");

    SB_FACTORY_BEGIN;

        SB_CONSTRUCTOR_0();

    SB_FACTORY_END;

    SB_INTERFACE_BEGIN;

        SB_FUNCTION_1(int, 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:

SBProxy* classProxy = SAMSON::getProxy("A");
SBValue classInstance = classProxy->createInstance();
and call its functions:
SBValue argument = SB_VALUE<int>(17);
SBValue resultHolder = classProxy->call(classInstance, "multiplyByTwo", argument);

int result = SB_CAST<int>(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

Calls a non-const function of the class on the given object.

Parameters:

  • object The object on which to call the function.
  • functionName The name of the function to call.
  • t0 First argument to pass to the function.
  • t1 Second argument to pass to the function.
  • t2 Third argument to pass to the function.
  • t3 Fourth argument to pass to the function.
  • t4 Fifth argument to pass to the function.
  • t5 Sixth argument to pass to the function.
  • t6 Seventh argument to pass to the function.
  • t7 Eighth argument to pass to the function.
  • t8 Ninth argument to pass to the function.
  • t9 Tenth argument to pass to the function.
  • t10 Eleventh argument to pass to the function.
  • t11 Twelfth argument to pass to the function.
  • t12 Thirteenth argument to pass to the function.
  • t13 Fourteenth argument to pass to the function.
  • t14 Fifteenth argument to pass to the function.
  • t15 Sixteenth argument to pass to the function.

Returns:

The result of the function call as an SBValue, or 0 if the function was not found.


function clear#

Clears attribute attributeName from theobject when possible.

virtual void SBCClassProxy::clear (
    const SBValue & object,
    const std::string & attributeName
) const

Clears the named attribute from the given object.

Parameters:

  • object The object from which to clear the attribute.
  • attributeName The name of the attribute to clear.

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

Calls a const function of the class on the given object.

Parameters:

  • object The object on which to call the function.
  • functionName The name of the const function to call.
  • t0 First argument to pass to the function.
  • t1 Second argument to pass to the function.
  • t2 Third argument to pass to the function.
  • t3 Fourth argument to pass to the function.
  • t4 Fifth argument to pass to the function.
  • t5 Sixth argument to pass to the function.
  • t6 Seventh argument to pass to the function.
  • t7 Eighth argument to pass to the function.
  • t8 Ninth argument to pass to the function.
  • t9 Tenth argument to pass to the function.
  • t10 Eleventh argument to pass to the function.
  • t11 Twelfth argument to pass to the function.
  • t12 Thirteenth argument to pass to the function.
  • t13 Fourteenth argument to pass to the function.
  • t14 Fifteenth argument to pass to the function.
  • t15 Sixteenth argument to pass to the function.

Returns:

The result of the function call as an SBValue, or 0 if the function was not found.


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

Creates an instance of the class using the provided constructor arguments.

Attempts to find a matching constructor based on the given arguments and creates an instance.

Parameters:

  • t0 First constructor argument.
  • t1 Second constructor argument.
  • t2 Third constructor argument.
  • t3 Fourth constructor argument.
  • t4 Fifth constructor argument.
  • t5 Sixth constructor argument.
  • t6 Seventh constructor argument.
  • t7 Eighth constructor argument.
  • t8 Ninth constructor argument.
  • t9 Tenth constructor argument.
  • t10 Eleventh constructor argument.
  • t11 Twelfth constructor argument.
  • t12 Thirteenth constructor argument.
  • t13 Fourteenth constructor argument.
  • t14 Fifteenth constructor argument.
  • t15 Sixteenth constructor argument.

Returns:

An SBValue representing the newly created instance, or 0 if no matching constructor was found.


function createInstanceType#

Creates a value type that holds the class type.

virtual SBValue SBCClassProxy::createInstanceType () const

Returns a value representing the type of the class.

Returns:

An SBValue containing a SBValueType<void> representing the class type.


function deleteInstance#

Deletes the instance of the class exposed via this proxy; if successful, sets instance to an empty value and returnstrue .

virtual bool SBCClassProxy::deleteInstance (
    SBValue & instance
) const

Deletes the given class instance and resets it to an empty value.

An instance of a class can be deleted only if it exposed at least one constructor.

Parameters:

  • instance The instance of the class to delete; will be set to an empty value on success.

Returns:

true if the instance was successfully deleted; false otherwise.


function get#

Returns the value of attribute attributeName for the specificobject .

virtual SBValue SBCClassProxy::get (
    const SBValue & object,
    const std::string & attributeName
) const

Retrieves the value of a named attribute from the given object.

Parameters:

  • object The object from which to retrieve the attribute.
  • attributeName The name of the attribute to retrieve.

Returns:

The attribute value as an SBValue, or 0 if the attribute was not found.


function getData#

Returns the private data class object.

virtual SBCClassProxyData * SBCClassProxy::getData () noexcept const

Returns:

A pointer to SBCClassProxyData, or nullptr if none.


function getDescription#

Returns the description of the class.

virtual std::string SBCClassProxy::getDescription () noexcept const

Returns:

The description as a std::string.


function getElement#

Returns the SAMSON Extension containing the class.

virtual std::string SBCClassProxy::getElement () noexcept const

Returns:

The name of the element as a std::string.


function getElementUUID#

Returns the UUID of the SAMSON Extension containing the class.

virtual SBCContainerUUID SBCClassProxy::getElementUUID () const

Returns:

The SBCContainerUUID of the element.


function getFactory#

Returns the factory of the class if defined, else nullptr.

virtual SBCClassFactory const * SBCClassProxy::getFactory () const

Returns:

Pointer to SBCClassFactory, or nullptr.


function getGUIShortcut#

Returns the shortcut of the GUI of the class.

virtual std::string SBCClassProxy::getGUIShortcut () noexcept const

Returns:

The GUI shortcut as a std::string.


function getGUIUUID#

Returns the UUID of the GUI of the class.

virtual SBCContainerUUID SBCClassProxy::getGUIUUID () const

Returns:

The SBCContainerUUID of the GUI.


function getIconFileName#

Returns the file name of the class icon.

virtual std::string SBCClassProxy::getIconFileName () noexcept const

Returns:

The icon file name as a std::string.


function getInterface#

Returns the interface of the class if defined, else nullptr.

virtual SBCClassInterface const * SBCClassProxy::getInterface () const

Returns:

Pointer to SBCClassInterface, or nullptr.


function getMinimumUserPlan#

Returns the minimum user plan required to use this class.

virtual SBUserPlan SBCClassProxy::getMinimumUserPlan () noexcept const

Returns:

The SBUserPlan representing the minimum user plan.


function getName#

Returns the name of the class.

virtual std::string SBCClassProxy::getName () noexcept const

Returns:

The class name as a std::string.


function getPublicName#

Returns the public name of the class.

virtual std::string SBCClassProxy::getPublicName () noexcept const

Returns:

The public name as a std::string.


function getSDKVersionNumber#

Returns the version number of the SAMSON SDK used to compile the class.

virtual SBVersionNumber SBCClassProxy::getSDKVersionNumber () noexcept const

Returns:

The SBVersionNumber of the SDK.


function getShortcut#

Returns the shortcut of the class.

virtual std::string SBCClassProxy::getShortcut () noexcept const

Returns:

The shortcut as a std::string.


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

Returns the size of a named attribute in the given object.

Parameters:

  • object The object containing the attribute.
  • attributeName The name of the attribute.

Returns:

The size of the attribute, or 0 if the attribute was not found.


function getToolTip#

Returns the tooltip of the class.

virtual std::string SBCClassProxy::getToolTip () noexcept const

Returns:

The tooltip as a std::string.


function getType#

Returns the type of the class.

virtual SBCClass::Type SBCClassProxy::getType () noexcept const

Returns:

The SBCClass::Type of the class.


function getUUID#

Returns the UUID of the class.

virtual SBCContainerUUID SBCClassProxy::getUUID () const

Returns:

The SBCContainerUUID of the class.


function getVersionNumber#

Returns the version number of the class.

virtual SBVersionNumber SBCClassProxy::getVersionNumber () const

Returns:

The SBVersionNumber of the class.


function has#

Returns whether attribute attributeName exists in theobject and has a value.

virtual bool SBCClassProxy::has (
    const SBValue & object,
    const std::string & attributeName
) const

Checks if a named attribute exists in the given object.

Parameters:

  • object The object to check.
  • attributeName The name of the attribute to check.

Returns:

true if the attribute exists and is accessible; false otherwise.


function isDiscoverable#

Returns true if can be discovered by the user.

virtual bool SBCClassProxy::isDiscoverable () noexcept const

Returns true if the class is discoverable by the user.

Returns:

true if discoverable; false otherwise.


function print#

Prints debugging information.

void SBCClassProxy::print (
    unsigned int offset=0
) const

Prints debugging information for the class proxy.

Parameters:

  • offset Number of tabs to indent the output.

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

Sets the value of a named attribute on the given object.

Parameters:

  • object The object on which to set the attribute.
  • attributeName The name of the attribute to set.
  • value The value to assign to the attribute.
  • size Optional size parameter for the attribute.

function setData#

Sets the private data class object.

virtual void SBCClassProxy::setData (
    SBCClassProxyData * data
) 

Parameters:

  • data The data object to set.

function ~SBCClassProxy#

Destructs the class proxy.

virtual SBCClassProxy::~SBCClassProxy () 

Destroys the SBCClassProxy object.


Protected Functions Documentation#

function SBCClassProxy#

Protected constructor.

SBCClassProxy::SBCClassProxy () noexcept

Constructs a SBCClassProxy object.