Commit 02679683 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot
Browse files

Merge topic 'associate-check-input'


 Associate operation: check that input is valid before executing.
Acked-by: Kitware Robot's avatarKitware Robot <>
Merge-request: !1309
parents 2e4053f3 61b93f3e
Pipeline #122149 failed with stage
in 0 seconds
......@@ -49,6 +49,8 @@ class SMTKCORE_EXPORT Attribute : public resource::Component
friend class smtk::attribute::RefItem;
static smtk::attribute::AttributePtr New(
const std::string& myName, smtk::attribute::DefinitionPtr myDefinition)
......@@ -17,6 +17,8 @@
#include "smtk/attribute/Resource.h"
#include "smtk/attribute/ResourceItem.h"
#include "smtk/io/Logger.h"
namespace smtk
namespace attribute
......@@ -28,6 +30,28 @@ Associate::Result Associate::operateInternal()
smtk::attribute::Resource::Ptr resource = std::dynamic_pointer_cast<smtk::attribute::Resource>(
// Currently, we cannot specialize associations between resources and
// components. This means an attribute component is allowed as an input. If we
// recieve an attribute component, access its resource.
if (resource == nullptr)
smtk::attribute::Attribute::Ptr attribute =
if (attribute != nullptr)
resource = attribute->attributeResource();
// If we still do not have a valid resource, return with failure.
if (resource == nullptr)
smtkErrorMacro(this->log(), "Could not access attribute resource.");
return this->createResult(smtk::operation::Operation::Outcome::FAILED);
// Access the resource to which we will associate.
auto associateToItem = this->parameters()->findResource("associate to");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment