Skip to content

Commit

Permalink
implement dummy >> operator
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Oct 9, 2024
1 parent 4d707e7 commit 93ec276
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions gtsam/hybrid/HybridGaussianProductFactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,10 @@ HybridGaussianProductFactor HybridGaussianProductFactor::removeEmpty() const {
return {Base(*this, emptyGaussian)};
}

/* *******************************************************************************/
std::istream& operator>>(std::istream& is, GaussianFactorGraphValuePair& pair) {
// Dummy, don't do anything
return is;
}

} // namespace gtsam
20 changes: 12 additions & 8 deletions gtsam/hybrid/HybridGaussianProductFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include <gtsam/inference/Key.h>
#include <gtsam/linear/GaussianFactorGraph.h>

#include <iostream>

namespace gtsam {

class HybridGaussianFactor;
Expand Down Expand Up @@ -55,14 +57,6 @@ class GTSAM_EXPORT HybridGaussianProductFactor
*/
HybridGaussianProductFactor(Base&& tree) : Base(std::move(tree)) {}

/// Deleted constructor since we don't have istream operator for
/// GaussianFactorGraphValuePair
HybridGaussianProductFactor(const std::vector<DiscreteKey>& labelCs,
const std::string& table) {
throw std::runtime_error(
"HybridGaussianProductFactor: No way to construct.");
}

///@}

/// @name Operators
Expand Down Expand Up @@ -140,4 +134,14 @@ template <>
struct traits<HybridGaussianProductFactor>
: public Testable<HybridGaussianProductFactor> {};

/**
* Create a dummy overload of >> for GaussianFactorGraphValuePair
* so that HybridGaussianProductFactor compiles
* with the constructor
* `DecisionTree(const std::vector<LabelC>& labelCs, const std::string& table)`.
*
* Needed to compile on Windows.
*/
std::istream& operator>>(std::istream& is, GaussianFactorGraphValuePair& pair);

} // namespace gtsam

0 comments on commit 93ec276

Please sign in to comment.