SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Graph Component represents a node in the graph resource. More...
#include <Component.h>
Public Member Functions | |
smtkTypeMacro (smtk::graph::Component) | |
smtkSuperclassMacro (smtk::resource::Component) | |
const smtk::resource::ResourcePtr | resource () const override |
Access the containing resource. | |
smtk::resource::Resource * | parentResource () const override |
Return a raw (not shared) pointer to the resource that owns this component. More... | |
const smtk::common::UUID & | id () 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, OutgoingArc > | outgoing () const |
Return an endpoint-interface object for arcs of ArcType outgoing from this node. More... | |
template<typename ArcType > | |
ArcEndpointInterface< ArcType, NonConstArc, OutgoingArc > | outgoing () |
template<typename ArcType > | |
ArcEndpointInterface< ArcType, ConstArc, IncomingArc > | incoming () const |
Return an endpoint-interface object for arcs of ArcType incoming to this node. More... | |
template<typename ArcType > | |
ArcEndpointInterface< ArcType, NonConstArc, IncomingArc > | incoming () |
bool | disconnect (bool onlyExplicit=false) |
Remove all (editable) arcs from this node. More... | |
RuntimeArcEndpoint< NonConstArc > | outgoing (smtk::string::Token arcType) |
Given a runtime arc type-name, return a runtime endpoint interface. More... | |
RuntimeArcEndpoint< ConstArc > | outgoing (smtk::string::Token arcType) const |
RuntimeArcEndpoint< NonConstArc > | incoming (smtk::string::Token arcType) |
RuntimeArcEndpoint< ConstArc > | incoming (smtk::string::Token arcType) const |
virtual bool | assign (const ConstPtr &source, smtk::resource::CopyOptions &options) |
Assign state data from the source node to this instance. More... | |
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. | |
Links & | links () override |
Return the links that connect this component to external resources/components. | |
const Links & | links () const override |
Properties & | properties () override |
Return properties defined on this component. | |
const Properties & | properties () 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 ArcImplementationBase * | arcsOfType (smtk::string::Token arcType) const |
ArcImplementationBase * | arcsOfType (smtk::string::Token arcType) |
virtual void | createDependentArcs () |
Protected Attributes | |
smtk::WeakReferenceWrapper< smtk::graph::ResourceBase > | m_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 |
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.
|
virtual |
Assign state data from the source node to this instance.
This method is only intended to be called from a graph resource's copyInitialize() method to assign node state from the source. At the time this is called, options will have a mapping from every node in source's parent resource to every node in this node's parent resource.
The order in which assign() is invoked on nodes is not specified, so you may not rely on other nodes having their state set properly.
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.
|
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.
|
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.
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.
|
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.