11 #ifndef smtk_operation_ArcCreator_h
12 #define smtk_operation_ArcCreator_h
14 #include "smtk/CoreExports.h"
18 #include "smtk/operation/Group.h"
19 #include "smtk/operation/Manager.h"
20 #include "smtk/operation/Operation.h"
21 #include "smtk/operation/SpecificationOps.h"
23 #include "smtk/attribute/Attribute.h"
24 #include "smtk/attribute/ComponentItem.h"
25 #include "smtk/attribute/Definition.h"
26 #include "smtk/attribute/ReferenceItemDefinition.h"
29 #include <unordered_set>
53 static constexpr
const char*
const type_name =
"arcCreator";
55 ArcCreator(std::shared_ptr<smtk::operation::Manager> manager)
56 :
Group(type_name, manager)
57 , m_arcDestinationItemName(manager)
61 std::string arcDestinationItemNameForOperation(
const std::string&
typeName)
const;
62 std::string arcDestinationItemNameForOperation(
const Operation::Index& index)
const;
63 smtk::attribute::ReferenceItemDefinition::Ptr arcDestinationItemDefinitionForOperation(
65 smtk::attribute::ReferenceItemDefinition::Ptr arcDestinationItemDefinitionForOperation(
66 const Operation::Index& index)
const;
68 template<
typename OperationType>
69 bool registerOperation(
70 const std::set<std::string>& arcTypes,
71 const std::string& arcDestinationItemName = s_defaultArcDestinationItemName);
73 bool registerOperation(
74 Operation::Index operationIndex,
75 const std::set<std::string>& arcTypes,
76 const std::string& arcDestinationItemName = s_defaultArcDestinationItemName);
81 std::set<std::string> allArcTypes()
const;
84 std::set<std::pair<std::string, Operation::Index>> allArcCreators()
const;
87 std::unordered_set<Operation::Index> matchingOperations(
96 static constexpr
const char*
const type_name =
"arcDestinationItemName";
99 :
Group(type_name, manager)
105 static const std::string s_defaultArcDestinationItemName;
108 template<
typename OperationType>
109 bool ArcCreator::registerOperation(
110 const std::set<std::string>& arcTypes,
111 const std::string& arcDestinationItemName)
113 Operation::Index index = std::type_index(
typeid(OperationType)).hash_code();
114 return this->registerOperation(index, arcTypes, arcDestinationItemName);
120 #endif // smtk_operation_ArcCreator_h