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

Links is a virtual class describing the API for connecting one resource/component to another resource/component. More...

#include <Links.h>

Inheritance diagram for smtk::resource::Links:
[legend]

Public Types

typedef std::pair< smtk::common::UUID, smtk::common::UUIDKey
 A Key is a pair of UUIDs. More...
 
typedef int RoleType
 

Public Member Functions

bool isLinkedTo (const ResourcePtr &, const RoleType &) const
 Given a resource or component and a role, check if a link of this role type exists between us and the input object.
 
bool isLinkedTo (const ComponentPtr &, const RoleType &) const
 
Key addLinkTo (const ResourcePtr &, const RoleType &)
 Given a resource or component and a role type, construct a link from us to the input object and assign the link a random UUID. More...
 
Key addLinkTo (const ComponentPtr &, const RoleType &)
 
PersistentObjectSet linkedTo (const RoleType &) const
 Given a role, return a set of objects to which this object links.
 
PersistentObjectSet linkedFrom (const ResourcePtr &, const RoleType &) const
 Given a role and a resource corresponding to the rhs of a link, return a set of objects from the rhs that link to this object using this role type.
 
PersistentObjectSet linkedFrom (const RoleType &) const
 Given a role, return a set of objects that link to this object using this role type. More...
 
bool removeLink (const Key &)
 Given a Link key, remove the associated link. Return true if successful.
 
bool removeLinksTo (const ResourcePtr &, const RoleType &)
 Given a resource or component and a role, remove all links from this object and the input object of this role type. More...
 
bool removeLinksTo (const ComponentPtr &, const RoleType &)
 
std::pair< PersistentObjectPtr, RoleType > linkedObjectAndRole (const Key &) const
 Given a Link key, return the object and role to which this object is linked, or return nullptr if no link exists with this link id.
 
PersistentObjectPtr linkedObject (const Key &key) const
 
std::pair< smtk::common::UUID, RoleType > linkedObjectIdAndRole (const Key &) const
 Given a Link key, return the id and role to which this object is linked, or return a null id if no link exists with this link id. More...
 
smtk::common::UUID linkedObjectId (const Key &key) const
 
LinkInformation linkedObjectInformation (const Key &key) const
 

Protected Member Functions

virtual ResourceleftHandSideResource ()=0
 
virtual const ResourceleftHandSideResource () const =0
 
virtual const smtk::common::UUIDleftHandSideComponentId () const
 

Detailed Description

Links is a virtual class describing the API for connecting one resource/component to another resource/component.

Member Typedef Documentation

◆ Key

A Key is a pair of UUIDs.

the First UUID is the id of the resource link, and the second one is the id of the component link.

Member Function Documentation

◆ addLinkTo()

Links::Key smtk::resource::Links::addLinkTo ( const ResourcePtr rhs1,
const RoleType &  role 
)

Given a resource or component and a role type, construct a link from us to the input object and assign the link a random UUID.

Return a key that uniquely identifies the link if successfull, or return a key comprised of a pair of null UUIDs if the link construction failed.

◆ linkedFrom()

PersistentObjectSet smtk::resource::Links::linkedFrom ( const RoleType &  role) const

Given a role, return a set of objects that link to this object using this role type.

Because links are unidirectional, this method queries every resource managed by the accessible manager (the one managing lhs1) and queries their links for links to this object. If the resource associated with this link object is not managed, this method returns an empty set.

◆ linkedObjectIdAndRole()

std::pair< smtk::common::UUID, Links::RoleType > smtk::resource::Links::linkedObjectIdAndRole ( const Key key) const

Given a Link key, return the id and role to which this object is linked, or return a null id if no link exists with this link id.

This method is similar to linkedObjectAndRole() but does not require the link to successfully resolve to return a non-null value.

◆ removeLinksTo()

bool smtk::resource::Links::removeLinksTo ( const ResourcePtr rhs1,
const RoleType &  role 
)

Given a resource or component and a role, remove all links from this object and the input object of this role type.

Return true if successful.


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