MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / equals

Method equals

src/OpenColorIO/DynamicProperty.cpp:69–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69bool DynamicPropertyImpl::equals(const DynamicPropertyImpl & rhs) const
70{
71 if (this == &rhs) return true;
72
73 if (m_isDynamic == rhs.m_isDynamic && m_type == rhs.m_type)
74 {
75 if (!m_isDynamic)
76 {
77 // Both not dynamic, same value or not.
78 switch (getType())
79 {
80 case DYNAMIC_PROPERTY_CONTRAST:
81 case DYNAMIC_PROPERTY_EXPOSURE:
82 case DYNAMIC_PROPERTY_GAMMA:
83 {
84 auto lhst = dynamic_cast<const DynamicPropertyDouble *>(this);
85 auto rhst = dynamic_cast<const DynamicPropertyDouble *>(&rhs);
86 return lhst && rhst && (lhst->getValue() == rhst->getValue());
87 }
88 case DYNAMIC_PROPERTY_GRADING_PRIMARY:
89 {
90 auto lhst = dynamic_cast<const DynamicPropertyGradingPrimary *>(this);
91 auto rhst = dynamic_cast<const DynamicPropertyGradingPrimary *>(&rhs);
92 return lhst && rhst && (lhst->getValue() == rhst->getValue());
93 }
94 case DYNAMIC_PROPERTY_GRADING_RGBCURVE:
95 {
96 auto lhst = dynamic_cast<const DynamicPropertyGradingRGBCurve *>(this);
97 auto rhst = dynamic_cast<const DynamicPropertyGradingRGBCurve *>(&rhs);
98 return lhst && rhst && (*lhst->getValue() == *rhst->getValue());
99 }
100 case DYNAMIC_PROPERTY_GRADING_TONE:
101 {
102 auto lhst = dynamic_cast<const DynamicPropertyGradingTone *>(this);
103 auto rhst = dynamic_cast<const DynamicPropertyGradingTone *>(&rhs);
104 return lhst && rhst && (lhst->getValue() == rhst->getValue());
105 }
106 case DYNAMIC_PROPERTY_GRADING_HUECURVE:
107 {
108 auto lhst = dynamic_cast<const DynamicPropertyGradingHueCurve *>(this);
109 auto rhst = dynamic_cast<const DynamicPropertyGradingHueCurve *>(&rhs);
110 return lhst && rhst && (*lhst->getValue() == *rhst->getValue());}
111 }
112 // Different values.
113 return false;
114 }
115 else
116 {
117 // Both dynamic, may not be same (this is used for processor optimization do not
118 // assume they will always have same values even if it is currently the case).
119 return false;
120 }
121 }
122
123 // One dynamic, not the other or different types.
124 return false;
125}
126

Callers 1

operator==Function · 0.45

Calls 2

getTypeFunction · 0.85
getValueMethod · 0.45

Tested by

no test coverage detected