Skip to content

Commit 38dbe6d

Browse files
author
Dan Smith
committed
Merge branch 'master' into develop/update-externals
2 parents 74df9ee + a11980f commit 38dbe6d

14 files changed

Lines changed: 201 additions & 140 deletions

File tree

six/modules/c++/six.sicd/include/six/sicd/ComplexClassification.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ namespace sicd
3232
* \class ComplexClassification
3333
* \brief The implementation of Classification for complex products
3434
*/
35-
class ComplexClassification: public Classification
35+
struct ComplexClassification: public Classification
3636
{
37-
public:
38-
virtual std::string getLevel() const
37+
std::string getLevel() const override
3938
{
4039
return level;
4140
}
@@ -46,22 +45,26 @@ class ComplexClassification: public Classification
4645
return os;
4746
}
4847

49-
bool operator==(const ComplexClassification& rhs) const
50-
{
51-
return (level == rhs.getLevel() &&
52-
fileOptions == rhs.fileOptions);
53-
}
54-
5548
//! This is spelled out (i.e. 'UNCLASSIFIED')
5649
std::string level;
5750

51+
bool operator==(const ComplexClassification& rhs) const // need member-function for SWIG
52+
{
53+
return static_cast<const Classification&>(*this) == static_cast<const Classification&>(rhs);
54+
}
55+
5856
private:
59-
virtual bool equalTo(const Classification& rhs) const override
57+
bool operator_eq(const ComplexClassification& rhs) const
58+
{
59+
return (level == rhs.getLevel() &&
60+
fileOptions == rhs.fileOptions);
61+
}
62+
bool equalTo(const Classification& rhs) const override
6063
{
61-
const ComplexClassification* classification = dynamic_cast<const ComplexClassification*>(&rhs);
64+
auto classification = dynamic_cast<const ComplexClassification*>(&rhs);
6265
if (classification != nullptr)
6366
{
64-
return *this == *classification;
67+
return this->operator_eq(*classification);
6568
}
6669
return false;
6770
}

six/modules/c++/six.sicd/include/six/sicd/ComplexData.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,6 @@ struct ComplexData: public Data
347347
return six::getImageMode(collectionInformation->radarMode);
348348
}
349349

350-
bool operator==(const ComplexData& rhs) const;
351-
352350
/*
353351
* Check that class members are consistent with each other
354352
*
@@ -370,8 +368,13 @@ struct ComplexData: public Data
370368
*/
371369
void fillDefaultFields();
372370

371+
bool operator==(const ComplexData& rhs) const // need member-function for SWIG
372+
{
373+
return static_cast<const Data&>(*this) == static_cast<const Data&>(rhs);
374+
}
373375
private:
374-
virtual bool equalTo(const Data& rhs) const override;
376+
bool operator_eq(const ComplexData& rhs) const;
377+
bool equalTo(const Data& rhs) const override;
375378

376379
/*
377380
* Classification contains the classification level (stored in

six/modules/c++/six.sicd/source/ComplexData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ComplexData::pixelToImagePoint(const types::RowCol<double>& pixelLoc) const
111111
return imagePt;
112112
}
113113

114-
bool ComplexData::operator==(const ComplexData& rhs) const
114+
bool ComplexData::operator_eq(const ComplexData& rhs) const
115115
{
116116
return (collectionInformation == rhs.collectionInformation &&
117117
imageCreation == rhs.imageCreation &&
@@ -134,10 +134,10 @@ bool ComplexData::operator==(const ComplexData& rhs) const
134134

135135
bool ComplexData::equalTo(const Data& rhs) const
136136
{
137-
const ComplexData* data = dynamic_cast<const ComplexData*>(&rhs);
137+
auto data = dynamic_cast<const ComplexData*>(&rhs);
138138
if (data != nullptr)
139139
{
140-
return *this == *data;
140+
return this->operator_eq(*data);
141141
}
142142
return false;
143143
}

six/modules/c++/six.sidd/include/six/sidd/DerivedClassification.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ namespace sidd
4242
*
4343
* Compiler-generated copy constructor and assignment operator are sufficient
4444
*/
45-
class DerivedClassification: public Classification
45+
struct DerivedClassification: public Classification
4646
{
47-
public:
48-
virtual std::string getLevel() const
47+
std::string getLevel() const override
4948
{
5049
return classification;
5150
}
@@ -233,12 +232,15 @@ class DerivedClassification: public Classification
233232
// that type of data in this document.
234233
BooleanType externalNotice;
235234

235+
bool operator==(const DerivedClassification& rhs) const // need member-function for SWIG
236+
{
237+
return static_cast<const Classification&>(*this) == static_cast<const Classification&>(rhs);
238+
}
239+
private:
236240
//! Equality operator
237-
bool operator==(const DerivedClassification& rhs) const;
241+
bool operator_eq(const DerivedClassification& rhs) const;
242+
bool equalTo(const Classification& rhs) const override;
238243

239-
240-
private:
241-
virtual bool equalTo(const Classification& rhs) const override;
242244
static
243245
void putImpl(const std::string& name,
244246
const std::vector<std::string>& strs,

six/modules/c++/six.sidd/include/six/sidd/DerivedData.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,14 @@ struct DerivedData: public Data
330330
types::RowCol<double>
331331
pixelToImagePoint(const types::RowCol<double>& pixelLoc) const;
332332

333-
bool operator==(const DerivedData& rhs) const;
334-
333+
bool operator==(const DerivedData& rhs) const // need member-function for SWIG
334+
{
335+
return static_cast<const Data&>(*this) == static_cast<const Data&>(rhs);
336+
}
335337
private:
338+
bool operator_eq(const DerivedData& rhs) const;
336339
static const char VENDOR_ID[];
337-
virtual bool equalTo(const Data& rhs) const override;
340+
bool equalTo(const Data& rhs) const override;
338341
std::string mVersion;
339342
};
340343
}

six/modules/c++/six.sidd/include/six/sidd/Display.h

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,16 @@ struct Remap
6565

6666
virtual Remap* clone() const = 0;
6767

68-
bool operator==(const Remap& rhs)
69-
{
70-
return this->equalTo(rhs);
71-
}
72-
73-
bool operator!=(const Remap& rhs)
74-
{
75-
return !(*this == rhs);
76-
}
77-
7868
virtual bool equalTo(const Remap& rhs) const = 0;
79-
8069
};
70+
inline bool operator==(const Remap& lhs, const Remap& rhs)
71+
{
72+
return lhs.equalTo(rhs) && rhs.equalTo(lhs);
73+
}
74+
inline bool operator!=(const Remap& lhs, const Remap& rhs)
75+
{
76+
return !(lhs == rhs);
77+
}
8178

8279
/*!
8380
* \struct MonochromeDisplayRemap
@@ -114,8 +111,13 @@ struct MonochromeDisplayRemap : public Remap
114111
//! Remap parameters
115112
ParameterCollection remapParameters;
116113

117-
virtual bool equalTo(const Remap& rhs) const;
118-
virtual bool operator==(const MonochromeDisplayRemap& rhs) const;
114+
bool equalTo(const Remap& rhs) const override;
115+
bool operator==(const MonochromeDisplayRemap& rhs) const // need member-function for SWIG
116+
{
117+
return static_cast<const Remap&>(*this) == static_cast<const Remap&>(rhs);
118+
}
119+
private:
120+
bool operator_eq(const MonochromeDisplayRemap& rhs) const;
119121
};
120122

121123
/*!
@@ -140,8 +142,13 @@ struct ColorDisplayRemap : public Remap
140142
return new ColorDisplayRemap(*this);
141143
}
142144

143-
virtual bool equalTo(const Remap& rhs) const;
144-
virtual bool operator==(const ColorDisplayRemap& rhs) const;
145+
bool equalTo(const Remap& rhs) const override;
146+
bool operator==(const ColorDisplayRemap& rhs) const // need member-function for SWIG
147+
{
148+
return static_cast<const Remap&>(*this) == static_cast<const Remap&>(rhs);
149+
}
150+
private:
151+
bool operator_eq(const ColorDisplayRemap& rhs) const;
145152
};
146153

147154
/*!

six/modules/c++/six.sidd/include/six/sidd/Measurement.h

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,22 @@ struct Projection
7979
ProjectionType projectionType;
8080
ReferencePoint referencePoint;
8181

82-
virtual ~Projection() {}
83-
84-
friend bool operator==(const Projection& lhs, const Projection& rhs)
85-
{
86-
return lhs.equalTo(rhs);
87-
}
88-
89-
friend bool operator!=(const Projection& lhs, const Projection& rhs)
90-
{
91-
return !(lhs == rhs);
92-
}
82+
virtual ~Projection() = default;
9383

9484
//! Pure
9585
virtual Projection* clone() const = 0;
9686
virtual bool isMeasurable() const { return false; }
9787

98-
private:
9988
virtual bool equalTo(const Projection& rhs) const = 0;
100-
10189
};
90+
inline bool operator==(const Projection& lhs, const Projection& rhs)
91+
{
92+
return lhs.equalTo(rhs) && rhs.equalTo(lhs);
93+
}
94+
inline bool operator!=(const Projection& lhs, const Projection& rhs)
95+
{
96+
return !(lhs == rhs);
97+
}
10298

10399
/*!
104100
* \struct PolynomialProjection
@@ -115,7 +111,7 @@ struct PolynomialProjection : public Projection
115111
this->projectionType = ProjectionType::POLYNOMIAL;
116112
}
117113

118-
virtual ~PolynomialProjection() {}
114+
virtual ~PolynomialProjection() = default;
119115

120116
/*!
121117
* Define a copy operator
@@ -142,10 +138,13 @@ struct PolynomialProjection : public Projection
142138
//! Find a col in the image associated with a lat-lon
143139
Poly2D latLonToCol;
144140

145-
bool operator==(const PolynomialProjection& rhs) const;
146-
141+
bool operator==(const PolynomialProjection& rhs) const // need member-function for SWIG
142+
{
143+
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
144+
}
147145
private:
148-
virtual bool equalTo(const Projection& rhs) const override;
146+
bool operator_eq(const PolynomialProjection& rhs) const;
147+
bool equalTo(const Projection& rhs) const override;
149148
};
150149

151150
/*!
@@ -154,7 +153,7 @@ struct PolynomialProjection : public Projection
154153
*/
155154
struct MeasurableProjection : public Projection
156155
{
157-
virtual ~MeasurableProjection() {}
156+
virtual ~MeasurableProjection() = default;
158157

159158
RowColDouble sampleSpacing;
160159

@@ -163,10 +162,13 @@ struct MeasurableProjection : public Projection
163162

164163
bool isMeasurable() const { return true; }
165164

166-
bool operator==(const MeasurableProjection& rhs) const;
167-
165+
bool operator_eq(const MeasurableProjection& rhs) const;
166+
bool operator==(const MeasurableProjection& rhs) const // need member-function for SWIG
167+
{
168+
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
169+
}
168170
private:
169-
virtual bool equalTo(const Projection& rhs) const override;
171+
bool equalTo(const Projection& rhs) const override;
170172
};
171173

172174
/*!
@@ -179,7 +181,6 @@ struct MeasurableProjection : public Projection
179181
*/
180182
struct GeographicProjection : public MeasurableProjection
181183
{
182-
183184
//! Initialize base class projection type
184185
GeographicProjection()
185186
{
@@ -191,10 +192,15 @@ struct GeographicProjection : public MeasurableProjection
191192
{
192193
return new GeographicProjection(*this);
193194
}
194-
virtual ~GeographicProjection() {}
195+
virtual ~GeographicProjection() = default;
195196

197+
bool operator==(const GeographicProjection& rhs) const // need member-function for SWIG
198+
{
199+
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
200+
}
196201
private:
197-
virtual bool equalTo(const Projection& rhs) const override;
202+
bool operator_eq(const GeographicProjection& rhs) const;
203+
bool equalTo(const Projection& rhs) const override;
198204
};
199205

200206
/*!
@@ -215,7 +221,7 @@ struct CylindricalProjection : public MeasurableProjection
215221
this->curvatureRadius = Init::undefined<double>();
216222
}
217223

218-
virtual ~CylindricalProjection() {}
224+
virtual ~CylindricalProjection() = default;
219225

220226
/*!
221227
* Define a copy operator
@@ -236,10 +242,13 @@ struct CylindricalProjection : public MeasurableProjection
236242
*/
237243
double curvatureRadius;
238244

239-
bool operator==(const CylindricalProjection& rhs) const;
240-
245+
bool operator==(const CylindricalProjection& rhs) const // need member-function for SWIG
246+
{
247+
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
248+
}
241249
private:
242-
virtual bool equalTo(const Projection& rhs) const override;
250+
bool operator_eq(const CylindricalProjection& rhs) const;
251+
bool equalTo(const Projection& rhs) const override;
243252
};
244253

245254
/*!
@@ -257,7 +266,7 @@ struct PlaneProjection : public MeasurableProjection
257266
this->projectionType = ProjectionType::PLANE;
258267
}
259268

260-
virtual ~PlaneProjection() {}
269+
virtual ~PlaneProjection() = default;
261270

262271
//! Clone operation
263272
virtual Projection* clone() const
@@ -268,10 +277,13 @@ struct PlaneProjection : public MeasurableProjection
268277
//! Product plane definition (defined by a basis)
269278
ProductPlane productPlane;
270279

271-
bool operator==(const PlaneProjection& rhs) const;
272-
280+
bool operator==(const PlaneProjection& rhs) const // need member-function for SWIG
281+
{
282+
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
283+
}
273284
private:
274-
virtual bool equalTo(const Projection& rhs) const override;
285+
bool operator_eq(const PlaneProjection& rhs) const;
286+
bool equalTo(const Projection& rhs) const override;
275287
};
276288

277289
/*!

0 commit comments

Comments
 (0)