You.i Engine
CYIBindingImplementation Class Referenceabstract

Detailed Description

The base class where binding occurs between C++ and another language.

This class is where the binding occurs for a CYIScriptableObject to another language. This class defines an interface for all binding implementations. If a class is a subclass of a CYIScriptableObject it must also have a subclass of CYIBindingImplementation to be accessible from script source.

Note
This class is not intended to be subclassed directly but generated using the binding generation tools provided with the SDK package. See Binding for more information regarding creating custom bindings.

#include <binding/YiBindingImplementation.h>

Inheritance diagram for CYIBindingImplementation:

Public Member Functions

 CYIBindingImplementation ()
 
virtual ~CYIBindingImplementation ()
 
virtual void CreateNewScriptObject (CYIBindingContext *pContext, CYIScriptableObject *pScriptableObject, void *pScriptObjectPointer)=0
 
virtual void CreateNewScriptObject (CYIBindingContext *pContext, std::shared_ptr< CYIScriptableObject > pScriptableObject, void *pScriptObjectPointer)=0
 
virtual void SetIsRooted (bool bIsRooted)
 
virtual bool IsRooted () const
 
void BreakObjectLink ()
 
CYIScriptableObjectGetScriptableObject ()
 
const std::shared_ptr< CYIScriptableObject > & GetSharedPtr ()
 
std::unique_ptr< CYIScriptableObjectTakeUniquePtr ()
 
void * GetScriptObject ()
 
CYIBindingContextGetBindingContext ()
 
void SetBindingContext (CYIBindingContext *pBindingContext)
 
void SetIsStrongLink (bool bIsStrong)
 
bool IsStrongLink () const
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 

Protected Attributes

CYIString m_TemplateName
 
CYIString m_TemplateNamespace
 
CYIBindingContextm_pBindingContext
 
void * m_pScriptObjectPointer
 
CYIScriptableObjectm_pScriptableObject
 
std::shared_ptr< CYIScriptableObjectm_pScriptableObjectSharedPtr
 

Constructor & Destructor Documentation

CYIBindingImplementation::CYIBindingImplementation ( )
virtual CYIBindingImplementation::~CYIBindingImplementation ( )
virtual

Member Function Documentation

void CYIBindingImplementation::BreakObjectLink ( )

Removes any link between the binding implementation and the script object as well as the C++ scriptable object. This includes clearing the rooted state of the scriptable object if it was rooted. This is called when a CYIScriptableObject is destroyed and is only inteded to be used with the assumption that the CYIScriptableObject has been cleaned up externally. Calling this method without cleaning up the associated CYIScriptableObject at some point will result in memory leaks.

See also
SetIsRooted
CYIBindingImplementation::CreateNewScriptObject ( CYIBindingContext pContext,
CYIScriptableObject pScriptableObject,
void *  pScriptObjectPointer 
)
pure virtual

Creates a new script object if pScriptObjectPointer is null. pScriptObjectPointer is the pointer to the script object in memory that is managed by the binding engine. The script object is then associated with the C++ object, pScriptableObject, so that it accessible when receiving calls from the script layer.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
This class will hold a reference to pScriptableObject until pScriptObjectPointer is destroyed by the binding engine.

Implemented in CYIDTBindingImplementation.

virtual void CYIBindingImplementation::CreateNewScriptObject ( CYIBindingContext pContext,
std::shared_ptr< CYIScriptableObject pScriptableObject,
void *  pScriptObjectPointer 
)
pure virtual

Implemented in CYIDTBindingImplementation.

CYIBindingContext* CYIBindingImplementation::GetBindingContext ( )

Returns the binding context associated with this binding implementation.

CYIScriptableObject* CYIBindingImplementation::GetScriptableObject ( )

Returns the C++ scriptable object associated with this binding implementation.

See also
GetSharedPtr
void* CYIBindingImplementation::GetScriptObject ( )

Returns the pointer to the script object in memory that was either created by or passed into CreateNewScriptObject().

const std::shared_ptr<CYIScriptableObject>& CYIBindingImplementation::GetSharedPtr ( )

Returns the C++ scriptable object associated with this binding implementation.

See also
GetScriptableObject
virtual bool CYIBindingImplementation::IsRooted ( ) const
virtual

Returns true if the script object associated with this binding implemented is rooted.

See also
SetIsRooted
bool CYIBindingImplementation::IsStrongLink ( ) const

Returns true if this binding implementation holds a strong link to its associated CYIScriptablObject.

See also
SetIsStrongLink
void CYIBindingImplementation::SetBindingContext ( CYIBindingContext pBindingContext)

Sets the binding context associated with this binding implementation.

virtual void CYIBindingImplementation::SetIsRooted ( bool  bIsRooted)
virtual

Sets the script object associated with this binding implementation to rooted. If bIsRooted is true the script object will be kept in memory until set to false, the associated CYIBindingContext is destroyed, or the associated CYIScriptableObject is destroyed. If bIsRooted is false the script object will be destroyed as soon as the script object goes out of scope in the script source code. When the script object is destroyed this binding implementation will be destroyed.

Defaults to false.

See also
CYIBindingContext::NewRootedObject

Reimplemented in CYIDTBindingImplementation.

void CYIBindingImplementation::SetIsStrongLink ( bool  bIsStrong)

Sets whether this binding implementation holds a strong link to its associated CYIScriptableObject. If bIsStrong is true the associated CYIScriptableObject will be cleaned up when the binding implementation is destroyed, otherwise the associated CYIScriptableObject will remain in memory.

Warning
Setting strong link to false will cause memory leaks if the caller does not manually clean up the associated CYIScriptableObject.

Defaults to false.

std::unique_ptr<CYIScriptableObject> CYIBindingImplementation::TakeUniquePtr ( )

Returns the C++ scriptable object associated with this binding implementation. Calling this function will relinquish ownership of the C++ scriptable object.

Member Data Documentation

CYIBindingContext* CYIBindingImplementation::m_pBindingContext
protected
CYIScriptableObject* CYIBindingImplementation::m_pScriptableObject
protected
std::shared_ptr<CYIScriptableObject> CYIBindingImplementation::m_pScriptableObjectSharedPtr
protected
void* CYIBindingImplementation::m_pScriptObjectPointer
protected
CYIString CYIBindingImplementation::m_TemplateName
protected
CYIString CYIBindingImplementation::m_TemplateNamespace
protected

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