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

View File

@ -34,32 +34,32 @@ namespace gtsam {
using DiscreteKey = std::pair<Key,size_t>;
/// 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.
using std::vector<DiscreteKey>::vector;
/// Constructor for serialization
GTSAM_EXPORT DiscreteKeys() : std::vector<DiscreteKey>::vector() {}
DiscreteKeys() : std::vector<DiscreteKey>::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<DiscreteKey>& keys) :
DiscreteKeys(const std::vector<DiscreteKey>& keys) :
std::vector<DiscreteKey>(keys) {
}
/// 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
GTSAM_EXPORT KeyVector indices() const;
KeyVector indices() const;
/// 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!)
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);
}

View File

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

View File

@ -29,7 +29,7 @@ namespace gtsam {
/**
* A base class for both DiscreteFactor and DiscreteConditional
*/
class Potentials: public AlgebraicDecisionTree<Key> {
class GTSAM_EXPORT Potentials: public AlgebraicDecisionTree<Key> {
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<class P>
@ -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<class SOURCE>
@ -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);}