SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
Links is a virtual class describing the API for connecting one resource/component to another resource/component. More...
#include <Links.h>
Public Types | |
typedef std::pair< smtk::common::UUID, smtk::common::UUID > | Key |
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 Resource * | leftHandSideResource ()=0 |
virtual const Resource * | leftHandSideResource () const =0 |
virtual const smtk::common::UUID & | leftHandSideComponentId () const |
Links is a virtual class describing the API for connecting one resource/component to another resource/component.
typedef std::pair<smtk::common::UUID, smtk::common::UUID> smtk::resource::Links::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.
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.
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.
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.
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.