Main MRPT website > C++ reference for MRPT 1.9.9
CHypothesisNotFoundException.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "graphs-precomp.h" // Precompiled headers
11 
13 
14 using namespace mrpt::graphs;
15 
18  : runtime_error("Hypothesis between set of nodes was not found")
19 {
20  using namespace mrpt;
21 
22  this->clear();
23  m_to = to;
24  m_from = from;
25 
26  // TODO - Do not allocate it on the stack
27  // http://stackoverflow.com/a/23742555/2843583
28  m_msg = std::runtime_error::what();
29  m_msg += "- ";
30  m_msg +=
31  format("[from] %lu ==> ", static_cast<unsigned long>(m_from)).c_str();
32  m_msg += format("[to] %lu", static_cast<unsigned long>(m_to)).c_str();
33 }
34 
36  : runtime_error("Hypothesis with the given ID was not found")
37 {
38  using namespace mrpt;
39 
40  this->clear();
41  m_id = id;
42 
43  m_msg = std::runtime_error::what();
44  m_msg += format("- ID:%lu", static_cast<unsigned long>(id)).c_str();
45 }
46 
48 {
51  m_id = SIZE_MAX;
52  m_msg.clear();
53 }
54 
57 {
58  return m_msg;
59 }
60 
62 
63 const char* HypothesisNotFoundException::what() const throw()
64 {
66  return persistent_error_msg.c_str();
67 }
mrpt::graphs::HypothesisNotFoundException::m_id
size_t m_id
Hypothesis ID.
Definition: CHypothesisNotFoundException.h:37
mrpt::graphs::HypothesisNotFoundException::m_msg
std::string m_msg
Error message.
Definition: CHypothesisNotFoundException.h:40
mrpt::graphs::HypothesisNotFoundException::what
const char * what() const noexcept
Definition: CHypothesisNotFoundException.cpp:63
mrpt::graphs::TNodeID
uint64_t TNodeID
A generic numeric type for unique IDs of nodes or entities.
Definition: TNodeID.h:17
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::graphs::HypothesisNotFoundException::~HypothesisNotFoundException
~HypothesisNotFoundException() noexcept
Definition: CHypothesisNotFoundException.cpp:55
graphs-precomp.h
mrpt::graphs::HypothesisNotFoundException::clear
void clear()
Definition: CHypothesisNotFoundException.cpp:47
mrpt::graphs::HypothesisNotFoundException::m_to
mrpt::graphs::TNodeID m_to
Definition: CHypothesisNotFoundException.h:34
mrpt::graphs::HypothesisNotFoundException::m_from
mrpt::graphs::TNodeID m_from
Definition: CHypothesisNotFoundException.h:34
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
id
GLuint id
Definition: glext.h:3909
mrpt::graphs
Abstract graph and tree data structures, plus generic graph algorithms.
Definition: CAStarAlgorithm.h:18
persistent_error_msg
std::string persistent_error_msg
Definition: CHypothesisNotFoundException.cpp:61
mrpt::graphs::HypothesisNotFoundException::HypothesisNotFoundException
HypothesisNotFoundException(mrpt::graphs::TNodeID from, mrpt::graphs::TNodeID to)
Definition: CHypothesisNotFoundException.cpp:16
SIZE_MAX
#define SIZE_MAX
Definition: xSens_MT3/pstdint.h:131
string
GLsizei const GLchar ** string
Definition: glext.h:4101
INVALID_NODEID
#define INVALID_NODEID
Definition: TNodeID.h:20
CHypothesisNotFoundException.h
mrpt::graphs::HypothesisNotFoundException::getErrorMsg
std::string getErrorMsg() const noexcept
Definition: CHypothesisNotFoundException.cpp:56



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST