error_observer.hpp
Go to the documentation of this file.
1 #ifndef RAM_PATH_PLANNING_ERROR_OBSERVER_HPP
2 #define RAM_PATH_PLANNING_ERROR_OBSERVER_HPP
3 
4 #include <string>
5 
6 #include <vtkCommand.h>
7 
8 class ErrorObserver : public vtkCommand
9 {
10 public:
12  Error(false),
13  Warning(false),
14  ErrorMessage(""),
15  WarningMessage("")
16  {
17  }
18 
22  static ErrorObserver *New()
23  {
24  return new ErrorObserver;
25  }
26 
29  bool inline GetError() const
30  {
31  return Error;
32  }
33 
36  bool inline GetWarning() const
37  {
38  return Warning;
39  }
40 
42  void inline Clear()
43  {
44  Error = false;
45  Warning = false;
46  ErrorMessage = "";
47  WarningMessage = "";
48  }
49 
50  virtual void Execute(vtkObject *vtkNotUsed(caller),
51  unsigned long event,
52  void * calldata)
53  {
54  switch (event)
55  {
56  case vtkCommand::ErrorEvent:
57  ErrorMessage += static_cast<char*>(calldata);
58  Error = true;
59  break;
60  case vtkCommand::WarningEvent:
61  WarningMessage += static_cast<char*>(calldata);
62  Warning = true;
63  break;
64  }
65  }
66 
69  inline std::string GetErrorMessage() const
70  {
71  return ErrorMessage;
72  }
73 
76  inline std::string GetWarningMessage() const
77  {
78  return WarningMessage;
79  }
80 
81 private:
82  bool Error;
83  bool Warning;
84  std::string ErrorMessage;
85  std::string WarningMessage;
86 };
87 
88 #endif
89 
virtual void Execute(vtkObject *vtkNotUsed(caller), unsigned long event, void *calldata)
static ErrorObserver * New()
std::string WarningMessage
void Clear()
Clear all members of the object.
std::string GetErrorMessage() const
Call this function to get the error message if there is any.
std::string ErrorMessage
std::string GetWarningMessage() const
Call this function to get the warning message if there is any.
bool GetWarning() const
Call this function to know either or not a warning has occurred.
bool GetError() const
Call this function to know either or not an error has occurred.


ram_path_planning
Author(s): Andres Campos - Institut Maupertuis
autogenerated on Mon Jun 10 2019 14:50:03