remove virtual from overridden methods, add virtual destructors to appease compiler

release/4.3a0
Varun Agrawal 2021-04-30 12:58:52 -04:00
parent 4d6eef2c2f
commit 6c3aca8cac
17 changed files with 54 additions and 23 deletions

View File

@ -55,6 +55,9 @@ namespace gtsam {
template<class DERIVEDCONDITIONAL> template<class DERIVEDCONDITIONAL>
DiscreteBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {} DiscreteBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {}
/// Destructor
virtual ~DiscreteBayesNet() {}
/// @} /// @}
/// @name Testable /// @name Testable

View File

@ -78,7 +78,7 @@ public:
virtual bool equals(const DiscreteFactor& lf, double tol = 1e-9) const = 0; virtual bool equals(const DiscreteFactor& lf, double tol = 1e-9) const = 0;
/// print /// print
virtual void print( void print(
const std::string& s = "DiscreteFactor\n", const std::string& s = "DiscreteFactor\n",
const KeyFormatter& formatter = DefaultKeyFormatter) const override { const KeyFormatter& formatter = DefaultKeyFormatter) const override {
Base::print(s, formatter); Base::print(s, formatter);

View File

@ -91,6 +91,9 @@ public:
template<class DERIVEDFACTOR> template<class DERIVEDFACTOR>
DiscreteFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {} DiscreteFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {}
/// Destructor
virtual ~DiscreteFactorGraph() {}
/// @name Testable /// @name Testable
/// @{ /// @{

View File

@ -55,6 +55,9 @@ namespace gtsam {
template<class DERIVEDCONDITIONAL> template<class DERIVEDCONDITIONAL>
GaussianBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {} GaussianBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {}
/// Destructor
virtual ~GaussianBayesNet() {}
/// @} /// @}
/// @name Testable /// @name Testable
@ -178,7 +181,7 @@ namespace gtsam {
VectorValues backSubstituteTranspose(const VectorValues& gx) const; VectorValues backSubstituteTranspose(const VectorValues& gx) const;
/// print graph /// print graph
virtual void print( void print(
const std::string& s = "", const std::string& s = "",
const KeyFormatter& formatter = DefaultKeyFormatter) const override { const KeyFormatter& formatter = DefaultKeyFormatter) const override {
Base::print(s, formatter); Base::print(s, formatter);

View File

@ -56,7 +56,7 @@ namespace gtsam {
// Implementing Testable interface // Implementing Testable interface
/// print /// print
virtual void print( void print(
const std::string& s = "", const std::string& s = "",
const KeyFormatter& formatter = DefaultKeyFormatter) const override = 0; const KeyFormatter& formatter = DefaultKeyFormatter) const override = 0;

View File

@ -44,9 +44,9 @@ struct GTSAM_EXPORT PreconditionerParameters {
inline Kernel kernel() const { return kernel_; } inline Kernel kernel() const { return kernel_; }
inline Verbosity verbosity() const { return verbosity_; } inline Verbosity verbosity() const { return verbosity_; }
void print() const ; void print() const;
virtual void print(std::ostream &os) const ; virtual void print(std::ostream &os) const;
static Kernel kernelTranslator(const std::string &s); static Kernel kernelTranslator(const std::string &s);
static Verbosity verbosityTranslator(const std::string &s); static Verbosity verbosityTranslator(const std::string &s);

View File

@ -70,9 +70,8 @@ public:
/// @{ /// @{
/** print */ /** print */
virtual void print( void print(const std::string& s = "", const KeyFormatter& keyFormatter =
const std::string& s = "", DefaultKeyFormatter) const override;
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override;
/** Check if two factors are equal */ /** Check if two factors are equal */
virtual bool equals(const NonlinearFactor& f, double tol = 1e-9) const; virtual bool equals(const NonlinearFactor& f, double tol = 1e-9) const;

View File

@ -98,6 +98,9 @@ namespace gtsam {
template<class DERIVEDFACTOR> template<class DERIVEDFACTOR>
NonlinearFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {} NonlinearFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {}
/// Destructor
virtual ~NonlinearFactorGraph() {}
/** print */ /** print */
void print( void print(
const std::string& str = "NonlinearFactorGraph: ", const std::string& str = "NonlinearFactorGraph: ",

View File

@ -52,6 +52,9 @@ private:
measured_(measured), measured_(measured),
noiseModel_(model) {} noiseModel_(model) {}
/// Destructor
virtual ~BinaryMeasurement() {}
/// @name Standard Interface /// @name Standard Interface
/// @{ /// @{

View File

@ -55,6 +55,9 @@ namespace gtsam {
template<class DERIVEDCONDITIONAL> template<class DERIVEDCONDITIONAL>
SymbolicBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {} SymbolicBayesNet(const FactorGraph<DERIVEDCONDITIONAL>& graph) : Base(graph) {}
/// Destructor
virtual ~SymbolicBayesNet() {}
/// @} /// @}
/// @name Testable /// @name Testable

View File

@ -105,7 +105,7 @@ namespace gtsam {
/// @name Testable /// @name Testable
/** Print with optional formatter */ /** Print with optional formatter */
virtual void print( void print(
const std::string& str = "", const std::string& str = "",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override; const KeyFormatter& keyFormatter = DefaultKeyFormatter) const override;

View File

@ -81,6 +81,9 @@ namespace gtsam {
template<class DERIVEDFACTOR> template<class DERIVEDFACTOR>
SymbolicFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {} SymbolicFactorGraph(const FactorGraph<DERIVEDFACTOR>& graph) : Base(graph) {}
/// Destructor
virtual ~SymbolicFactorGraph() {}
/// @} /// @}
/// @name Testable /// @name Testable

View File

@ -178,8 +178,7 @@ namespace gtsam {
} // buildGraph } // buildGraph
/** print */ /** print */
void Scheduler::print(const string& s) const { void Scheduler::print(const string& s, const KeyFormatter& formatter) const {
cout << s << " Faculty:" << endl; cout << s << " Faculty:" << endl;
for(const string& name: facultyName_) for(const string& name: facultyName_)
cout << name << '\n'; cout << name << '\n';
@ -210,7 +209,7 @@ namespace gtsam {
CSP::print(s + " Factor graph"); CSP::print(s + " Factor graph");
cout << endl; cout << endl;
} // print } // print
/** Print readable form of assignment */ /** Print readable form of assignment */
void Scheduler::printAssignment(sharedValues assignment) const { void Scheduler::printAssignment(sharedValues assignment) const {

View File

@ -66,15 +66,17 @@ namespace gtsam {
/** /**
* Constructor * Constructor
* WE need to know the number of students in advance for ordering keys. * We need to know the number of students in advance for ordering keys.
* then add faculty, slots, areas, availability, students, in that order * then add faculty, slots, areas, availability, students, in that order
*/ */
Scheduler(size_t maxNrStudents):maxNrStudents_(maxNrStudents) { Scheduler(size_t maxNrStudents) : maxNrStudents_(maxNrStudents) {}
}
void addFaculty(const std::string& facultyName) { /// Destructor
facultyIndex_[facultyName] = nrFaculty(); virtual ~Scheduler() {}
facultyName_.push_back(facultyName);
void addFaculty(const std::string& facultyName) {
facultyIndex_[facultyName] = nrFaculty();
facultyName_.push_back(facultyName);
} }
size_t nrFaculty() const { size_t nrFaculty() const {
@ -140,7 +142,9 @@ namespace gtsam {
void buildGraph(size_t mutexBound = 7); void buildGraph(size_t mutexBound = 7);
/** print */ /** print */
void print(const std::string& s = "Scheduler") const; void print(
const std::string& s = "Scheduler",
const KeyFormatter& formatter = DefaultKeyFormatter) const override;
/** Print readable form of assignment */ /** Print readable form of assignment */
void printAssignment(sharedValues assignment) const; void printAssignment(sharedValues assignment) const;

View File

@ -47,7 +47,9 @@ public:
virtual ~ConcurrentFilter() {}; virtual ~ConcurrentFilter() {};
/** Implement a standard 'print' function */ /** Implement a standard 'print' function */
virtual void print(const std::string& s = "Concurrent Filter:\n", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const = 0; virtual void print(
const std::string& s = "Concurrent Filter:\n",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const = 0;
/** Check if two Concurrent Smoothers are equal */ /** Check if two Concurrent Smoothers are equal */
virtual bool equals(const ConcurrentFilter& rhs, double tol = 1e-9) const = 0; virtual bool equals(const ConcurrentFilter& rhs, double tol = 1e-9) const = 0;
@ -107,7 +109,9 @@ public:
virtual ~ConcurrentSmoother() {}; virtual ~ConcurrentSmoother() {};
/** Implement a standard 'print' function */ /** Implement a standard 'print' function */
virtual void print(const std::string& s = "Concurrent Smoother:\n", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const = 0; virtual void print(
const std::string& s = "Concurrent Smoother:\n",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const = 0;
/** Check if two Concurrent Smoothers are equal */ /** Check if two Concurrent Smoothers are equal */
virtual bool equals(const ConcurrentSmoother& rhs, double tol = 1e-9) const = 0; virtual bool equals(const ConcurrentSmoother& rhs, double tol = 1e-9) const = 0;

View File

@ -69,7 +69,9 @@ public:
virtual ~FixedLagSmoother() { } virtual ~FixedLagSmoother() { }
/** Print the factor for debugging and testing (implementing Testable) */ /** Print the factor for debugging and testing (implementing Testable) */
virtual void print(const std::string& s = "FixedLagSmoother:\n", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const; virtual void print(
const std::string& s = "FixedLagSmoother:\n",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
/** Check if two IncrementalFixedLagSmoother Objects are equal */ /** Check if two IncrementalFixedLagSmoother Objects are equal */
virtual bool equals(const FixedLagSmoother& rhs, double tol = 1e-9) const; virtual bool equals(const FixedLagSmoother& rhs, double tol = 1e-9) const;

View File

@ -132,7 +132,9 @@ public:
/** implement functions needed for Testable */ /** implement functions needed for Testable */
/** print */ /** print */
virtual void print(const std::string& s = "EquivInertialNavFactor_GlobalVel_NoBias", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const { virtual void print(
const std::string& s = "EquivInertialNavFactor_GlobalVel_NoBias",
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const {
std::cout << s << "(" std::cout << s << "("
<< keyFormatter(this->key1()) << "," << keyFormatter(this->key1()) << ","
<< keyFormatter(this->key2()) << "," << keyFormatter(this->key2()) << ","