Skip to content

Commit

Permalink
Overriding the = operation to always do a copy
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffamzn committed Jul 26, 2023
1 parent 64b5316 commit cc9622a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ using namespace chip::app::Clusters::ResourceMonitoring;
using namespace chip::app::Clusters::ResourceMonitoring::Attributes;
using chip::Protocols::InteractionModel::Status;

ImmutableReplacementProductListManager hepaFilterReplacementProductListManager;
static ImmutableReplacementProductListManager sHepaFilterReplacementProductListManager;

//-- Hepa filter Monitoring instance methods
CHIP_ERROR HepaFilterMonitoringInstance::AppInit()
{
ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::Init()");

SetReplacementProductListManagerInstance(&hepaFilterReplacementProductListManager);
SetReplacementProductListManagerInstance(&sHepaFilterReplacementProductListManager);

return CHIP_NO_ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ struct ReplacementProductStruct : private HepaFilterMonitoring::Structs::Replace
SetProductIdentifierValue(aProductIdentifierValue);
}

ReplacementProductStruct & operator=(const ReplacementProductStruct & aReplacementProductStruct)
{
SetProductIdentifierType(aReplacementProductStruct.GetProductIdentifierType());
SetProductIdentifierValue(aReplacementProductStruct.GetProductIdentifierValue());
return *this;
}

using HepaFilterMonitoring::Structs::ReplacementProductStruct::Type::Encode;

/**
Expand Down Expand Up @@ -130,8 +137,8 @@ struct ReplacementProductStruct : private HepaFilterMonitoring::Structs::Replace
return CHIP_NO_ERROR;
}

ProductIdentifierTypeEnum GetProductIdentifierType() { return static_cast<ProductIdentifierTypeEnum>(productIdentifierType); };
chip::CharSpan GetProductIdentifierValue() { return productIdentifierValue; };
ProductIdentifierTypeEnum GetProductIdentifierType() const { return static_cast<ProductIdentifierTypeEnum>(productIdentifierType); };
chip::CharSpan GetProductIdentifierValue() const { return productIdentifierValue; };
};

namespace Attributes {
Expand Down

0 comments on commit cc9622a

Please sign in to comment.