Changed checkExists() to show invalid key value in error message. Commented out copyStructureFrom(), as it doesn't appear to be implemented

release/4.3a0
Alex Cunningham 2013-01-27 20:12:20 +00:00
parent e1563d9c21
commit 5a9e2a42ec
1 changed files with 8 additions and 4 deletions

View File

@ -20,6 +20,7 @@
#include <gtsam/base/Vector.h>
#include <gtsam/base/types.h>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_ptr.hpp>
@ -314,14 +315,17 @@ namespace gtsam {
void chk() const;
// Throw an exception if j does not exist
void checkExists(Index j) const {
inline void checkExists(Index j) const {
chk();
if(!exists(j))
throw std::out_of_range("VectorValues: requested variable index is not in this VectorValues.");
if(!exists(j)) {
const std::string msg =
(boost::format("VectorValues: requested variable index j=%1% is not in this VectorValues.") % j).str();
throw std::out_of_range(msg);
}
}
// Resize
void copyStructureFrom(const VectorValues& other);
// void copyStructureFrom(const VectorValues& other) // FIXME: not implemented?
public: