Commit 68f45eec authored by David Thompson's avatar David Thompson

Add a second "dummy" operation for the attribute system.

This operation is used to signal when attributes (not resources)
are created, or expunged.
parent ad5260a7
......@@ -135,6 +135,7 @@ set(attributeHeaders
operators/Associate.h
operators/Dissociate.h
operators/Read.h
operators/Signal.h
operators/Write.h
)
......@@ -185,6 +186,7 @@ set(attributeSrcs
operators/Associate.cxx
operators/Dissociate.cxx
operators/Read.cxx
operators/Signal.cxx
operators/Write.cxx
)
......@@ -192,6 +194,7 @@ set(attributeSrcs
smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Associate.sbt" defOpXML)
smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Dissociate.sbt" defOpXML)
smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Read.sbt" defOpXML)
smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Signal.sbt" defOpXML)
smtk_operation_xml("${CMAKE_CURRENT_SOURCE_DIR}/operators/Write.sbt" defOpXML)
#install the headers
......
......@@ -16,6 +16,7 @@
#include "smtk/attribute/operators/Associate.h"
#include "smtk/attribute/operators/Dissociate.h"
#include "smtk/attribute/operators/Read.h"
#include "smtk/attribute/operators/Signal.h"
#include "smtk/attribute/operators/Write.h"
#include "smtk/operation/groups/ReaderGroup.h"
......@@ -27,7 +28,7 @@ namespace attribute
{
namespace
{
typedef std::tuple<Associate, Dissociate, Read, Write> OperationList;
typedef std::tuple<Associate, Dissociate, Read, Signal, Write> OperationList;
}
void Registrar::registerTo(const smtk::operation::Manager::Ptr& operationManager)
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#include "smtk/attribute/operators/Signal.h"
#include "smtk/attribute/Signal_xml.h"
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/ComponentItem.h"
#include "smtk/attribute/Resource.h"
#include "smtk/io/Logger.h"
namespace smtk
{
namespace attribute
{
Signal::Result Signal::operateInternal()
{
auto params = this->parameters();
auto result = this->createResult(smtk::operation::Operation::Outcome::SUCCEEDED);
auto modIn = params->findComponent("modified");
auto creIn = params->findComponent("created");
auto expIn = params->findComponent("expunged");
auto modOut = result->findComponent("modified");
auto creOut = result->findComponent("created");
auto expOut = result->findComponent("expunged");
// Copy the inputs to the output.
creOut->setObjectValues(creIn->begin(), creIn->end());
modOut->setObjectValues(modIn->begin(), modIn->end());
expOut->setObjectValues(expIn->begin(), expIn->end());
return result;
}
const char* Signal::xmlDescription() const
{
return Signal_xml;
}
}
}
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//=========================================================================
#ifndef smtk_operation_operators_Signal_h
#define smtk_operation_operators_Signal_h
#include "smtk/operation/XMLOperation.h"
namespace smtk
{
namespace attribute
{
/**\brief A "dummy" operation used to mark an attribute as created, modified, or expunged.
This operation does nothing internally except pass the components
which are associated to itself into its result's "created", "modified",
or "expunged" entries.
*/
class SMTKCORE_EXPORT Signal : public smtk::operation::XMLOperation
{
public:
smtkTypeMacro(smtk::attribute::Signal);
smtkCreateMacro(Signal);
smtkSharedFromThisMacro(smtk::operation::Operation);
smtkSuperclassMacro(smtk::operation::XMLOperation);
protected:
Result operateInternal() override;
void generateSummary(Operation::Result&) override {}
virtual const char* xmlDescription() const override;
};
}
}
#endif // smtk_operation_operators_Signal_h
<?xml version="1.0" encoding="utf-8" ?>
<!-- Description of the "associate" Operation -->
<SMTK_AttributeResource Version="3">
<Definitions>
<!-- Operation -->
<include href="smtk/operation/Operation.xml"/>
<AttDef Type="mark modified"
Label="Resource - Mark as Modified" BaseType="operation">
<BriefDescription>
Mark the specified components as created, modified, or expunged.
</BriefDescription>
<ItemDefinitions>
<Component Name="created" Extensible="true" NumberOfRequiredValues="0">
<Accepts><Resource Name="smtk::attribute::Resource" Filter="*"/></Accepts>
</Component>
<Component Name="modified" Extensible="true" NumberOfRequiredValues="0">
<Accepts><Resource Name="smtk::attribute::Resource" Filter="*"/></Accepts>
</Component>
<Component Name="expunged" Extensible="true" NumberOfRequiredValues="0">
<Accepts><Resource Name="smtk::attribute::Resource" Filter="*"/></Accepts>
</Component>
</ItemDefinitions>
</AttDef>
<!-- Result -->
<include href="smtk/operation/Result.xml"/>
<AttDef Type="result(mark modified)" BaseType="result"/>
</Definitions>
</SMTK_AttributeResource>
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