Skip to content

Commit

Permalink
Review update
Browse files Browse the repository at this point in the history
- Rename ElementEquivalenceResults to ElementEquivalenceResultVec
  • Loading branch information
kwokcb committed Oct 5, 2024
1 parent e1f6e4f commit 7733ec8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions source/MaterialXCore/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ bool Element::operator!=(const Element& rhs) const
}

bool Element::isEquivalent(ConstElementPtr rhs, const ElementEquivalenceOptions& options,
ElementEquivalenceResults* result) const
ElementEquivalenceResultVec* result) const
{
if (getName() != rhs->getName())
{
Expand Down Expand Up @@ -178,7 +178,7 @@ bool Element::isEquivalent(ConstElementPtr rhs, const ElementEquivalenceOptions&
}

bool Element::isAttributeEquivalent(ConstElementPtr rhs, const string& attributeName,
const ElementEquivalenceOptions& /*options*/, ElementEquivalenceResults* result) const
const ElementEquivalenceOptions& /*options*/, ElementEquivalenceResultVec* result) const
{
if (getAttribute(attributeName) != rhs->getAttribute(attributeName))
{
Expand Down Expand Up @@ -591,7 +591,7 @@ TypeDefPtr TypedElement::getTypeDef() const
//

bool ValueElement::isAttributeEquivalent(ConstElementPtr rhs, const string& attributeName,
const ElementEquivalenceOptions& options, ElementEquivalenceResults* result) const
const ElementEquivalenceOptions& options, ElementEquivalenceResultVec* result) const
{
// Perform value comparisons
//
Expand Down
8 changes: 4 additions & 4 deletions source/MaterialXCore/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ using ElementPredicate = std::function<bool(ConstElementPtr)>;

class ElementEquivalenceOptions;
class ElementEquivalenceResult;
using ElementEquivalenceResults = std::vector<ElementEquivalenceResult>;
using ElementEquivalenceResultVec = std::vector<ElementEquivalenceResult>;

/// @class Element
/// The base class for MaterialX elements.
Expand Down Expand Up @@ -122,7 +122,7 @@ class MX_CORE_API Element : public std::enable_shared_from_this<Element>
/// @param result Results of comparison if argument is specified.
/// @return True if the elements are equivalent. False otherwise.
bool isEquivalent(ConstElementPtr rhs, const ElementEquivalenceOptions& options,
ElementEquivalenceResults* result = nullptr) const;
ElementEquivalenceResultVec* result = nullptr) const;

/// Return true if the attribute on a given element is equivalent
/// based on the equivalence criteria provided.
Expand All @@ -133,7 +133,7 @@ class MX_CORE_API Element : public std::enable_shared_from_this<Element>
/// @return True if the attribute on the elements are equivalent. False otherwise.
virtual bool isAttributeEquivalent(ConstElementPtr rhs, const string& attributeName,
const ElementEquivalenceOptions& options,
ElementEquivalenceResults* result = nullptr) const;
ElementEquivalenceResultVec* result = nullptr) const;

/// @}
/// @name Category
Expand Down Expand Up @@ -1032,7 +1032,7 @@ class MX_CORE_API ValueElement : public TypedElement
/// @return True if the attribute on the elements are equivalent. False otherwise.
bool isAttributeEquivalent(ConstElementPtr rhs, const string& attributeName,
const ElementEquivalenceOptions& options,
ElementEquivalenceResults* result = nullptr) const override;
ElementEquivalenceResultVec* result = nullptr) const override;

/// @}
/// @name Value String
Expand Down
4 changes: 2 additions & 2 deletions source/MaterialXTest/MaterialXCore/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TEST_CASE("Document", "[document]")
REQUIRE(doc->validate());
}

void printDifferences(mx::ElementEquivalenceResults& results, const std::string& label)
void printDifferences(mx::ElementEquivalenceResultVec& results, const std::string& label)
{
for (size_t i=0; i<results.size(); ++i)
{
Expand Down Expand Up @@ -216,7 +216,7 @@ TEST_CASE("Document equivalence", "[document]")
}

mx::ElementEquivalenceOptions options;
mx::ElementEquivalenceResults results;
mx::ElementEquivalenceResultVec results;

// Check skipping all value compares
options.skipValueComparisons = true;
Expand Down
4 changes: 2 additions & 2 deletions source/PyMaterialX/PyMaterialXCore/PyElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ void bindPyElement(py::module& mod)
.def(py::self != py::self)
.def("isEquivalent", [](const mx::Element& elem, mx::ConstElementPtr& rhs, const mx::ElementEquivalenceOptions& options)
{
mx::ElementEquivalenceResults results;
mx::ElementEquivalenceResultVec results;
bool res = elem.isEquivalent(rhs, options, &results);
return std::pair<bool, mx::ElementEquivalenceResults>(res, results);
return std::pair<bool, mx::ElementEquivalenceResultVec>(res, results);
})
.def("", &mx::Element::isEquivalent,
py::arg("rhs"), py::arg("options"), py::arg("result") = nullptr)
Expand Down

0 comments on commit 7733ec8

Please sign in to comment.