PGROUTING  2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pgr_messages.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: pgr_messages.h
4 
5 Copyright (c) 2015 pgRouting developers
6 Mail: project@pgrouting.org
7 
8 ------
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 
24  ********************************************************************PGR-GNU*/
25 
28 #ifndef INCLUDE_CPP_COMMON_PGR_MESSAGES_H_
29 #define INCLUDE_CPP_COMMON_PGR_MESSAGES_H_
30 #pragma once
31 
32 
33 
34 #include <string>
35 #include <sstream>
36 
37 namespace pgrouting {
38 
39 class Pgr_messages {
40  public:
41  Pgr_messages() = default;
44  return *this;
45  }
46 
52  std::string get_log() const;
53 
59  std::string get_notice() const;
60 
65  bool has_error() const;
66 
72  std::string get_error() const;
73 
79  void clear();
80 
81 #ifndef NDEBUG
82 
87  std::string get_dbglog() const;
88 #endif
89 
90 #if 0
91  void entering(const char* function) {
92 #if defined(__MINGW32__) || defined(_MSC_VER)
93 #else
94  log << "ENTERING: " << function << "\n";
95 #endif
96  }
97 #endif
98 
99 
100  public:
102  mutable std::ostringstream log;
104  mutable std::ostringstream notice;
106  mutable std::ostringstream error;
107 #ifndef NDEBUG
108  mutable std::ostringstream dbg_log;
109 #endif
110 };
111 
112 
113 
114 #if defined(__MINGW32__) || defined(_MSC_VER)
115 #define ENTERING()
116 #define EXITING()
117 #else
118 #define ENTERING() msg.log << "--> " << __PRETTY_FUNCTION__ << "\n"
119 #define EXITING() msg.log << "<-- " << __PRETTY_FUNCTION__ << "\n"
120 #endif
121 
122 
123 
124 } // namespace pgrouting
125 
126 #endif // INCLUDE_CPP_COMMON_PGR_MESSAGES_H_
std::ostringstream log
Stores the hint information.
Definition: pgr_messages.h:102
std::string get_log() const
get_log
std::ostringstream dbg_log
Definition: pgr_messages.h:108
std::string get_notice() const
get_notice
std::string get_error() const
get_error
std::string get_dbglog() const
get_error
std::ostringstream error
Stores the error information.
Definition: pgr_messages.h:106
Pgr_messages(const Pgr_messages &)
Definition: pgr_messages.h:42
std::ostringstream notice
Stores the notice information.
Definition: pgr_messages.h:104
Pgr_messages & operator=(const Pgr_messages &)
Definition: pgr_messages.h:43
bool has_error() const
get_error