Prefer C++11 nullptr

release/4.3a0
Jose Luis Blanco Claraco 2020-04-06 23:31:05 +02:00
parent 5d8c99935c
commit 76b29b78af
No known key found for this signature in database
GPG Key ID: D443304FBD70A641
50 changed files with 92 additions and 92 deletions

View File

@ -117,7 +117,7 @@ int main(int argc, char* argv[]) {
// The output of point() is in boost::optional<Point3>, as sometimes
// the triangulation operation inside smart factor will encounter degeneracy.
boost::optional<Point3> point = smart->point(result);
if (point) // ignore if boost::optional return NULL
if (point) // ignore if boost::optional return nullptr
landmark_result.insert(j, *point);
}
}

View File

@ -114,7 +114,7 @@ int main(int argc, char* argv[]) {
boost::dynamic_pointer_cast<SmartFactor>(graph[j]);
if (smart) {
boost::optional<Point3> point = smart->point(result);
if (point) // ignore if boost::optional return NULL
if (point) // ignore if boost::optional return nullptr
landmark_result.insert(j, *point);
}
}

View File

@ -55,7 +55,7 @@ private:
}
// Private and very dangerous constructor straight from memory
OptionalJacobian(double* data) : map_(NULL) {
OptionalJacobian(double* data) : map_(nullptr) {
if (data) usurp(data);
}
@ -66,25 +66,25 @@ public:
/// Default constructor acts like boost::none
OptionalJacobian() :
map_(NULL) {
map_(nullptr) {
}
/// Constructor that will usurp data of a fixed-size matrix
OptionalJacobian(Jacobian& fixed) :
map_(NULL) {
map_(nullptr) {
usurp(fixed.data());
}
/// Constructor that will usurp data of a fixed-size matrix, pointer version
OptionalJacobian(Jacobian* fixedPtr) :
map_(NULL) {
map_(nullptr) {
if (fixedPtr)
usurp(fixedPtr->data());
}
/// Constructor that will resize a dynamic matrix (unless already correct)
OptionalJacobian(Eigen::MatrixXd& dynamic) :
map_(NULL) {
map_(nullptr) {
dynamic.resize(Rows, Cols); // no malloc if correct size
usurp(dynamic.data());
}
@ -93,12 +93,12 @@ public:
/// Constructor with boost::none just makes empty
OptionalJacobian(boost::none_t /*none*/) :
map_(NULL) {
map_(nullptr) {
}
/// Constructor compatible with old-style derivatives
OptionalJacobian(const boost::optional<Eigen::MatrixXd&> optional) :
map_(NULL) {
map_(nullptr) {
if (optional) {
optional->resize(Rows, Cols);
usurp(optional->data());
@ -110,11 +110,11 @@ public:
/// Constructor that will usurp data of a block expression
/// TODO(frank): unfortunately using a Map makes usurping non-contiguous memory impossible
// template <typename Derived, bool InnerPanel>
// OptionalJacobian(Eigen::Block<Derived,Rows,Cols,InnerPanel> block) : map_(NULL) { ?? }
// OptionalJacobian(Eigen::Block<Derived,Rows,Cols,InnerPanel> block) : map_(nullptr) { ?? }
/// Return true is allocated, false if default constructor was used
operator bool() const {
return map_.data() != NULL;
return map_.data() != nullptr;
}
/// De-reference, like boost optional
@ -173,7 +173,7 @@ public:
/// Default constructor acts like boost::none
OptionalJacobian() :
pointer_(NULL) {
pointer_(nullptr) {
}
/// Construct from pointer to dynamic matrix
@ -186,12 +186,12 @@ public:
/// Constructor with boost::none just makes empty
OptionalJacobian(boost::none_t /*none*/) :
pointer_(NULL) {
pointer_(nullptr) {
}
/// Constructor compatible with old-style derivatives
OptionalJacobian(const boost::optional<Eigen::MatrixXd&> optional) :
pointer_(NULL) {
pointer_(nullptr) {
if (optional) pointer_ = &(*optional);
}
@ -199,7 +199,7 @@ public:
/// Return true is allocated, false if default constructor was used
operator bool() const {
return pointer_!=NULL;
return pointer_!=nullptr;
}
/// De-reference, like boost optional

View File

@ -53,7 +53,7 @@ namespace gtsam {
// Run the post-order visitor
(void) visitorPost(treeNode, *myData);
return NULL;
return nullptr;
}
};
@ -88,7 +88,7 @@ namespace gtsam {
{
// Run the post-order visitor since this task was recycled to run the post-order visitor
(void) visitorPost(treeNode, *myData);
return NULL;
return nullptr;
}
else
{
@ -129,14 +129,14 @@ namespace gtsam {
{
// Run the post-order visitor in this task if we have no children
(void) visitorPost(treeNode, *myData);
return NULL;
return nullptr;
}
}
else
{
// Process this node and its children in this task
processNodeRecursively(treeNode, *myData);
return NULL;
return nullptr;
}
}
}
@ -184,8 +184,8 @@ namespace gtsam {
set_ref_count(1 + (int) roots.size());
// Spawn tasks
spawn_and_wait_for_all(tasks);
// Return NULL
return NULL;
// Return nullptr
return nullptr;
}
};

View File

@ -101,7 +101,7 @@ namespace gtsam {
/** Create a new function splitting on a variable */
template<typename Iterator>
AlgebraicDecisionTree(Iterator begin, Iterator end, const L& label) :
Super(NULL) {
Super(nullptr) {
this->root_ = compose(begin, end, label);
}

View File

@ -71,7 +71,7 @@ namespace gtsam {
for (size_t i = 0; i < factors_.size(); i++) {
std::stringstream ss;
ss << "factor " << i << ": ";
if (factors_[i] != NULL) factors_[i]->print(ss.str(), formatter);
if (factors_[i] != nullptr) factors_[i]->print(ss.str(), formatter);
}
}

View File

@ -183,7 +183,7 @@ TEST (OrientedPlane3, jacobian_retract) {
/* ************************************************************************* */
int main() {
srand(time(NULL));
srand(time(nullptr));
TestResult tr;
return TestRegistry::runAllTests(tr);
}

View File

@ -495,7 +495,7 @@ TEST(actualH, Serialization) {
/* ************************************************************************* */
int main() {
srand(time(NULL));
srand(time(nullptr));
TestResult tr;
return TestRegistry::runAllTests(tr);
}

View File

@ -125,7 +125,7 @@ namespace gtsam {
void BayesTree<CLIQUE>::addClique(const sharedClique& clique, const sharedClique& parent_clique) {
for(Key j: clique->conditional()->frontals())
nodes_[j] = clique;
if (parent_clique != NULL) {
if (parent_clique != nullptr) {
clique->parent_ = parent_clique;
parent_clique->children.push_back(clique);
} else {
@ -430,7 +430,7 @@ namespace gtsam {
template <class CLIQUE>
void BayesTree<CLIQUE>::removePath(sharedClique clique, BayesNetType* bn,
Cliques* orphans) {
// base case is NULL, if so we do nothing and return empties above
// base case is nullptr, if so we do nothing and return empties above
if (clique) {
// remove the clique from orphans in case it has been added earlier
orphans->remove(clique);

View File

@ -55,8 +55,8 @@ bool FactorGraph<FACTOR>::equals(const This& fg, double tol) const {
// check whether the factors are the same, in same order.
for (size_t i = 0; i < factors_.size(); i++) {
sharedFactor f1 = factors_[i], f2 = fg.factors_[i];
if (f1 == NULL && f2 == NULL) continue;
if (f1 == NULL || f2 == NULL) return false;
if (f1 == nullptr && f2 == nullptr) continue;
if (f1 == nullptr || f2 == nullptr) return false;
if (!f1->equals(*f2, tol)) return false;
}
return true;

View File

@ -353,7 +353,7 @@ class FactorGraph {
*/
void resize(size_t size) { factors_.resize(size); }
/** delete factor without re-arranging indexes by inserting a NULL pointer
/** delete factor without re-arranging indexes by inserting a nullptr pointer
*/
void remove(size_t i) { factors_[i].reset(); }

View File

@ -91,7 +91,7 @@ Ordering Ordering::ColamdConstrained(const VariableIndex& variableIndex,
assert((size_t)count == variableIndex.nEntries());
//double* knobs = NULL; /* colamd arg 6: parameters (uses defaults if NULL) */
//double* knobs = nullptr; /* colamd arg 6: parameters (uses defaults if nullptr) */
double knobs[CCOLAMD_KNOBS];
ccolamd_set_defaults(knobs);
knobs[CCOLAMD_DENSE_ROW] = -1;
@ -235,7 +235,7 @@ Ordering Ordering::Metis(const MetisIndex& met) {
int outputError;
outputError = METIS_NodeND(&size, &xadj[0], &adj[0], NULL, NULL, &perm[0],
outputError = METIS_NodeND(&size, &xadj[0], &adj[0], nullptr, nullptr, &perm[0],
&iperm[0]);
Ordering result;

View File

@ -840,7 +840,7 @@ GaussianConditional::shared_ptr JacobianFactor::splitConditional(size_t nrFronta
if (!model_) {
throw std::invalid_argument(
"JacobianFactor::splitConditional cannot be given a NULL noise model");
"JacobianFactor::splitConditional cannot be given a nullptr noise model");
}
if (nrFrontals > size()) {

View File

@ -398,7 +398,7 @@ namespace gtsam {
* @param keys in some order
* @param diemnsions of the variables in same order
* @param m output dimension
* @param model noise model (default NULL)
* @param model noise model (default nullptr)
*/
template<class KEYS, class DIMENSIONS>
JacobianFactor(const KEYS& keys, const DIMENSIONS& dims, DenseIndex m,

View File

@ -153,7 +153,7 @@ void Fair::print(const std::string &s="") const
bool Fair::equals(const Base &expected, double tol) const {
const Fair* p = dynamic_cast<const Fair*> (&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(c_ - p->c_ ) < tol;
}
@ -190,7 +190,7 @@ void Huber::print(const std::string &s="") const {
bool Huber::equals(const Base &expected, double tol) const {
const Huber* p = dynamic_cast<const Huber*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(k_ - p->k_) < tol;
}
@ -223,7 +223,7 @@ void Cauchy::print(const std::string &s="") const {
bool Cauchy::equals(const Base &expected, double tol) const {
const Cauchy* p = dynamic_cast<const Cauchy*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(ksquared_ - p->ksquared_) < tol;
}
@ -266,7 +266,7 @@ void Tukey::print(const std::string &s="") const {
bool Tukey::equals(const Base &expected, double tol) const {
const Tukey* p = dynamic_cast<const Tukey*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(c_ - p->c_) < tol;
}
@ -296,7 +296,7 @@ void Welsch::print(const std::string &s="") const {
bool Welsch::equals(const Base &expected, double tol) const {
const Welsch* p = dynamic_cast<const Welsch*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(c_ - p->c_) < tol;
}
@ -330,7 +330,7 @@ void GemanMcClure::print(const std::string &s="") const {
bool GemanMcClure::equals(const Base &expected, double tol) const {
const GemanMcClure* p = dynamic_cast<const GemanMcClure*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(c_ - p->c_) < tol;
}
@ -372,7 +372,7 @@ void DCS::print(const std::string &s="") const {
bool DCS::equals(const Base &expected, double tol) const {
const DCS* p = dynamic_cast<const DCS*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(c_ - p->c_) < tol;
}
@ -411,7 +411,7 @@ void L2WithDeadZone::print(const std::string &s="") const {
bool L2WithDeadZone::equals(const Base &expected, double tol) const {
const L2WithDeadZone* p = dynamic_cast<const L2WithDeadZone*>(&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return std::abs(k_ - p->k_) < tol;
}

View File

@ -133,7 +133,7 @@ void Gaussian::print(const string& name) const {
/* ************************************************************************* */
bool Gaussian::equals(const Base& expected, double tol) const {
const Gaussian* p = dynamic_cast<const Gaussian*> (&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
if (typeid(*this) != typeid(*p)) return false;
//if (!sqrt_information_) return true; // ALEX todo;
return equal_with_abs_tol(R(), p->R(), sqrt(tol));
@ -624,7 +624,7 @@ void Robust::print(const std::string& name) const {
bool Robust::equals(const Base& expected, double tol) const {
const Robust* p = dynamic_cast<const Robust*> (&expected);
if (p == NULL) return false;
if (p == nullptr) return false;
return noise_->equals(*p->noise_,tol) && robust_->equals(*p->robust_,tol);
}

View File

@ -253,7 +253,7 @@ TEST(JacobianFactor, error)
/* ************************************************************************* */
TEST(JacobianFactor, matrices_NULL)
{
// Make sure everything works with NULL noise model
// Make sure everything works with nullptr noise model
JacobianFactor factor(simple::terms, simple::b);
Matrix jacobianExpected(3, 9);

View File

@ -114,7 +114,7 @@ void AHRSFactor::print(const string& s,
//------------------------------------------------------------------------------
bool AHRSFactor::equals(const NonlinearFactor& other, double tol) const {
const This *e = dynamic_cast<const This*>(&other);
return e != NULL && Base::equals(*e, tol) && _PIM_.equals(e->_PIM_, tol);
return e != nullptr && Base::equals(*e, tol) && _PIM_.equals(e->_PIM_, tol);
}
//------------------------------------------------------------------------------

View File

@ -52,7 +52,7 @@ void Rot3AttitudeFactor::print(const string& s,
bool Rot3AttitudeFactor::equals(const NonlinearFactor& expected,
double tol) const {
const This* e = dynamic_cast<const This*>(&expected);
return e != NULL && Base::equals(*e, tol) && this->nZ_.equals(e->nZ_, tol)
return e != nullptr && Base::equals(*e, tol) && this->nZ_.equals(e->nZ_, tol)
&& this->bRef_.equals(e->bRef_, tol);
}
@ -69,7 +69,7 @@ void Pose3AttitudeFactor::print(const string& s,
bool Pose3AttitudeFactor::equals(const NonlinearFactor& expected,
double tol) const {
const This* e = dynamic_cast<const This*>(&expected);
return e != NULL && Base::equals(*e, tol) && this->nZ_.equals(e->nZ_, tol)
return e != nullptr && Base::equals(*e, tol) && this->nZ_.equals(e->nZ_, tol)
&& this->bRef_.equals(e->bRef_, tol);
}

View File

@ -174,7 +174,7 @@ void CombinedImuFactor::print(const string& s,
//------------------------------------------------------------------------------
bool CombinedImuFactor::equals(const NonlinearFactor& other, double tol) const {
const This* e = dynamic_cast<const This*>(&other);
return e != NULL && Base::equals(*e, tol) && _PIM_.equals(e->_PIM_, tol);
return e != nullptr && Base::equals(*e, tol) && _PIM_.equals(e->_PIM_, tol);
}
//------------------------------------------------------------------------------

View File

@ -32,7 +32,7 @@ void GPSFactor::print(const string& s, const KeyFormatter& keyFormatter) const {
//***************************************************************************
bool GPSFactor::equals(const NonlinearFactor& expected, double tol) const {
const This* e = dynamic_cast<const This*>(&expected);
return e != NULL && Base::equals(*e, tol) && traits<Point3>::Equals(nT_, e->nT_, tol);
return e != nullptr && Base::equals(*e, tol) && traits<Point3>::Equals(nT_, e->nT_, tol);
}
//***************************************************************************
@ -73,7 +73,7 @@ void GPSFactor2::print(const string& s, const KeyFormatter& keyFormatter) const
//***************************************************************************
bool GPSFactor2::equals(const NonlinearFactor& expected, double tol) const {
const This* e = dynamic_cast<const This*>(&expected);
return e != NULL && Base::equals(*e, tol) &&
return e != nullptr && Base::equals(*e, tol) &&
traits<Point3>::Equals(nT_, e->nT_, tol);
}

View File

@ -219,7 +219,7 @@ struct GTSAM_EXPORT ISAM2Params {
/// When you will be removing many factors, e.g. when using ISAM2 as a
/// fixed-lag smoother, enable this option to add factors in the first
/// available factor slots, to avoid accumulating NULL factor slots, at the
/// available factor slots, to avoid accumulating nullptr factor slots, at the
/// cost of having to search for slots every time a factor is added.
bool findUnusedFactorSlots;

View File

@ -54,7 +54,7 @@ void NonlinearFactorGraph::print(const std::string& str, const KeyFormatter& key
for (size_t i = 0; i < factors_.size(); i++) {
stringstream ss;
ss << "Factor " << i << ": ";
if (factors_[i] != NULL) factors_[i]->print(ss.str(), keyFormatter);
if (factors_[i] != nullptr) factors_[i]->print(ss.str(), keyFormatter);
cout << endl;
}
}
@ -67,8 +67,8 @@ void NonlinearFactorGraph::printErrors(const Values& values, const std::string&
for (size_t i = 0; i < factors_.size(); i++) {
stringstream ss;
ss << "Factor " << i << ": ";
if (factors_[i] == NULL) {
cout << "NULL" << endl;
if (factors_[i] == nullptr) {
cout << "nullptr" << endl;
} else {
factors_[i]->print(ss.str(), keyFormatter);
cout << "error = " << factors_[i]->error(values) << endl;

View File

@ -98,7 +98,7 @@ struct Record: public internal::CallRecordImplementor<Record, Cols> {
friend struct internal::CallRecordImplementor;
};
internal::JacobianMap & NJM= *static_cast<internal::JacobianMap *>(NULL);
internal::JacobianMap & NJM= *static_cast<internal::JacobianMap *>(nullptr);
/* ************************************************************************* */
typedef Eigen::Matrix<double, Eigen::Dynamic, Cols> DynRowMat;

View File

@ -67,7 +67,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && this->factor_->equals(*e->factor_, tol);
return e != nullptr && Base::equals(*e, tol) && this->factor_->equals(*e->factor_, tol);
}
/** implement functions needed to derive from Factor */

View File

@ -81,7 +81,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && traits<T>::Equals(this->measured_, e->measured_, tol);
return e != nullptr && Base::equals(*e, tol) && traits<T>::Equals(this->measured_, e->measured_, tol);
}
/** implement functions needed to derive from Factor */

View File

@ -37,7 +37,7 @@ void EssentialMatrixConstraint::print(const std::string& s,
bool EssentialMatrixConstraint::equals(const NonlinearFactor& expected,
double tol) const {
const This *e = dynamic_cast<const This*>(&expected);
return e != NULL && Base::equals(*e, tol)
return e != nullptr && Base::equals(*e, tol)
&& this->measuredE_.equals(e->measuredE_, tol);
}

View File

@ -65,7 +65,7 @@ public:
Base() {
size_t numKeys = Enull.rows() / ZDim;
size_t m2 = ZDim * numKeys - 3; // TODO: is this not just Enull.rows()?
// PLAIN NULL SPACE TRICK
// PLAIN nullptr SPACE TRICK
// Matrix Q = Enull * Enull.transpose();
// for(const KeyMatrixZD& it: Fblocks)
// QF.push_back(KeyMatrix(it.first, Q.block(0, 2 * j++, m2, 2) * it.second));

View File

@ -31,7 +31,7 @@ void OrientedPlane3DirectionPrior::print(const string& s,
bool OrientedPlane3DirectionPrior::equals(const NonlinearFactor& expected,
double tol) const {
const This* e = dynamic_cast<const This*>(&expected);
return e != NULL && Base::equals(*e, tol)
return e != nullptr && Base::equals(*e, tol)
&& this->measured_p_.equals(e->measured_p_, tol);
}

View File

@ -62,7 +62,7 @@ public:
/** equals specialized to this factor */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && measured_.equals(e->measured_, tol);
return e != nullptr && Base::equals(*e, tol) && measured_.equals(e->measured_, tol);
}
/** print contents */

View File

@ -76,7 +76,7 @@ public:
/** equals specialized to this factor */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && traits<Translation>::Equals(measured_, e->measured_, tol);
return e != nullptr && Base::equals(*e, tol) && traits<Translation>::Equals(measured_, e->measured_, tol);
}
/** print contents */

View File

@ -85,7 +85,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This* e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && traits<T>::Equals(prior_, e->prior_, tol);
return e != nullptr && Base::equals(*e, tol) && traits<T>::Equals(prior_, e->prior_, tol);
}
/** implement functions needed to derive from Factor */

View File

@ -175,7 +175,7 @@ TEST( OrientedPlane3DirectionPrior, Constructor ) {
/* ************************************************************************* */
int main() {
srand(time(NULL));
srand(time(nullptr));
TestResult tr;
return TestRegistry::runAllTests(tr);
}

View File

@ -72,7 +72,7 @@ namespace gtsam {
}; // Node
// We store a shared pointer to the root of the functional tree
// composed of Node classes. If root_==NULL, the tree is empty.
// composed of Node classes. If root_==nullptr, the tree is empty.
typedef boost::shared_ptr<const Node> sharedNode;
sharedNode root_;
@ -223,7 +223,7 @@ namespace gtsam {
/** Return height of the tree, 0 if empty */
size_t height() const {
return (root_ != NULL) ? root_->height_ : 0;
return (root_ != nullptr) ? root_->height_ : 0;
}
/** return size of the tree */

View File

@ -136,7 +136,7 @@ TEST(LinearEquality, error)
/* ************************************************************************* */
TEST(LinearEquality, matrices_NULL)
{
// Make sure everything works with NULL noise model
// Make sure everything works with nullptr noise model
LinearEquality factor(simple::terms, simple::b, 0);
Matrix AExpected(3, 9);

View File

@ -39,7 +39,7 @@ bool BatchFixedLagSmoother::equals(const FixedLagSmoother& rhs,
double tol) const {
const BatchFixedLagSmoother* e =
dynamic_cast<const BatchFixedLagSmoother*>(&rhs);
return e != NULL && FixedLagSmoother::equals(*e, tol)
return e != nullptr && FixedLagSmoother::equals(*e, tol)
&& factors_.equals(e->factors_, tol) && theta_.equals(e->theta_, tol);
}
@ -145,7 +145,7 @@ void BatchFixedLagSmoother::removeFactors(
} else {
// TODO: Throw an error??
cout << "Attempting to remove a factor from slot " << slot
<< ", but it is already NULL." << endl;
<< ", but it is already nullptr." << endl;
}
}
}
@ -370,7 +370,7 @@ void BatchFixedLagSmoother::PrintSymbolicFactor(
cout << " " << DefaultKeyFormatter(key);
}
} else {
cout << " NULL";
cout << " nullptr";
}
cout << " )" << endl;
}

View File

@ -38,7 +38,7 @@ void ConcurrentBatchFilter::PrintNonlinearFactor(const NonlinearFactor::shared_p
}
std::cout << ")" << std::endl;
} else {
std::cout << "{ NULL }" << std::endl;
std::cout << "{ nullptr }" << std::endl;
}
}
@ -79,7 +79,7 @@ void ConcurrentBatchFilter::PrintLinearFactor(const GaussianFactor::shared_ptr&
}
std::cout << ")" << std::endl;
} else {
std::cout << "{ NULL }" << std::endl;
std::cout << "{ nullptr }" << std::endl;
}
}

View File

@ -394,7 +394,7 @@ void ConcurrentBatchSmoother::PrintNonlinearFactor(const NonlinearFactor::shared
}
std::cout << ")" << std::endl;
} else {
std::cout << "{ NULL }" << std::endl;
std::cout << "{ nullptr }" << std::endl;
}
}
@ -408,7 +408,7 @@ void ConcurrentBatchSmoother::PrintLinearFactor(const GaussianFactor::shared_ptr
}
std::cout << ")" << std::endl;
} else {
std::cout << "{ NULL }" << std::endl;
std::cout << "{ nullptr }" << std::endl;
}
}

View File

@ -58,7 +58,7 @@ bool IncrementalFixedLagSmoother::equals(const FixedLagSmoother& rhs,
double tol) const {
const IncrementalFixedLagSmoother* e =
dynamic_cast<const IncrementalFixedLagSmoother*>(&rhs);
return e != NULL && FixedLagSmoother::equals(*e, tol)
return e != nullptr && FixedLagSmoother::equals(*e, tol)
&& isam_.equals(e->isam_, tol);
}

View File

@ -83,14 +83,14 @@ namespace gtsam { namespace partition {
graph_t *graph;
real_t *tpwgts2;
ctrl_t *ctrl;
ctrl = SetupCtrl(METIS_OP_OMETIS, options, 1, 3, NULL, NULL);
ctrl = SetupCtrl(METIS_OP_OMETIS, options, 1, 3, nullptr, nullptr);
ctrl->iptype = METIS_IPTYPE_GROW;
//if () == NULL)
//if () == nullptr)
// return METIS_ERROR_INPUT;
InitRandom(ctrl->seed);
graph = SetupGraph(ctrl, *nvtxs, 1, xadj, adjncy, vwgt, NULL, NULL);
graph = SetupGraph(ctrl, *nvtxs, 1, xadj, adjncy, vwgt, nullptr, nullptr);
AllocateWorkSpace(ctrl, graph);

View File

@ -66,7 +66,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && traits<Point3>::Equals(this->measured_, e->measured_, tol);
return e != nullptr && Base::equals(*e, tol) && traits<Point3>::Equals(this->measured_, e->measured_, tol);
}
/** implement functions needed to derive from Factor */

View File

@ -155,7 +155,7 @@ public:
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol)
return e != nullptr && Base::equals(*e, tol)
&& (delta_pos_in_t0_ - e->delta_pos_in_t0_).norm() < tol
&& (delta_vel_in_t0_ - e->delta_vel_in_t0_).norm() < tol
&& (delta_angles_ - e->delta_angles_).norm() < tol

View File

@ -153,7 +153,7 @@ public:
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol)
return e != nullptr && Base::equals(*e, tol)
&& (delta_pos_in_t0_ - e->delta_pos_in_t0_).norm() < tol
&& (delta_vel_in_t0_ - e->delta_vel_in_t0_).norm() < tol
&& (delta_angles_ - e->delta_angles_).norm() < tol

View File

@ -81,7 +81,7 @@ public:
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol);
return e != nullptr && Base::equals(*e, tol);
}
/** implement functions needed to derive from Factor */

View File

@ -135,7 +135,7 @@ public:
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol)
return e != nullptr && Base::equals(*e, tol)
&& (measurement_acc_ - e->measurement_acc_).norm() < tol
&& (measurement_gyro_ - e->measurement_gyro_).norm() < tol
&& (dt_ - e->dt_) < tol

View File

@ -100,7 +100,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) &&
return e != nullptr && Base::equals(*e, tol) &&
gtsam::equal_with_abs_tol(this->prior_, e->prior_, tol) &&
this->mask_ == e->mask_;
}

View File

@ -79,7 +79,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL
return e != nullptr
&& Base::equals(*e, tol)
&& this->measured_.equals(e->measured_, tol)
&& ((!body_P_sensor_ && !e->body_P_sensor_) || (body_P_sensor_ && e->body_P_sensor_ && body_P_sensor_->equals(*e->body_P_sensor_)));

View File

@ -74,7 +74,7 @@ namespace gtsam {
/** equals */
virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const {
const This* e = dynamic_cast<const This*> (&expected);
return e != NULL
return e != nullptr
&& Base::equals(*e, tol)
&& this->prior_.equals(e->prior_, tol)
&& ((!body_P_sensor_ && !e->body_P_sensor_) || (body_P_sensor_ && e->body_P_sensor_ && body_P_sensor_->equals(*e->body_P_sensor_)));

View File

@ -38,7 +38,7 @@ Vector RelativeElevationFactor::evaluateError(const Pose3& pose, const Point3& p
/* ************************************************************************* */
bool RelativeElevationFactor::equals(const NonlinearFactor& expected, double tol) const {
const This *e = dynamic_cast<const This*> (&expected);
return e != NULL && Base::equals(*e, tol) && std::abs(this->measured_ - e->measured_) < tol;
return e != nullptr && Base::equals(*e, tol) && std::abs(this->measured_ - e->measured_) < tol;
}
/* ************************************************************************* */

View File

@ -162,7 +162,7 @@ public:
/** Check if two factors are equal. Note type is IndexFactor and needs cast. */
virtual bool equals(const NonlinearFactor& f, double tol = 1e-9) const {
const This *e = dynamic_cast<const This*> (&f);
return (e != NULL) && (key1() == e->key1()) && (key2() == e->key2());
return (e != nullptr) && (key1() == e->key1()) && (key2() == e->key2());
}
/**
@ -196,7 +196,7 @@ public:
Vector b = -evaluateError(x1, x2, A1, A2);
SharedDiagonal constrained =
boost::dynamic_pointer_cast<noiseModel::Constrained>(this->noiseModel_);
if (constrained.get() != NULL) {
if (constrained.get() != nullptr) {
return JacobianFactor::shared_ptr(new JacobianFactor(key1(), A1, key2(),
A2, b, constrained));
}
@ -292,7 +292,7 @@ public:
/** Check if two factors are equal. Note type is IndexFactor and needs cast. */
virtual bool equals(const NonlinearFactor& f, double tol = 1e-9) const {
const This *e = dynamic_cast<const This*> (&f);
return (e != NULL) && Base::equals(f);
return (e != nullptr) && Base::equals(f);
}
/**
@ -325,7 +325,7 @@ public:
Vector b = -evaluateError(x1, A1);
SharedDiagonal constrained =
boost::dynamic_pointer_cast<noiseModel::Constrained>(this->noiseModel_);
if (constrained.get() != NULL) {
if (constrained.get() != nullptr) {
return JacobianFactor::shared_ptr(new JacobianFactor(key(), A1, b, constrained));
}
// "Whiten" the system before converting to a Gaussian Factor