From af598abc04fdd15d93ed59f5bc46024d920b3de7 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Mon, 20 Dec 2021 21:13:57 -0500 Subject: [PATCH] add class-level GTSAM_EXPORT --- gtsam/discrete/DecisionTree.h | 4 +++- gtsam/discrete/DiscreteKey.h | 16 ++++++++-------- gtsam/discrete/DiscreteMarginals.h | 2 +- gtsam/discrete/Potentials.h | 12 ++++++------ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gtsam/discrete/DecisionTree.h b/gtsam/discrete/DecisionTree.h index 0ee0b8be0..0491f3e4d 100644 --- a/gtsam/discrete/DecisionTree.h +++ b/gtsam/discrete/DecisionTree.h @@ -19,6 +19,8 @@ #pragma once +#include + #include #include @@ -35,7 +37,7 @@ namespace gtsam { * Y = function range (any algebra), e.g., bool, int, double */ template - class DecisionTree { + class GTSAM_EXPORT DecisionTree { public: diff --git a/gtsam/discrete/DiscreteKey.h b/gtsam/discrete/DiscreteKey.h index 3462166f4..86f1bcf63 100644 --- a/gtsam/discrete/DiscreteKey.h +++ b/gtsam/discrete/DiscreteKey.h @@ -34,32 +34,32 @@ namespace gtsam { using DiscreteKey = std::pair; /// DiscreteKeys is a set of keys that can be assembled using the & operator - struct DiscreteKeys: public std::vector { + struct GTSAM_EXPORT DiscreteKeys: public std::vector { // Forward all constructors. using std::vector::vector; /// Constructor for serialization - GTSAM_EXPORT DiscreteKeys() : std::vector::vector() {} + DiscreteKeys() : std::vector::vector() {} /// Construct from a key - GTSAM_EXPORT DiscreteKeys(const DiscreteKey& key) { + DiscreteKeys(const DiscreteKey& key) { push_back(key); } /// Construct from a vector of keys - GTSAM_EXPORT DiscreteKeys(const std::vector& keys) : + DiscreteKeys(const std::vector& keys) : std::vector(keys) { } /// Construct from cardinalities with default names - GTSAM_EXPORT DiscreteKeys(const std::vector& cs); + DiscreteKeys(const std::vector& cs); /// Return a vector of indices - GTSAM_EXPORT KeyVector indices() const; + KeyVector indices() const; /// Return a map from index to cardinality - GTSAM_EXPORT std::map cardinalities() const; + std::map cardinalities() const; /// Add a key (non-const!) DiscreteKeys& operator&(const DiscreteKey& key) { @@ -69,5 +69,5 @@ namespace gtsam { }; // DiscreteKeys /// Create a list from two keys - GTSAM_EXPORT DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2); + DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2); } diff --git a/gtsam/discrete/DiscreteMarginals.h b/gtsam/discrete/DiscreteMarginals.h index b118909bc..27352a211 100644 --- a/gtsam/discrete/DiscreteMarginals.h +++ b/gtsam/discrete/DiscreteMarginals.h @@ -29,7 +29,7 @@ namespace gtsam { /** * A class for computing marginals of variables in a DiscreteFactorGraph */ - class DiscreteMarginals { +class GTSAM_EXPORT DiscreteMarginals { protected: diff --git a/gtsam/discrete/Potentials.h b/gtsam/discrete/Potentials.h index 1078b4c61..856b92816 100644 --- a/gtsam/discrete/Potentials.h +++ b/gtsam/discrete/Potentials.h @@ -29,7 +29,7 @@ namespace gtsam { /** * A base class for both DiscreteFactor and DiscreteConditional */ - class Potentials: public AlgebraicDecisionTree { + class GTSAM_EXPORT Potentials: public AlgebraicDecisionTree { public: @@ -46,7 +46,7 @@ namespace gtsam { } // Safe division for probabilities - GTSAM_EXPORT static double safe_div(const double& a, const double& b); + static double safe_div(const double& a, const double& b); // // Apply either a permutation or a reduction // template @@ -55,10 +55,10 @@ namespace gtsam { public: /** Default constructor for I/O */ - GTSAM_EXPORT Potentials(); + Potentials(); /** Constructor from Indices and ADT */ - GTSAM_EXPORT Potentials(const DiscreteKeys& keys, const ADT& decisionTree); + Potentials(const DiscreteKeys& keys, const ADT& decisionTree); /** Constructor from Indices and (string or doubles) */ template @@ -67,8 +67,8 @@ namespace gtsam { } // Testable - GTSAM_EXPORT bool equals(const Potentials& other, double tol = 1e-9) const; - GTSAM_EXPORT void print(const std::string& s = "Potentials: ", + bool equals(const Potentials& other, double tol = 1e-9) const; + void print(const std::string& s = "Potentials: ", const KeyFormatter& formatter = DefaultKeyFormatter) const; size_t cardinality(Key j) const { return cardinalities_.at(j);}