SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Friends | List of all members
smtk::resource::Component Class Referenceabstract

Component is the base class for records stored in an smtk::resource::Resource. More...

#include <Component.h>

Inheritance diagram for smtk::resource::Component:
[legend]
Collaboration diagram for smtk::resource::Component:
[legend]

Public Types

typedef std::function< void(const ComponentPtr &)> Visitor
 
typedef detail::ComponentLinks Links
 
typedef detail::ComponentProperties Properties
 

Public Member Functions

 smtkTypeMacro (smtk::resource::Component)
 
 smtkSuperclassMacro (smtk::resource::PersistentObject)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
virtual const ResourcePtr resource () const =0
 Components are required to return their owning resource (if any). More...
 
virtual ResourceparentResource () const
 Return a raw (not shared) pointer to the resource that owns this component. More...
 
Linkslinks () override
 Return the links that connect this component to external resources/components.
 
const Linkslinks () const override
 
Propertiesproperties () override
 Return properties defined on this component.
 
const Propertiesproperties () const override
 
- Public Member Functions inherited from smtk::resource::PersistentObject
 smtkTypeMacroBase (smtk::resource::PersistentObject)
 
virtual const common::UUIDid () const =0
 Return a unique identifier for the object which will be persistent across sessions.
 
virtual bool setId (const common::UUID &myID)=0
 Assign an ID to this object (used by readers; not for arbitrary reuse). More...
 
virtual std::string name () const
 Return the name of the object - by default it will return the UUID but that can be overridden.
 
template<typename T >
T::Ptr as ()
 Attempt to cast this object to a subclass.
 
template<typename T >
T::ConstPtr as () const
 Attempt to cast this object to a subclass.
 

Friends

class Resource
 

Detailed Description

Component is the base class for records stored in an smtk::resource::Resource.

Components are contained inside a parent resource. Because they are written to and read from the resource's location, their scope for persistence is shared with the resource; SMTK does not provide a way to persist individual components, only resources.

A component in one resource may be linked to an external resource or to components in an external resource using Links. This allows one resource to annotate another.

Components may themselves be annotated with Properties, which are freeform storage owned by their parent resource.

Attributes, mesh sets, and model entities all inherit from this class.

Member Function Documentation

◆ parentResource()

virtual Resource* smtk::resource::Component::parentResource ( ) const
inlinevirtual

Return a raw (not shared) pointer to the resource that owns this component.

This method provides a slow default implementation that simply converts the shared pointer, but component subclasses can usually implement a fast version if they use smtk::common::CachedWeakPointer to hold a reference to their parent.

Reimplemented in smtk::graph::Component.

◆ resource()

virtual const ResourcePtr smtk::resource::Component::resource ( ) const
pure virtual

Components are required to return their owning resource (if any).

Components may not have an owning resource at some points in their lifecycle, so be sure to verify the returned value is non-null.

Implemented in smtk::attribute::Attribute, smtk::graph::Component, smtk::model::Entity, and smtk::mesh::Component.


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