SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
The ResourceLinks class is a resource-specific API for manipulating unidirectional links from a Resource and its Components to other Resources and Components. More...
#include <ResourceLinks.h>
Public Types | |
typedef smtk::common::Links< smtk::common::UUID, smtk::common::UUID, smtk::common::UUID, int, ResourceLinkBase > | ResourceLinkData |
typedef ResourceLinkData::Link | Link |
![]() | |
typedef std::pair< smtk::common::UUID, smtk::common::UUID > | Key |
A Key is a pair of UUIDs. More... | |
typedef int | RoleType |
Public Member Functions | |
ResourceLinkData & | data () |
Access the underlying link data. | |
const ResourceLinkData & | data () const |
bool | resolve (const ResourcePtr &) const |
Resolve any surrogates with the given resource. More... | |
bool | removeAllLinksTo (const ResourcePtr &) |
Remove all links from this resource to another resource. More... | |
void | copyFrom (const ConstResourcePtr &source, const smtk::resource::CopyOptions &options) |
Copy links from source's links with the given options. More... | |
![]() | |
virtual | ~Links ()=default |
Force this class to be polymorphic. | |
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 |
Friends | |
class | smtk::resource::Resource |
Additional Inherited Members | |
![]() | |
static constexpr RoleType | topLevelRole () |
static constexpr RoleType | invalidRole () |
![]() | |
static constexpr RoleType | TopLevelRole = std::numeric_limits<Links::RoleType>::lowest() |
A special role used to link pairs of resources together. More... | |
static constexpr RoleType | InvalidRole = std::numeric_limits<Links::RoleType>::lowest() + 1 |
A special Role indicating that a link is invalid. | |
![]() | |
virtual const smtk::common::UUID & | leftHandSideComponentId () const |
Key | addLinkTo (Resource *lhs1, const smtk::common::UUID &lhs2, const ResourcePtr &rhs1, const smtk::common::UUID &rhs2, const RoleType &role) |
This is protected so that ResourceLinks::copyLinks() can call it. More... | |
The ResourceLinks class is a resource-specific API for manipulating unidirectional links from a Resource and its Components to other Resources and Components.
Internally, the storage structure for links is an smtk::common::Links instance describing links between resources, and each link in this structure is an smtk::common::Links instance describing links between components.
void smtk::resource::detail::ResourceLinks::copyFrom | ( | const ConstResourcePtr & | source, |
const smtk::resource::CopyOptions & | options | ||
) |
Copy links from source's links with the given options.
This will copy both resource and component links as options indicates. Both resources and components are mapped through the options' object-mapping, so any links to objects that are also being copied will point to the copy and not the original object in source.
bool smtk::resource::detail::ResourceLinks::removeAllLinksTo | ( | const ResourcePtr & | resource | ) |
Remove all links from this resource to another resource.
This is useful when we know the resource parameter is being permanently deleted.
bool smtk::resource::detail::ResourceLinks::resolve | ( | const ResourcePtr & | resource | ) | const |
Resolve any surrogates with the given resource.
Returns true if a surrogate is successfully resolved.