add class-level GTSAM_EXPORT

release/4.3a0
Varun Agrawal 2021-12-20 21:13:57 -05:00
parent e8e4bea84c
commit af598abc04
4 changed files with 18 additions and 16 deletions

View File

@ -19,6 +19,8 @@
#pragma once #pragma once
#include <gtsam/base/types.h>
#include <gtsam/discrete/Assignment.h> #include <gtsam/discrete/Assignment.h>
#include <boost/function.hpp> #include <boost/function.hpp>
@ -35,7 +37,7 @@ namespace gtsam {
* Y = function range (any algebra), e.g., bool, int, double * Y = function range (any algebra), e.g., bool, int, double
*/ */
template<typename L, typename Y> template<typename L, typename Y>
class DecisionTree { class GTSAM_EXPORT DecisionTree {
public: public:

View File

@ -34,32 +34,32 @@ namespace gtsam {
using DiscreteKey = std::pair<Key,size_t>; using DiscreteKey = std::pair<Key,size_t>;
/// DiscreteKeys is a set of keys that can be assembled using the & operator /// DiscreteKeys is a set of keys that can be assembled using the & operator
struct DiscreteKeys: public std::vector<DiscreteKey> { struct GTSAM_EXPORT DiscreteKeys: public std::vector<DiscreteKey> {
// Forward all constructors. // Forward all constructors.
using std::vector<DiscreteKey>::vector; using std::vector<DiscreteKey>::vector;
/// Constructor for serialization /// Constructor for serialization
GTSAM_EXPORT DiscreteKeys() : std::vector<DiscreteKey>::vector() {} DiscreteKeys() : std::vector<DiscreteKey>::vector() {}
/// Construct from a key /// Construct from a key
GTSAM_EXPORT DiscreteKeys(const DiscreteKey& key) { DiscreteKeys(const DiscreteKey& key) {
push_back(key); push_back(key);
} }
/// Construct from a vector of keys /// Construct from a vector of keys
GTSAM_EXPORT DiscreteKeys(const std::vector<DiscreteKey>& keys) : DiscreteKeys(const std::vector<DiscreteKey>& keys) :
std::vector<DiscreteKey>(keys) { std::vector<DiscreteKey>(keys) {
} }
/// Construct from cardinalities with default names /// Construct from cardinalities with default names
GTSAM_EXPORT DiscreteKeys(const std::vector<int>& cs); DiscreteKeys(const std::vector<int>& cs);
/// Return a vector of indices /// Return a vector of indices
GTSAM_EXPORT KeyVector indices() const; KeyVector indices() const;
/// Return a map from index to cardinality /// Return a map from index to cardinality
GTSAM_EXPORT std::map<Key,size_t> cardinalities() const; std::map<Key,size_t> cardinalities() const;
/// Add a key (non-const!) /// Add a key (non-const!)
DiscreteKeys& operator&(const DiscreteKey& key) { DiscreteKeys& operator&(const DiscreteKey& key) {
@ -69,5 +69,5 @@ namespace gtsam {
}; // DiscreteKeys }; // DiscreteKeys
/// Create a list from two keys /// Create a list from two keys
GTSAM_EXPORT DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2); DiscreteKeys operator&(const DiscreteKey& key1, const DiscreteKey& key2);
} }

View File

@ -29,7 +29,7 @@ namespace gtsam {
/** /**
* A class for computing marginals of variables in a DiscreteFactorGraph * A class for computing marginals of variables in a DiscreteFactorGraph
*/ */
class DiscreteMarginals { class GTSAM_EXPORT DiscreteMarginals {
protected: protected:

View File

@ -29,7 +29,7 @@ namespace gtsam {
/** /**
* A base class for both DiscreteFactor and DiscreteConditional * A base class for both DiscreteFactor and DiscreteConditional
*/ */
class Potentials: public AlgebraicDecisionTree<Key> { class GTSAM_EXPORT Potentials: public AlgebraicDecisionTree<Key> {
public: public:
@ -46,7 +46,7 @@ namespace gtsam {
} }
// Safe division for probabilities // 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 // // Apply either a permutation or a reduction
// template<class P> // template<class P>
@ -55,10 +55,10 @@ namespace gtsam {
public: public:
/** Default constructor for I/O */ /** Default constructor for I/O */
GTSAM_EXPORT Potentials(); Potentials();
/** Constructor from Indices and ADT */ /** 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) */ /** Constructor from Indices and (string or doubles) */
template<class SOURCE> template<class SOURCE>
@ -67,8 +67,8 @@ namespace gtsam {
} }
// Testable // Testable
GTSAM_EXPORT bool equals(const Potentials& other, double tol = 1e-9) const; bool equals(const Potentials& other, double tol = 1e-9) const;
GTSAM_EXPORT void print(const std::string& s = "Potentials: ", void print(const std::string& s = "Potentials: ",
const KeyFormatter& formatter = DefaultKeyFormatter) const; const KeyFormatter& formatter = DefaultKeyFormatter) const;
size_t cardinality(Key j) const { return cardinalities_.at(j);} size_t cardinality(Key j) const { return cardinalities_.at(j);}