Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix operator==() for C++20 #528

Merged
merged 117 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
21e2b67
latest from coda-oss (#390)
Dec 29, 2020
825a667
latest from coda-oss and nitro (#391)
Dec 30, 2020
f283be3
update coda-oss with latest from https://github.com/mdaus/coda-oss
Jan 9, 2021
ae630e6
update externals/nitro/docs
Jan 9, 2021
0b99300
latest from "nitro"
Jan 9, 2021
db45e1e
Revert "latest from "nitro""
Jan 11, 2021
e89da71
latest from nitro/master
Jan 11, 2021
3adb502
ignore build/ directory
Jan 11, 2021
89522fe
Revert "latest from nitro/master"
Jan 11, 2021
e82f28c
update externals/nitro/docs
Jan 11, 2021
8fe3028
update "c", "java", "mex", and "python" directories -- but not "c++"
Jan 11, 2021
b3c1dbd
update other nitro top-level files ... everything except modules/c++
Jan 11, 2021
a398eef
VCXPROJ files from nitro
Jan 11, 2021
7a9b240
several changes from nitro/c++ ... hoping this builds.
Jan 11, 2021
a688092
fix build error on Linux
Jan 11, 2021
84db123
more changes from nitro/modules/c++
Jan 11, 2021
7aba3b8
fix IOStreamWriter ctor
Jan 11, 2021
d9a5c2f
more changes from nitro/modules/c++
Jan 11, 2021
5e5870f
paths are wrong when in "externals"
Jan 11, 2021
7b8ca70
remove externals/nitro/docs
Jan 11, 2021
92d5bb5
Merge branch 'develop/update_externals' of github.com:ngageoint/six-l…
Jan 11, 2021
e6a58a2
slam in "main"
Jan 12, 2021
65026c2
latest from coda-oss/main
Jan 12, 2021
99a0a01
adjust coda-oss for our usage
Jan 12, 2021
4e6a752
latest from nitro/main
Jan 12, 2021
1bd0cb3
std::span removed from "nitro"
Jan 12, 2021
fa19905
need to redo C++17
Jan 12, 2021
120ee00
fix missing #include file
Jan 13, 2021
da30b96
remove "nitro" files not needed in externals/nitro
Jan 13, 2021
dd710d5
paths are wrong in "externals"
Jan 13, 2021
e69391b
Revert "remove "nitro" files not needed in externals/nitro"
Jan 13, 2021
436986f
Revert "Revert "remove "nitro" files not needed in externals/nitro""
Jan 13, 2021
ebe9550
slam in externals as merging creates too many conflicts
Jan 13, 2021
4e23991
Merge branch 'develop/update_externals' into main
Jan 13, 2021
6de2fa0
merge brought back a deleted #include
Jan 13, 2021
1073b39
add back "java" and "mex"
Jan 16, 2021
6fca258
lates from coda-oss/main
Jan 16, 2021
1083ac1
latest from "nitro"
Jan 16, 2021
e21d4fc
paths are wrong in "externals"
Jan 16, 2021
9e21803
need to redo C++17 support
Jan 16, 2021
c10f233
std::span -> gsl::span
Jan 16, 2021
f897082
Merge branch 'master' into develop/update_externals
Jan 19, 2021
fa0a138
Revert "std::span -> gsl::span"
Jan 19, 2021
b856b54
latest from coda-oss and nitro
Jan 19, 2021
70a3e72
these are the correct files from "master"
Jan 19, 2021
8242847
gsl::span -> std::span
Jan 19, 2021
0ec8633
get #includes right for PCH
Jan 19, 2021
460a96b
didn't want this change
Jan 19, 2021
671a89a
trigger build on GitHub
Jan 19, 2021
bd7d9f7
#include <nitf/coda-oss.hpp> instead of sys/Conf.h to get stuff added…
Jan 19, 2021
0ecff95
remove files that shouldn't have been committed
Jan 19, 2021
a015595
Merge branch 'develop/update_externals' into develop/use_c++11
Jan 19, 2021
160f01e
#define CODA_OSS_AUGMENT_std_namespace before #include <sys/Conf.h>
Jan 20, 2021
df90a44
Merge branch 'master' into develop/use_c++11
Jan 20, 2021
fb5176c
#include <scene/sys_Conf.h> rather than <nitf/coda-oss.hpp>
Jan 20, 2021
b7413c6
do a better job of being sure we have additional stuff in "std" from …
Jan 20, 2021
e76c365
no auto_ptr in C++17
Jan 25, 2021
7bb1bb4
Merge branch 'master' into develop/use_c++11
Jan 25, 2021
652dadf
no std::auto_ptr in C++17
Jan 25, 2021
09450c2
Merge branch 'master' into develop/use_c++11
Jan 26, 2021
4bcd2a7
Merge branch 'develop/use_c++11' of github.com:ngageoint/six-library …
Jan 27, 2021
67b41f9
Merge branch 'master' into develop/use_c++11
Jan 27, 2021
afaf4d4
mem::auto_ptr instead of std::auto_ptr for C++17
Jan 27, 2021
0892e19
fix a few more errors with building with C++17
Jan 27, 2021
d165f62
Merge branch 'master' into develop/use_c++11
Feb 1, 2021
d0cf3be
Merge branch 'develop/use_c++11' of github.com:ngageoint/six-library …
Feb 1, 2021
91f6c48
std::auto_ptr -> mem::auto_ptr for C++17
Feb 1, 2021
7eb4f3f
Merge branch 'master' into develop/use_c++11
Feb 9, 2021
7bc8624
Merge branch 'master' into develop/use_c++11
Feb 10, 2021
a0ec957
old compilers don't like certain kinds of braced-initialization
Feb 10, 2021
b72de0b
Merge branch 'master' into develop/use_c++11
Feb 15, 2021
809f998
Merge branch 'master' into develop/use_c++11
Feb 15, 2021
555055e
Merge branch 'master' into develop/use_c++11
Feb 15, 2021
87623bb
Merge branch 'master' into develop/use_c++11
Feb 17, 2021
6d69985
turn off some CA diagnostics from other code
Feb 17, 2021
8954395
Merge branch 'develop/use_c++11' of github.com:ngageoint/six-library …
Feb 20, 2021
ce0db35
Merge branch 'master' into develop/use_c++11
Nov 2, 2021
49048ae
reduce use of explicit "new" and pointers in CPHDReader
Nov 2, 2021
dbc48b8
another "version" -> "strVersion"; added unit-test
Nov 2, 2021
75ea632
version -> strVersion to avoid conflicting with global "version"
Nov 2, 2021
e7938bc
reduce use of explicit "new"
Nov 2, 2021
8fdb3e3
use std::make_unique() instead of explicit "new"
Nov 3, 2021
5787a69
use a std::unique_ptr for storing an "owned" logger
Nov 3, 2021
3c74dbd
new Logger class to more easily manage logging configuration
Nov 3, 2021
f18fbe4
use new Logger class to reduce boiler-plate code
Nov 3, 2021
82db8c1
use the new six::Logger class to reduce boilerplate logger code
Nov 3, 2021
b9368a9
more use of six::Logger to manage logging
Nov 3, 2021
905f7f5
more use of six::Logger to reduce boilerplate code
Nov 3, 2021
396b4fa
simplify six::Logger
Nov 3, 2021
11e66dc
fix G++ compiler errors
Nov 3, 2021
f8ab35d
switch remaining code to new six::Logger infrastructure
Nov 3, 2021
da788ab
build Logger.cpp w/CMake
Nov 3, 2021
dce2a7d
reduce use of explicit "new"
Nov 4, 2021
9edba14
sys::Uint32_T -> uint32_t
Nov 4, 2021
e341b8e
mem::ScopedArray<T> -> std::unique_ptr<T[]>
Nov 4, 2021
a80a715
fix another ICC compiler error (from high-side)
Nov 5, 2021
060305b
Merge branch 'master' into develop/use_c++11
Nov 9, 2021
a4cc072
Merge branch 'master' into develop/use_c++11
Nov 16, 2021
f11fefe
Merge branch 'master' into develop/use_c++11
Dec 29, 2021
970c404
tweak operator==() for C++20
Dec 29, 2021
9d25049
remove unittest output
Dec 29, 2021
5d1a468
Squashed commit of the following:
Jan 3, 2022
a3bab5e
Squashed commit of the following:
Jan 3, 2022
6296ddb
operaror_equals() -> operator_eq() in case ne/le/ge/lt/gt are ever ne…
Jan 3, 2022
5198b00
"C++" -> "c++"
Jan 3, 2022
1533cf6
Merge branch 'master' into develop/use_c++11
Jan 3, 2022
c88f67c
Merge branch 'master' into develop/use_c++11
Jan 3, 2022
84e87e0
Merge branch 'master' into develop/use_c++11
Jan 7, 2022
b48fd9f
fix more operator==() for C++20
Jan 7, 2022
feebf47
more fixing of operator==() for C++20
Jan 7, 2022
bb2c2b4
Squashed commit of the following:
Jan 10, 2022
59e1dfb
Squashed commit of the following:
Jan 10, 2022
fbf7114
Squashed commit of the following:
Jan 10, 2022
3025549
Squashed commit of the following:
Jan 10, 2022
a191ef8
Merge branch 'master' into develop/use_c++11
Jan 10, 2022
e9bad1b
slam-in changes from "master"
Jan 10, 2022
e0aa53a
need operator==() as member-function for SWIG
Jan 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions six/modules/c++/six.sicd/include/six/sicd/ComplexClassification.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ namespace sicd
* \class ComplexClassification
* \brief The implementation of Classification for complex products
*/
class ComplexClassification: public Classification
struct ComplexClassification: public Classification
{
public:
virtual std::string getLevel() const
std::string getLevel() const override
{
return level;
}
Expand All @@ -46,22 +45,26 @@ class ComplexClassification: public Classification
return os;
}

bool operator==(const ComplexClassification& rhs) const
{
return (level == rhs.getLevel() &&
fileOptions == rhs.fileOptions);
}

//! This is spelled out (i.e. 'UNCLASSIFIED')
std::string level;

bool operator==(const ComplexClassification& rhs) const // need member-function for SWIG
{
return static_cast<const Classification&>(*this) == static_cast<const Classification&>(rhs);
}

private:
virtual bool equalTo(const Classification& rhs) const override
bool operator_eq(const ComplexClassification& rhs) const
{
return (level == rhs.getLevel() &&
fileOptions == rhs.fileOptions);
}
bool equalTo(const Classification& rhs) const override
{
const ComplexClassification* classification = dynamic_cast<const ComplexClassification*>(&rhs);
auto classification = dynamic_cast<const ComplexClassification*>(&rhs);
if (classification != nullptr)
{
return *this == *classification;
return this->operator_eq(*classification);
}
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions six/modules/c++/six.sicd/include/six/sicd/ComplexData.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ struct ComplexData: public Data
return six::getImageMode(collectionInformation->radarMode);
}

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

/*
* Check that class members are consistent with each other
*
Expand All @@ -370,8 +368,13 @@ struct ComplexData: public Data
*/
void fillDefaultFields();

bool operator==(const ComplexData& rhs) const // need member-function for SWIG
{
return static_cast<const Data&>(*this) == static_cast<const Data&>(rhs);
}
private:
virtual bool equalTo(const Data& rhs) const override;
bool operator_eq(const ComplexData& rhs) const;
bool equalTo(const Data& rhs) const override;

/*
* Classification contains the classification level (stored in
Expand Down
6 changes: 3 additions & 3 deletions six/modules/c++/six.sicd/source/ComplexData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ ComplexData::pixelToImagePoint(const types::RowCol<double>& pixelLoc) const
return imagePt;
}

bool ComplexData::operator==(const ComplexData& rhs) const
bool ComplexData::operator_eq(const ComplexData& rhs) const
{
return (collectionInformation == rhs.collectionInformation &&
imageCreation == rhs.imageCreation &&
Expand All @@ -134,10 +134,10 @@ bool ComplexData::operator==(const ComplexData& rhs) const

bool ComplexData::equalTo(const Data& rhs) const
{
const ComplexData* data = dynamic_cast<const ComplexData*>(&rhs);
auto data = dynamic_cast<const ComplexData*>(&rhs);
if (data != nullptr)
{
return *this == *data;
return this->operator_eq(*data);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ namespace sidd
*
* Compiler-generated copy constructor and assignment operator are sufficient
*/
class DerivedClassification: public Classification
struct DerivedClassification: public Classification
{
public:
virtual std::string getLevel() const
std::string getLevel() const override
{
return classification;
}
Expand Down Expand Up @@ -233,12 +232,15 @@ class DerivedClassification: public Classification
// that type of data in this document.
BooleanType externalNotice;

bool operator==(const DerivedClassification& rhs) const // need member-function for SWIG
{
return static_cast<const Classification&>(*this) == static_cast<const Classification&>(rhs);
}
private:
//! Equality operator
bool operator==(const DerivedClassification& rhs) const;
bool operator_eq(const DerivedClassification& rhs) const;
bool equalTo(const Classification& rhs) const override;


private:
virtual bool equalTo(const Classification& rhs) const override;
static
void putImpl(const std::string& name,
const std::vector<std::string>& strs,
Expand Down
9 changes: 6 additions & 3 deletions six/modules/c++/six.sidd/include/six/sidd/DerivedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,14 @@ struct DerivedData: public Data
types::RowCol<double>
pixelToImagePoint(const types::RowCol<double>& pixelLoc) const;

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

bool operator==(const DerivedData& rhs) const // need member-function for SWIG
{
return static_cast<const Data&>(*this) == static_cast<const Data&>(rhs);
}
private:
bool operator_eq(const DerivedData& rhs) const;
static const char VENDOR_ID[];
virtual bool equalTo(const Data& rhs) const override;
bool equalTo(const Data& rhs) const override;
std::string mVersion;
};
}
Expand Down
37 changes: 22 additions & 15 deletions six/modules/c++/six.sidd/include/six/sidd/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,16 @@ struct Remap

virtual Remap* clone() const = 0;

bool operator==(const Remap& rhs)
{
return this->equalTo(rhs);
}

bool operator!=(const Remap& rhs)
{
return !(*this == rhs);
}

virtual bool equalTo(const Remap& rhs) const = 0;

};
inline bool operator==(const Remap& lhs, const Remap& rhs)
{
return lhs.equalTo(rhs) && rhs.equalTo(lhs);
}
inline bool operator!=(const Remap& lhs, const Remap& rhs)
{
return !(lhs == rhs);
}

/*!
* \struct MonochromeDisplayRemap
Expand Down Expand Up @@ -114,8 +111,13 @@ struct MonochromeDisplayRemap : public Remap
//! Remap parameters
ParameterCollection remapParameters;

virtual bool equalTo(const Remap& rhs) const;
virtual bool operator==(const MonochromeDisplayRemap& rhs) const;
bool equalTo(const Remap& rhs) const override;
bool operator==(const MonochromeDisplayRemap& rhs) const // need member-function for SWIG
{
return static_cast<const Remap&>(*this) == static_cast<const Remap&>(rhs);
}
private:
bool operator_eq(const MonochromeDisplayRemap& rhs) const;
};

/*!
Expand All @@ -140,8 +142,13 @@ struct ColorDisplayRemap : public Remap
return new ColorDisplayRemap(*this);
}

virtual bool equalTo(const Remap& rhs) const;
virtual bool operator==(const ColorDisplayRemap& rhs) const;
bool equalTo(const Remap& rhs) const override;
bool operator==(const ColorDisplayRemap& rhs) const // need member-function for SWIG
{
return static_cast<const Remap&>(*this) == static_cast<const Remap&>(rhs);
}
private:
bool operator_eq(const ColorDisplayRemap& rhs) const;
};

/*!
Expand Down
76 changes: 44 additions & 32 deletions six/modules/c++/six.sidd/include/six/sidd/Measurement.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,26 +79,22 @@ struct Projection
ProjectionType projectionType;
ReferencePoint referencePoint;

virtual ~Projection() {}

friend bool operator==(const Projection& lhs, const Projection& rhs)
{
return lhs.equalTo(rhs);
}

friend bool operator!=(const Projection& lhs, const Projection& rhs)
{
return !(lhs == rhs);
}
virtual ~Projection() = default;

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

private:
virtual bool equalTo(const Projection& rhs) const = 0;

};
inline bool operator==(const Projection& lhs, const Projection& rhs)
{
return lhs.equalTo(rhs) && rhs.equalTo(lhs);
}
inline bool operator!=(const Projection& lhs, const Projection& rhs)
{
return !(lhs == rhs);
}

/*!
* \struct PolynomialProjection
Expand All @@ -115,7 +111,7 @@ struct PolynomialProjection : public Projection
this->projectionType = ProjectionType::POLYNOMIAL;
}

virtual ~PolynomialProjection() {}
virtual ~PolynomialProjection() = default;

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

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

bool operator==(const PolynomialProjection& rhs) const // need member-function for SWIG
{
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
}
private:
virtual bool equalTo(const Projection& rhs) const override;
bool operator_eq(const PolynomialProjection& rhs) const;
bool equalTo(const Projection& rhs) const override;
};

/*!
Expand All @@ -154,7 +153,7 @@ struct PolynomialProjection : public Projection
*/
struct MeasurableProjection : public Projection
{
virtual ~MeasurableProjection() {}
virtual ~MeasurableProjection() = default;

RowColDouble sampleSpacing;

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

bool isMeasurable() const { return true; }

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

bool operator_eq(const MeasurableProjection& rhs) const;
bool operator==(const MeasurableProjection& rhs) const // need member-function for SWIG
{
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
}
private:
virtual bool equalTo(const Projection& rhs) const override;
bool equalTo(const Projection& rhs) const override;
};

/*!
Expand All @@ -179,7 +181,6 @@ struct MeasurableProjection : public Projection
*/
struct GeographicProjection : public MeasurableProjection
{

//! Initialize base class projection type
GeographicProjection()
{
Expand All @@ -191,10 +192,15 @@ struct GeographicProjection : public MeasurableProjection
{
return new GeographicProjection(*this);
}
virtual ~GeographicProjection() {}
virtual ~GeographicProjection() = default;

bool operator==(const GeographicProjection& rhs) const // need member-function for SWIG
{
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
}
private:
virtual bool equalTo(const Projection& rhs) const override;
bool operator_eq(const GeographicProjection& rhs) const;
bool equalTo(const Projection& rhs) const override;
};

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

virtual ~CylindricalProjection() {}
virtual ~CylindricalProjection() = default;

/*!
* Define a copy operator
Expand All @@ -236,10 +242,13 @@ struct CylindricalProjection : public MeasurableProjection
*/
double curvatureRadius;

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

bool operator==(const CylindricalProjection& rhs) const // need member-function for SWIG
{
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
}
private:
virtual bool equalTo(const Projection& rhs) const override;
bool operator_eq(const CylindricalProjection& rhs) const;
bool equalTo(const Projection& rhs) const override;
};

/*!
Expand All @@ -257,7 +266,7 @@ struct PlaneProjection : public MeasurableProjection
this->projectionType = ProjectionType::PLANE;
}

virtual ~PlaneProjection() {}
virtual ~PlaneProjection() = default;

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

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

bool operator==(const PlaneProjection& rhs) const // need member-function for SWIG
{
return static_cast<const Projection&>(*this) == static_cast<const Projection&>(rhs);
}
private:
virtual bool equalTo(const Projection& rhs) const override;
bool operator_eq(const PlaneProjection& rhs) const;
bool equalTo(const Projection& rhs) const override;
};

/*!
Expand Down
Loading