Rhino C++ API  8.14
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
ON_ModelComponentReference Class Reference

ON_ModelComponentReference is a persistent reference to a model component. ON_ModelComponentReference and ON_ModelComponentWeakReference are based on like std::shared_ptr and std::weak_ptr. More...

#include <opennurbs_model_component.h>

Public Member Functions

 ON_ModelComponentReference () ON_NOEXCEPT
 No = default to insure m_sp is completely managed in the opennurbs DLL. More...
 
 ON_ModelComponentReference (const class ON_ModelComponentWeakReference &weak_ref) ON_NOEXCEPT
 
 ON_ModelComponentReference (const ON_ModelComponentReference &) ON_NOEXCEPT
 No = default to insure m_sp is completely managed in the opennurbs DLL. More...
 
 ON_ModelComponentReference (std::shared_ptr< ON_ModelComponent > &sp) ON_NOEXCEPT
 
 ~ON_ModelComponentReference ()
 No = default to insure m_sp is completely managed in the opennurbs DLL. More...
 
void Dump (ON_TextLog &text_log) const
 
class ON_ModelComponentExclusiveModelComponent () const ON_NOEXCEPT
 
bool IsEmpty () const ON_NOEXCEPT
 
const class ON_ModelComponentModelComponent () const ON_NOEXCEPT
 
const ON_UUID ModelComponentId () const ON_NOEXCEPT
 
int ModelComponentIndex () const ON_NOEXCEPT
 
const ON_NameHash ModelComponentNameHash () const ON_NOEXCEPT
 
ON__UINT64 ModelComponentRuntimeSerialNumber () const ON_NOEXCEPT
 
ON_ModelComponentReferenceoperator= (const ON_ModelComponentReference &)
 No = default to insure m_sp is completely managed in the opennurbs DLL. More...
 
ON_ModelComponentReferenceoperator= (const ON_ModelComponentWeakReference &)
 
ON_ModelComponentReferenceoperator= (std::shared_ptr< ON_ModelComponent > &sp)
 
unsigned int ReferenceCount () const ON_NOEXCEPT
 

Static Public Member Functions

static ON_ModelComponentReference CreateConstantSystemComponentReference (const class ON_ModelComponent &constant_system_component) ON_NOEXCEPT
 
static ON_ModelComponentReference CreateForExperts (class ON_ModelComponent *model_component, bool bManagedComponentReference) ON_NOEXCEPT
 

Static Public Attributes

static const ON_ModelComponentReference Empty
 

Friends

class ON_ModelComponentWeakReference
 

Detailed Description

ON_ModelComponentReference is a persistent reference to a model component. ON_ModelComponentReference and ON_ModelComponentWeakReference are based on like std::shared_ptr and std::weak_ptr.

Constructor & Destructor Documentation

◆ ON_ModelComponentReference() [1/4]

ON_ModelComponentReference::ON_ModelComponentReference ( )

No = default to insure m_sp is completely managed in the opennurbs DLL.

No = default to insure m_sp is completely managed in the opennurbs DLL.

◆ ~ON_ModelComponentReference()

ON_ModelComponentReference::~ON_ModelComponentReference ( )

No = default to insure m_sp is completely managed in the opennurbs DLL.

◆ ON_ModelComponentReference() [2/4]

ON_ModelComponentReference::ON_ModelComponentReference ( const ON_ModelComponentReference )

No = default to insure m_sp is completely managed in the opennurbs DLL.

◆ ON_ModelComponentReference() [3/4]

ON_ModelComponentReference::ON_ModelComponentReference ( const class ON_ModelComponentWeakReference weak_ref)

◆ ON_ModelComponentReference() [4/4]

ON_ModelComponentReference::ON_ModelComponentReference ( std::shared_ptr< ON_ModelComponent > &  sp)

Member Function Documentation

◆ CreateConstantSystemComponentReference()

static ON_ModelComponentReference ON_ModelComponentReference::CreateConstantSystemComponentReference ( const class ON_ModelComponent constant_system_component)
static

Parameters: constant_system_component - [in] A constant system component that exists for the duration of the application. Remarks: See ON_ModelComponent::CreateConstantSystemComponentReference() for more information about constant system components.

◆ CreateForExperts()

static ON_ModelComponentReference ON_ModelComponentReference::CreateForExperts ( class ON_ModelComponent model_component,
bool  bManagedComponentReference 
)
static

Parameters: model_component - [in] bManagedComponentReference - [in] true model_component will be deleted by the last ON_ModelComponentReference and must have been created by call to operator new() with heap allocation. false model_component must remain in scope until the last ON_ModelComponentReference is destroyed. Remarks: The input pointer will be managed and deleted by the returned by ON_ModelComponentReference.

◆ Dump()

void ON_ModelComponentReference::Dump ( ON_TextLog text_log) const

◆ ExclusiveModelComponent()

class ON_ModelComponent* ON_ModelComponentReference::ExclusiveModelComponent ( ) const

Return: If this is the only reference to a component, the a pointer to that component is returned. Otherwise, nullptr is returned See Also: ON_ModelGeometryComponent::Attributes() ON_ModelGeometryComponent::Geometry() ON_ModelGeometryComponent::ExclusiveAttributes() ON_ModelGeometryComponent::ExclusiveGeometry(); ON_ModelComponentRef::ExclusiveModelComponent(); ONX_Model::ComponentFromRuntimeSerialNumber() Remarks: If .NET or other wrappers using "lazy garbage collection" memory management are in use, there may be stale references awaiting garbage collection and this function will return nullptr when you think it should not. For this function to work reliably, the ONX_Model and its components and references should be in well constructed C++ code with carefully crafted memory management.

◆ IsEmpty()

bool ON_ModelComponentReference::IsEmpty ( ) const

◆ ModelComponent()

const class ON_ModelComponent* ON_ModelComponentReference::ModelComponent ( ) const

Return: A pointer to the managed model component or nullptr. See Also: ON_ModelComponentRef::ExclusiveModelComponent();

◆ ModelComponentId()

const ON_UUID ON_ModelComponentReference::ModelComponentId ( ) const

◆ ModelComponentIndex()

int ON_ModelComponentReference::ModelComponentIndex ( ) const

◆ ModelComponentNameHash()

const ON_NameHash ON_ModelComponentReference::ModelComponentNameHash ( ) const

◆ ModelComponentRuntimeSerialNumber()

ON__UINT64 ON_ModelComponentReference::ModelComponentRuntimeSerialNumber ( ) const

◆ operator=() [1/3]

ON_ModelComponentReference& ON_ModelComponentReference::operator= ( const ON_ModelComponentReference )

No = default to insure m_sp is completely managed in the opennurbs DLL.

◆ operator=() [2/3]

ON_ModelComponentReference& ON_ModelComponentReference::operator= ( const ON_ModelComponentWeakReference )

◆ operator=() [3/3]

ON_ModelComponentReference& ON_ModelComponentReference::operator= ( std::shared_ptr< ON_ModelComponent > &  sp)

◆ ReferenceCount()

unsigned int ON_ModelComponentReference::ReferenceCount ( ) const

Friends And Related Function Documentation

◆ ON_ModelComponentWeakReference

friend class ON_ModelComponentWeakReference
friend

Member Data Documentation

◆ Empty

const ON_ModelComponentReference ON_ModelComponentReference::Empty
static