diff --git a/Tools/ComplexFilterGenerator.cpp b/Tools/ComplexFilterGenerator.cpp index c4cf993c27..c5073962d7 100644 --- a/Tools/ComplexFilterGenerator.cpp +++ b/Tools/ComplexFilterGenerator.cpp @@ -1240,7 +1240,7 @@ void GenerateHeaderFile(AbstractFilter* filter, const QString& outputDir, const ptonew << "/* " << filterName << " */\n"; sourceTemplate = sourceTemplate.replace(k_NewIncludeToken, "#include \"" + pluginName + "/Filters/" + filterName + "Filter.hpp\"\n" + k_NewIncludeToken); - sourceTemplate = sourceTemplate.replace(k_SIMPLToComplexToken, "{complex::Uuid::FromString(\"" + prevUuid + "\").value(), complex::FilterTraits<" + filterName + "Filter>::uuid}, // " + filterName + + sourceTemplate = sourceTemplate.replace(k_SIMPLToComplexToken, "{nx::core::Uuid::FromString(\"" + prevUuid + "\").value(), {nx::core::FilterTraits<" + filterName + "Filter>::uuid, &" + filterName + "Filter::FromSIMPLJson}}, // " + filterName + "\n " + k_SIMPLToComplexToken); headerTemplate = headerTemplate.replace(k_FILTER_NAME, filterName + "Filter"); @@ -1347,7 +1347,7 @@ void GenerateAlgorithmFile(AbstractFilter* filter, const QString& outputDir, con else if(origParamClassName == "LinkedBooleanFilterParameter") { // parameterOut << " args.insertOrAssign(" << filterName << "::k_" << propName << "_Key, std::make_any<" << paramType << ">(" << unitTestDefaultValue << "));\n"; - // includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + // includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } else if(origParamClassName == "LinkedChoicesFilterParameter") { @@ -1362,7 +1362,7 @@ void GenerateAlgorithmFile(AbstractFilter* filter, const QString& outputDir, con parameterOut << "/*[x]*/"; } // parameterOut << " args.insertOrAssign(" << filterName << "::k_" << propName << "_Key, std::make_any<" << paramType << ">(" << unitTestDefaultValue << "));\n"; - includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } if(propInclude == "FileSystemPathParameter") @@ -1504,7 +1504,7 @@ void GenerateSourceFile(AbstractFilter* filter, const QString& outputDir, const linkedOut << " params.linkParameters(k_" << propName << "_Key, k_" << linkedProp << "_Key, true);\n"; } } - includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } else if(origParamClassName == "LinkedChoicesFilterParameter") { @@ -1533,7 +1533,7 @@ void GenerateSourceFile(AbstractFilter* filter, const QString& outputDir, const linkedOut << "//TODO: THIS NEEDS TO BE FIXED\n"; } } - includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } else if(origParamClassName == "PreflightUpdatedValueFilterParameter") { @@ -1550,7 +1550,7 @@ void GenerateSourceFile(AbstractFilter* filter, const QString& outputDir, const parameterOut << "/*[x]*/"; } parameterOut << " params.insert(std::make_unique<" << propClass << ">(k_" << propName << "_Key, \"" << propHuman << "\", \"\", " << defaultValue << "));\n"; - includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } if(origParamClassName == "DataArrayCreationFilterParameter") @@ -1558,22 +1558,22 @@ void GenerateSourceFile(AbstractFilter* filter, const QString& outputDir, const actionsOut << " // This block is commented out because it needs some variables to be filled in.\n"; actionsOut << " {\n // auto createArrayAction = std::make_unique(complex::NumericType::FILL_ME_IN, std::vector{NUM_TUPLES_VALUE}, NUM_COMPONENTS, p" << propName << (endsWithValue ? "" : "Value") << ");\n"; - actionsOut << " // resultOutputActions.value().actions.push_back(std::move(createArrayAction));\n }\n"; - includeSet.insert("#include \"complex/Filter/Actions/CreateArrayAction.hpp\"\n"); + actionsOut << " // resultOutputActions.value().appendAction(std::move(createArrayAction));\n }\n"; + includeSet.insert("#include \"simplnx/Filter/Actions/CreateArrayAction.hpp\"\n"); dataArrayCreation++; } else if(origParamClassName == "AttributeMatrixCreationFilterParameter") { actionsOut << " {\n auto createDataGroupAction = std::make_unique(p" << propName << (endsWithValue ? "" : "Value") << ");\n"; - actionsOut << " resultOutputActions.value().actions.push_back(std::move(createDataGroupAction));\n }\n"; - includeSet.insert("#include \"complex/Filter/Actions/CreateDataGroupAction.hpp\"\n"); + actionsOut << " resultOutputActions.value().appendAction(std::move(createDataGroupAction));\n }\n"; + includeSet.insert("#include \"simplnx/Filter/Actions/CreateDataGroupAction.hpp\"\n"); dataArrayCreation++; } else if(origParamClassName == "DataContainerCreationFilterParameter") { actionsOut << " {\n auto createDataGroupAction = std::make_unique(p" << propName << (endsWithValue ? "" : "Value") << ");\n"; - actionsOut << " resultOutputActions.value().actions.push_back(std::move(createDataGroupAction));\n }\n"; - includeSet.insert("#include \"complex/Filter/Actions/CreateDataGroupAction.hpp\"\n"); + actionsOut << " resultOutputActions.value().appendAction(std::move(createDataGroupAction));\n }\n"; + includeSet.insert("#include \"simplnx/Filter/Actions/CreateDataGroupAction.hpp\"\n"); dataArrayCreation++; } @@ -1725,7 +1725,7 @@ void GenerateUnitTestSourceFile(const AbstractFilter::Pointer& filter, const QSt else if(origParamClassName == "LinkedBooleanFilterParameter") { parameterOut << " args.insertOrAssign(" << filterName << "Filter::k_" << propName << "_Key, std::make_any<" << paramType << ">(" << unitTestDefaultValue << "));\n"; - includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } else if(origParamClassName == "LinkedChoicesFilterParameter") { @@ -1740,7 +1740,7 @@ void GenerateUnitTestSourceFile(const AbstractFilter::Pointer& filter, const QSt parameterOut << "/*[x]*/"; } parameterOut << " args.insertOrAssign(" << filterName << "Filter::k_" << propName << "_Key, std::make_any<" << paramType << ">(" << unitTestDefaultValue << "));\n"; - includeOut << "#include \"complex/Parameters/" << propInclude << ".hpp\"\n"; + includeOut << "#include \"simplnx/Parameters/" << propInclude << ".hpp\"\n"; } if(propInclude == "FileSystemPathParameter") diff --git a/Tools/complex_algorithm.cpp.in b/Tools/complex_algorithm.cpp.in index 0d71e507ed..f86b43b2b6 100644 --- a/Tools/complex_algorithm.cpp.in +++ b/Tools/complex_algorithm.cpp.in @@ -1,9 +1,9 @@ #include "@FILTER_NAME@.hpp" -#include "complex/DataStructure/DataArray.hpp" -#include "complex/DataStructure/DataGroup.hpp" +#include "simplnx/DataStructure/DataArray.hpp" +#include "simplnx/DataStructure/DataGroup.hpp" -using namespace complex; +using namespace nx::core; // ----------------------------------------------------------------------------- @FILTER_NAME@::@FILTER_NAME@(DataStructure& dataStructure, const IFilter::MessageHandler& mesgHandler, const std::atomic_bool& shouldCancel, @FILTER_NAME@InputValues* inputValues) @@ -34,7 +34,7 @@ Result<> @FILTER_NAME@::operator()() * GenerateIPFColors is one example * * If you need to determine what kind of array you have (Int32Array, Float32Array, etc) - * look to the ExecuteDataFunction() in complex/Utilities/FilterUtilities.hpp template + * look to the ExecuteDataFunction() in simplnx/Utilities/FilterUtilities.hpp template * function to help with that code. * An Example algorithm class is `CombineAttributeArrays` and `RemoveFlaggedVertices` * diff --git a/Tools/complex_algorithm.hpp.in b/Tools/complex_algorithm.hpp.in index 0376304df0..a0760bf1c4 100644 --- a/Tools/complex_algorithm.hpp.in +++ b/Tools/complex_algorithm.hpp.in @@ -2,16 +2,16 @@ #include "@PLUGIN_NAME@/@PLUGIN_NAME@_export.hpp" -#include "complex/DataStructure/DataPath.hpp" -#include "complex/DataStructure/DataStructure.hpp" -#include "complex/Filter/IFilter.hpp" +#include "simplnx/DataStructure/DataPath.hpp" +#include "simplnx/DataStructure/DataStructure.hpp" +#include "simplnx/Filter/IFilter.hpp" @PARAMETER_INCLUDES@ /** * This is example code to put in the Execute Method of the filter. @EXECUTE_EXAMPLE_CODE@*/ -namespace complex +namespace nx::core { struct @PLUGIN_NAME_UPPER@_EXPORT @FILTER_NAME@InputValues diff --git a/Tools/complex_filter.cpp.in b/Tools/complex_filter.cpp.in index cdf2d8cdda..66189967be 100644 --- a/Tools/complex_filter.cpp.in +++ b/Tools/complex_filter.cpp.in @@ -2,12 +2,12 @@ #include "@PLUGIN_NAME@/Filters/Algorithms/@ALGORITHM_NAME@.hpp" -#include "complex/DataStructure/DataPath.hpp" -#include "complex/Filter/Actions/EmptyAction.hpp" +#include "simplnx/DataStructure/DataPath.hpp" +#include "simplnx/Filter/Actions/EmptyAction.hpp" @PARAMETER_INCLUDES@ -using namespace complex; +using namespace nx::core; -namespace complex +namespace nx::core { //------------------------------------------------------------------------------ std::string @FILTER_NAME@::name() const @@ -92,7 +92,7 @@ IFilter::PreflightResult @FILTER_NAME@::preflightImpl(const DataStructure& dataS // If your filter is making structural changes to the DataStructure then the filter // is going to create OutputActions subclasses that need to be returned. This will // store those actions. - complex::Result resultOutputActions; + nx::core::Result resultOutputActions; // If your filter is going to pass back some `preflight updated values` then this is where you // would create the code to store those values in the appropriate object. Note that we @@ -133,4 +133,29 @@ Result<> @FILTER_NAME@::executeImpl(DataStructure& dataStructure, const Argument return @ALGORITHM_NAME@(dataStructure, messageHandler, shouldCancel, &inputValues)(); } -} // namespace complex + +namespace +{ +namespace SIMPL +{ + @PARAMETER_JSON_CONSTANTS@ +} // namespace SIMPL +} // namespace + + +//------------------------------------------------------------------------------ +Result @FILTER_NAME@::FromSIMPLJson(const nlohmann::json& json) +{ + Arguments args = @FILTER_NAME@().getDefaultArguments(); + + std::vector> results; + + @PARAMETER_JSON_CONVERSION@ + + Result<> conversionResult = MergeResults(std::move(results)); + + return ConvertResultTo(std::move(conversionResult), std::move(args)); +} + + +} // namespace nx::core diff --git a/Tools/complex_filter.hpp.in b/Tools/complex_filter.hpp.in index 66c34b19ac..8733d920f3 100644 --- a/Tools/complex_filter.hpp.in +++ b/Tools/complex_filter.hpp.in @@ -2,10 +2,10 @@ #include "@PLUGIN_NAME@/@PLUGIN_NAME@_export.hpp" -#include "complex/Filter/FilterTraits.hpp" -#include "complex/Filter/IFilter.hpp" +#include "simplnx/Filter/FilterTraits.hpp" +#include "simplnx/Filter/IFilter.hpp" -namespace complex +namespace nx::core { /** * @class @FILTER_NAME@ @@ -25,6 +25,13 @@ public: // Parameter Keys @PARAMETER_KEYS@ + /** + * @brief Reads SIMPL json and converts it simplnx Arguments. + * @param json + * @return Result + */ + static Result FromSIMPLJson(const nlohmann::json& json); + /** * @brief Returns the name of the filter. * @return @@ -92,5 +99,5 @@ protected: }; } // namespace complex -COMPLEX_DEF_FILTER_TRAITS(complex, @FILTER_NAME@, "@UUID@"); +SIMPLNX_DEF_FILTER_TRAITS(nx::core, @FILTER_NAME@, "@UUID@"); /* LEGACY UUID FOR THIS FILTER @OLD_UUID@ */ diff --git a/Tools/unit_test_filter.cpp.in b/Tools/unit_test_filter.cpp.in index a7247d0265..f0923fd803 100644 --- a/Tools/unit_test_filter.cpp.in +++ b/Tools/unit_test_filter.cpp.in @@ -27,7 +27,7 @@ #include "@PLUGIN_NAME@/Filters/@FILTER_NAME@.hpp" #include "@PLUGIN_NAME@/@PLUGIN_NAME@_test_dirs.hpp" -using namespace complex; +using namespace nx::core; TEST_CASE("@PLUGIN_NAME@::@FILTER_NAME@: Valid Filter Execution","[@PLUGIN_NAME@][@FILTER_NAME@][.][UNIMPLEMENTED][!mayfail]") {