SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
smtk::graph::Component Class Reference

Graph Component represents a node in the graph resource. More...

#include <Component.h>

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

Public Member Functions

 smtkTypeMacro (smtk::graph::Component)
 
 smtkSuperclassMacro (smtk::resource::Component)
 
const smtk::resource::ResourcePtr resource () const override
 Access the containing resource.
 
smtk::resource::ResourceparentResource () const override
 Return a raw (not shared) pointer to the resource that owns this component. More...
 
const smtk::common::UUIDid () const override
 Access the component's id.
 
bool setId (const smtk::common::UUID &uid) override
 Set the component's id.
 
template<typename ArcType >
ArcEndpointInterface< ArcType, ConstArc, OutgoingArcoutgoing () const
 Return an endpoint-interface object for arcs of ArcType outgoing from this node. More...
 
template<typename ArcType >
ArcEndpointInterface< ArcType, NonConstArc, OutgoingArcoutgoing ()
 
template<typename ArcType >
ArcEndpointInterface< ArcType, ConstArc, IncomingArcincoming () const
 Return an endpoint-interface object for arcs of ArcType incoming to this node. More...
 
template<typename ArcType >
ArcEndpointInterface< ArcType, NonConstArc, IncomingArcincoming ()
 
bool disconnect (bool onlyExplicit=false)
 Remove all (editable) arcs from this node. More...
 
RuntimeArcEndpoint< NonConstArcoutgoing (smtk::string::Token arcType)
 Given a runtime arc type-name, return a runtime endpoint interface. More...
 
RuntimeArcEndpoint< ConstArcoutgoing (smtk::string::Token arcType) const
 
RuntimeArcEndpoint< NonConstArcincoming (smtk::string::Token arcType)
 
RuntimeArcEndpoint< ConstArcincoming (smtk::string::Token arcType) const
 
- Public Member Functions inherited from smtk::resource::Component
 smtkTypeMacro (smtk::resource::Component)
 
 smtkSuperclassMacro (smtk::resource::PersistentObject)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
template<typename ResourceType >
ResourceType * parentResourceAs () const
 This variant of parentResource casts the result to the given ResourceType.
 
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 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.
 

Protected Member Functions

 Component (const std::shared_ptr< smtk::graph::ResourceBase > &)
 
 Component (const std::shared_ptr< smtk::graph::ResourceBase > &, const smtk::common::UUID &)
 
const ArcImplementationBasearcsOfType (smtk::string::Token arcType) const
 
ArcImplementationBasearcsOfType (smtk::string::Token arcType)
 
virtual void createDependentArcs ()
 

Protected Attributes

smtk::WeakReferenceWrapper< smtk::graph::ResourceBasem_resource
 
smtk::common::UUID m_id
 

Friends

template<typename GraphTraits >
class Resource
 

Additional Inherited Members

- Public Types inherited from smtk::resource::Component
typedef std::function< void(const ComponentPtr &)> Visitor
 
typedef detail::ComponentLinks Links
 
typedef detail::ComponentProperties Properties
 

Detailed Description

Graph Component represents a node in the graph resource.

Internally, all of the nodes and graphs that comprise a resource are stored internally within the resource itself. The API presented in Component is a forwarding API, designed to redirect arc queries through the resource. As a result, graph components themselves are extremely lightweight and contain a full API for accessing their connections.

Member Function Documentation

◆ disconnect()

bool smtk::graph::Component::disconnect ( bool  onlyExplicit = false)

Remove all (editable) arcs from this node.

Note that implicit arcs which do not provide a disconnect method will not be removed.

This method is used by the Delete operation to ensure that nodes do not leave dangling references to removed nodes.

◆ incoming()

template<typename ArcType >
ArcEndpointInterface<ArcType, ConstArc, IncomingArc> smtk::graph::Component::incoming ( ) const
inline

Return an endpoint-interface object for arcs of ArcType incoming to this node.

These methods will throw a std::logic_error if ArcType arcs may not arrive into nodes of this type.

It would be preferable to prevent compilation, but the base graph-component class can not have access to the resource's traits object.

◆ outgoing() [1/2]

template<typename ArcType >
ArcEndpointInterface<ArcType, ConstArc, OutgoingArc> smtk::graph::Component::outgoing ( ) const
inline

Return an endpoint-interface object for arcs of ArcType outgoing from this node.

These methods will throw a std::logic_error if ArcType arcs may not originate from nodes of this type.

It would be preferable to prevent compilation, but the base graph-component class can not have access to the resource's traits object.

◆ outgoing() [2/2]

RuntimeArcEndpoint< NonConstArc > smtk::graph::Component::outgoing ( smtk::string::Token  arcType)

Given a runtime arc type-name, return a runtime endpoint interface.

If the arc type does not exist or this component has no such endpoints, this method will return an invalid endpoint interface.

◆ parentResource()

smtk::resource::Resource * smtk::graph::Component::parentResource ( ) const
overridevirtual

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 from smtk::resource::Component.


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