Skip to content

Commit

Permalink
Add operator== for FrameGraphInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
show50726 committed Feb 3, 2025
1 parent afb9987 commit 57502a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/fgviewer/include/fgviewer/FrameGraphInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,25 @@ class FrameGraphInfo {

FrameGraphInfo(FrameGraphInfo const &) = delete;

bool operator==(const FrameGraphInfo& rhs) const;

struct Pass {
Pass(utils::CString name, std::vector<ResourceId> reads,
std::vector<ResourceId> writes);

bool operator==(const Pass& rhs) const;

utils::CString name;
std::vector<ResourceId> reads;
std::vector<ResourceId> writes;
};

struct Resource {
bool operator==(const Resource& rhs) const;

struct Property {
bool operator==(const Property& rhs) const;

utils::CString name;
utils::CString value;
};
Expand Down
18 changes: 18 additions & 0 deletions libs/fgviewer/src/FrameGraphInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,33 @@ FrameGraphInfo::~FrameGraphInfo() = default;

FrameGraphInfo::FrameGraphInfo(FrameGraphInfo&& rhs) noexcept = default;

bool FrameGraphInfo::operator==(const FrameGraphInfo& rhs) const {
return viewName == rhs.viewName
&& passes == rhs.passes
&& resources == rhs.resources;
}

FrameGraphInfo::Pass::Pass(utils::CString name, std::vector<ResourceId> reads,
std::vector<ResourceId> writes): name(std::move(name)),
reads(std::move(reads)),
writes(std::move(writes)) {}

bool FrameGraphInfo::Pass::operator==(const Pass& rhs) const {
return name == rhs.name && reads == rhs.reads && writes == rhs.writes;
}

FrameGraphInfo::Resource::Resource(ResourceId id, utils::CString name,
std::vector<Property> properties): id(id),
name(std::move(name)), properties(std::move(properties)) {}

bool FrameGraphInfo::Resource::operator==(const Resource& rhs) const {
return id == rhs.id && name == rhs.name && properties == rhs.properties;
}

bool FrameGraphInfo::Resource::Property::operator==(const Property &rhs) const {
return name == rhs.name && value == rhs.value;
}

void FrameGraphInfo::setResources(
std::unordered_map<ResourceId, Resource> resources) {
this->resources = std::move(resources);
Expand Down

0 comments on commit 57502a4

Please sign in to comment.